Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problem of Baxter Bobot (Joint movement,Position Control)

I am a new beginner of C++ and ROS. I am going to write a program in C++ to control the joints to move continuously in a periodic motion. I have type a program for it, but it seems nothing is running after I run the program. The program skeleton:

include "ros/ros.h"

include "baxter_core_msgs/JointCommand.h"

include <sstream>

include <iostream>

include "math.h"

int main(int argc, char **argv){

ros::init(argc, argv, "joint_position_command");
ros::NodeHandle n;
ros::Publisher jc_pub = n.advertise<baxter_core_msgs::JointCommand>("/robot/limb/right/joint_command", 1);  
ros::Rate loop_rate(10);
baxter_core_msgs::JointCommand jc_msg;
jc_msg.mode = jc_msg.POSITION_MODE;
for(int i=0;i<91;i++){
jc_msg.command.push_back(sin(i));
jc_msg.names.push_back("right_s0");
}
while (ros::ok())
{
    jc_pub.publish(jc_msg);
    ros::spinOnce();
    loop_rate.sleep();
}

return 0; }

Can anyone help me? Or give some suggestion/work flow on how to do a continuous periodic motion on Baxter's arm in C++ language?

Problem of Baxter Bobot (Joint movement,Position Control)

I am a new beginner of C++ and ROS. I am going to write a program in C++ to control the joints to move continuously in a periodic motion. I have type a program for it, but it seems nothing is running after I run the program. The program skeleton:

include "ros/ros.h"

include "baxter_core_msgs/JointCommand.h"

include <sstream>

include <iostream>

include "math.h"

#include "ros/ros.h"
#include "baxter_core_msgs/JointCommand.h"
#include <sstream>
#include <iostream>
#include "math.h"
int main(int argc, char **argv){

**argv){

    ros::init(argc, argv, "joint_position_command");
 ros::NodeHandle n;
 ros::Publisher jc_pub = n.advertise<baxter_core_msgs::JointCommand>("/robot/limb/right/joint_command", 1);  
 ros::Rate loop_rate(10);
 baxter_core_msgs::JointCommand jc_msg;
 jc_msg.mode = jc_msg.POSITION_MODE;
 for(int i=0;i<91;i++){
 jc_msg.command.push_back(sin(i));
 jc_msg.names.push_back("right_s0");
 }
 while (ros::ok())
 {
     jc_pub.publish(jc_msg);
     ros::spinOnce();
     loop_rate.sleep();
    }
  return 0;
}

return 0; }

Can anyone help me? Or give some suggestion/work flow on how to do a continuous periodic motion on Baxter's arm in C++ language?