python程序中执行报错:

Traceback (most recent call last):
File “XXXXXXXXXXXXXXXX.py”, line 237, in <module>
leftpose_radius002 = pose.radius[1]
IndexError: index 1 is out of bounds for axis 0 with size 1

检查以后是发现提取数据的格式不对,比如说原数据为:

head_pose.position = [ 0.0589693 0.05704604 -0.13406745]

要这么操作:

head_posePosition001 = head_pose.position[0]
head_posePosition002 = head_pose.position[1]
head_posePosition003 = head_pose.position[2]
但是如果原数据为head_pose.position = [1]
那么就会报错IndexError: index 1 is out of bounds for axis 0 with size 1
就是说提取不到第二位的数据,所以报错,也就是说,提取的代码要符合原数据结构的维度才行,比如三维的就写三个提取,1维的就只需要提取一个数字就行了