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

Subscribe /tilt_controller1/state to know current position

asked 2015-07-09 05:28:45 -0600

Rookie92 gravatar image

updated 2015-07-09 09:50:17 -0600

Hi people,

I am working with Dynamixel Servomotor AX-12+ in ROS fuerte and I need to know its current position.

In my code I subscribe to /tilt_controller1/state this is the info topic:

youbot@diego-VPCEH2K1E:~$ rostopic info /tilt_controller1/state
Type: dynamixel_msgs/JointState

but I dont know how to put the arguments of the callback, this is my code:

#include <dynamixel_msgs/JointState.h>
//----------------
void callback(const dynamixel_msgs::JointState& str)
{
    //str.current_pos
    std::cout<<"rotacion"<<std::endl;
}
//-------
sub = n.subscribe("/tilt_controller1/state", 1, callback);

The error is:

fatal error: dynamixel_msgs/JointState.h: No such file or directory

I think is a mistake with the library...is the rest of the code ok? Please can somebody help me?

Thanks

edit retag flag offensive close merge delete

Comments

Could you elaborate? I'm not sure I completely understand your question. If this doesn't compile, please update your question with the compiler output and error messages.

thebyohazard gravatar image thebyohazard  ( 2015-07-09 08:27:57 -0600 )edit

Eddit with the error. I think I have not the library JointState.h but i dont know if that is the only problem. Where can i get the library and where must i put it? I add in the manifest:

<depend package="JointState"/>

and then this is the error:

1/2

Rookie92 gravatar image Rookie92  ( 2015-07-09 10:01:16 -0600 )edit

2/2

and then this is the error:

Failed to invoke /opt/ros/fuerte/bin/rospack deps-manifests mapping
  [rospack] Error: package/stack mapping depends on non-existent package JointState
Rookie92 gravatar image Rookie92  ( 2015-07-09 10:01:45 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-07-10 08:38:34 -0600

thebyohazard gravatar image

updated 2015-07-10 08:39:50 -0600

The package is actually dynamixel_msgs. JointState is one of the messages defined in the dynamixel_msgs package, so change

<depend package="JointState"/>

to

<depend package="dynamixel_msgs"/>
edit flag offensive delete link more

Comments

Thanks so much tbh!!!!! you have made me happier Friday :)

Only one question more in the callback when i want to use the current position is this code line right?

counter=str.current_pos;
Rookie92 gravatar image Rookie92  ( 2015-07-10 09:12:36 -0600 )edit

Sure thing. That looks right to me.

thebyohazard gravatar image thebyohazard  ( 2015-07-10 09:37:31 -0600 )edit

Thanks thanks thanks thanks!!!!!

Rookie92 gravatar image Rookie92  ( 2015-07-10 09:52:19 -0600 )edit

Question Tools

Stats

Asked: 2015-07-09 05:28:45 -0600

Seen: 416 times

Last updated: Jul 10 '15