ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
def callback(msg):
  for human in msg.human_list:
      x = human.body_key_points_with_prob.x
      ...

This is a Python issue more than a ROS one, but: human.body_key_points_with_prob is of type list, not of type openpose_ros_msgs/PointWithProb. So the list contains openpose_ros_msgs/PointWithProb instances.

To access those, you'll need to use the [] operator to index into the list. Something like:

x = human.body_key_points_with_prob[0].x

would give you the .x attribute of the first entry in the list.

You would obviously first have to make sure that the list actually contains any items.