the controller can not subscribe to the topic from gazebo

asked 2014-04-02 03:56:46 -0600

hannuaa gravatar image

updated 2014-04-02 03:58:44 -0600

demmeln gravatar image

Hi , everyone. Now, I add a contact sensor for the robot in xacro file, as follow:

<gazebo reference="${robot_name}left_lower_arm">
   <sensor type="contact" name="left_lower_arm_contact_sensor">

      <plugin name="left_lower_arm_gazebo_ros_bumper_controller" filename="">

I can get the data of the contact sensor by typing "rostopic echo r2/left_lower_arm_contact". But when I program in the controller to get the sensor data, I get nothing. The program in the controller is as follow:

left_hand_contact_sub = node.subscribe("r2/left_lower_arm_contact", 10, &R2ImpedanceController::left_hand_contact, this);

My ROS is groovy.Any answer to these questions, or any suggestion is very welcome!

edit retag flag offensive close merge delete


Use rxgraph or rqt_graph to check the connectivity between gazebo and your node for the `r2/left_lower_arm_contact` topic. Include some more of your code, in particular how you create the `node` object. How do you notice that you get "nothing"? What does the callback look like?

demmeln gravatar image demmeln  ( 2014-04-02 04:07:30 -0600 )edit