ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
So, the code which I use is as follows:
...
using namespace std;
void callback(const sensor_msgs::JointState::ConstPtr& msg)
{
ROS_INFO("Received: ", msg->position);
cout << "Subscriber works!";
}
int main(int argc, char** argv) {
ros::init(argc, argv, "youbot_arm_test");
ros::Rate rate(20); //Hz
ros::NodeHandle nh;
ros::Subscriber sub;
sub = nh.subscribe ("JointState", 1000, callback);
ros::Rate rate(20); //Hz
//So, from now on in my program I can get the positions of the Joints by writing
//sub = nh.subscribe("joint_states", 1000, callback);
//RIGHT??