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

Hi,

According to this test: https://github.com/ros-drivers/rosserial/blob/jade-devel/rosserial_client/test/subscriber_test.cpp#L43

You should write:

class DifferentialDriveRobot
{
          ...
    public:
        ros::NodeHandle nh;
        ros::Subscriber<geometry_msgs::Twist, DifferentialDriveRobot> sub;
        ...
        void ddr_callback(const geometry_msgs::Twist& msg)  {...}

        DifferentialDriveRobot()
        : sub("/cmd_vel_mux/input/teleop", &DifferentialDriveRobot::ddr_callback, this)
        {  // Constructor
            nh.initNode()
            nh.subscribe(sub);
         }
};

Hi,

According to this test: https://github.com/ros-drivers/rosserial/blob/jade-devel/rosserial_client/test/subscriber_test.cpp#L43https://github.com/ros-drivers/rosserial/blob/dd76994c67c5e4997ef64837c07afb4eb0d4df27/rosserial_client/test/subscriber_test.cpp#L52

You should write:

class DifferentialDriveRobot
{
          ...
    public:
        ros::NodeHandle nh;
        ros::Subscriber<geometry_msgs::Twist, DifferentialDriveRobot> sub;
        ...
        void ddr_callback(const geometry_msgs::Twist& msg)  {...}

        DifferentialDriveRobot()
        : sub("/cmd_vel_mux/input/teleop", &DifferentialDriveRobot::ddr_callback, this)
        {  // Constructor
            nh.initNode()
            nh.subscribe(sub);
         }
};