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

get person position data from leg_detector

asked 2017-06-19 06:20:53 -0500

stoevi gravatar image

updated 2017-06-20 08:01:04 -0500

Hey everyone, im pretty new to Unix and the whole ROS ecosystem and im currently working on my bachelor thesis in trying to realise person following by a turtlebot 2. Im running ROS indigo. Right now im trying to get Position data of persons through the leg_detector node ( http://wiki.ros.org/leg_detector ).

The installation and setup is done and now im trying to get the data out of the "people_tracker_measurements"-topic. Unfortunately Im not getting any feedback through "rostopic echo" and im also not really sure how to adress the variables coming from this topic in my own node (im coding in python). According to the documentation files in ROS wiki i imagine it works like this:

  • people_tracker_measurements publishes the the msg-type PositionMeasurementArray under the name of "people" which is basically an array of PositionMeasurements for several people (so msg.people[0] gives data for the first person registered). -PositionMeasurement is a message type which contains the variable "pos" of the type geometry_msgs/Point and some other which i dont really care about right now
  • "Point" from geometry_msgs.msg however got the x,y,z coordinates of my person as simple floats

I setup a package through catkin and created my .py-file in the src-Folder. Eventually i want to take my distance to person x and calculate speed commands (angular and linear) for my robot to follow the person but for now i just want extract the raw position data to start working with it. Here is my code:

import rospy
import math

from geometry_msgs.msg import Twist
from geometry_msgs.msg import Point
from people_msgs.msg import PositionMeasurementArray
from people_msgs.msg import PositionMeasurement

rospy.init_node('turtlebot_follower_leg_detector')

pub = rospy.Publisher ('cmd_vel_mux/input/teleop', Twist)

def callback(msg):
   print 'person 1:', msg.people[0].pos.x
sub = rospy.Subscriber('people_tracker_measurements', PositionMeasurementArray, callback)

My node causes no errors when starting but just doesnt print anything so im quite sure im not grabbing the right value (or any value) in my print-line. "rostopic echo people_tracker_measurements" also doesnt echo anything...

Maybe im doing a very basic python mistake here but as my coding skills are pretty limited, i unfortunately cant fix this myself.

EDIT: I just realisied that trying to to rostopic echo the topic produces the quite known error "Cannot load message class for [people_msgs/PositionMeasurementArray]. Are your messages built?" but unlike many other users i get the following error when using "rosmsg show PositionMeasurementArray": "Could not find msg 'PositionMeasurement'".

I downloaded the source of the people-package from https://github.com/wg-perception/people , put it in my catkin_ws/src folder and uses catkin_make. Still the message type seems to be unknown for my ROS

Some help is much appreciated!

Best regards, stoevi

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-06-23 02:48:53 -0500

stoevi gravatar image

okay so I found the answer myself, maybe it will help someone who got a similar problem:

I downloaded the leg_detector package as part of the whole people-package and split them afterwards because i thought i only need the leg_detector. big mistake by me, I shouldn't have switched up the directories. after I copypasted just the whole dir into my catkin_ws and executed catkin_make, i needed to again source my workspace in every shell (the permanent solution somehow doesnt work right now) before i can use the people-messages.

the syntax in my code for getting position seems to be alright, I know get my data and can work with it :)

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2017-06-19 06:19:49 -0500

Seen: 1,039 times

Last updated: Jun 23 '17