text: Joint Control in Baxter using ROS in C++
  Hi,
  I am a beginner in ROS. I am trying to control Baxter Robot using ROS in C++ language. I want to move Baxter in Joint Level Control by providing each joint angels. Since, this is my learning phase, so I am avoiding python API for now. However I have already tried python API from the Baxter official website.
  Well, I tried printing the current joint angles by subscribing to
  /robot/joint_states topic in the following way
  node.subscribe("/robot/joint_states",100,printJointStates);. It works perfectly. Now, I wanted to move the joints. So I tried to publish the data into
  /robot/limb/right/joint_command topic. Below is the complete code-
  #include <ros/ros.h> #include <sensor_msgs/JointState.h> int main(int argc, char **argv) { //Initializen the ros ros::init(argc, argv, "move_joints"); //Declare the node handle ros::NodeHandle node; //Decleare a joint state publisher ros::Publisher joint_pub = node.advertise<sensor_msgs::JointState>("/robot/limb/right/joint_command",10); //Define the joint state sensor_msgs::JointState joint_state; joint_state.name[0] = "right_e0"; joint_state.name[1] = "right_e1"; joint_state.name[2] = "right_s0"; joint_state.name[3] = "right_s1"; joint_state.name[4] = "right_w0"; joint_state.name[5] = "right_w1"; joint_state.name[6] = "right_w2"; joint_state.position[0] = 0.0; joint_state.position[1] = 0.0; joint_state.position[2] = 0.0; joint_state.position[3] = 0.0; joint_state.position[4] = 0.0; joint_state.position[5] = 0.0; joint_state.position[6] = 0.0; //command the robot to move joint_pub.publish(joint_state); ros::spinOnce(); return 0; }
  The code compiles without any error but shows following error in the run time- segmentation fault (core dumped)
  I suspect that the
  JointState is not properly defined.
  Please note that I am using ROS Indigo in Ubuntu 14.04 LTS 64 Bit OS. I am using Gazebo simulator to test this code.
  I am unable to proceed further. Please provide your suggestions.
  Hi, I am wondering if you could send me your code for the subscriber. I am also a beginner and trying to get a subscriber and publisher thing going as well.
  Thanks.