Subscribe to endpoint_state, and save the pose position coordinates for later use
On the terminal, I'm entering in
$ rostopic echo /robot/limb/left/endpoint_state
to get the position of the endpoints. The output comes out like this:
pose:
position: x: 0.0881700859423
y: 0.666633918353
z: -0.25671871773
...
Now, in my program, I want to subscribe to this topic and retrieve just the above coordinates: the pose x, y and z. My subscriber looks like this:
ros::Subscriber sub = n.subscribe("/robot/limb/left/endpoint_state", 1, leftEndpointCallback)
In my callback, I'm trying to get just these specific coordinates as floats or doubles or whatever data type they are, and be able to use them later in my code (i.e. use the x coordinate in an if statement, for example). How would I do this?