ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I've also been looking for something similar, have not been able to find any clear examples on how to achieve this.
2 | No.2 Revision |
I've also been looking for something similar, have not been able to find any clear examples on how to achieve this.
I'm starting with the very basics, so please bear with me.
Steps :
Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:
3 | No.3 Revision |
I've also been looking for something similar, have not been able to find any clear examples on how to achieve this. I'm detailing here as far I got. As I make more progress, I will update my answer and hopefully be helpful to other users.
I'm starting with the very basics, so please bear with me.
Steps :
Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:
4 | No.4 Revision |
I've also been looking for something similar, have not been able to find any clear examples on how to achieve this. I'm detailing here as far I got. As I make more progress, I will update my answer and hopefully be helpful to other users.
I'm starting with the very basics, so please bear with me.
Steps :
Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:
To send motion commands to the Create from code, write a publisher that advertises a geometry_msgs::Twist message with the velocity commands to "/cmd_vel" topic. Instructions on writing a publisher are here: http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29
#include "ros/ros.h"
#include <math.h>
#include "geometry_msgs/Twist.h"
#include "std_msgs/String.h"
// %EndTag(MSG_HEADER)%
//#include <sstream>
/**
* This tutorial demonstrates simple sending of velocity commands to the IRobot Create in Gazebo.
*/
int main(int argc, char **argv)
{
ros::init(argc, argv, "CreateController");
ros::NodeHandle n;
ros::Publisher vel_pub = n.advertise<geometry_msgs::Twist>("/cmd_vel", 1);
ros::Rate loop_rate(5);
int count = 0;
while (ros::ok())
{
geometry_msgs::Twist cmd_vel;
cmd_vel.linear.x = 0.5;
cmd_vel.linear.y = 0;
cmd_vel.linear.z = 0;
cmd_vel.angular.x = 0;
cmd_vel.angular.y = 0;
cmd_vel.angular.z = 0.4*sin(count);
vel_pub.publish(cmd_vel);
ros::spinOnce();
loop_rate.sleep();
++count;
}
return 0;
}
5 | No.5 Revision |
I've also been looking for something similar, have not been able to find any clear examples on how to achieve this. I'm detailing here as far I got. As I make more progress, I will update my answer and hopefully be helpful to other users.
I'm starting with the very basics, so please bear with me.
Steps :
Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:
To send motion commands to the Create from code, write a publisher that advertises a geometry_msgs::Twist message with the velocity commands to "/cmd_vel" topic. Instructions on writing a publisher are here: http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29
#include "ros/ros.h"
#include <math.h>
#include "geometry_msgs/Twist.h"
#include "std_msgs/String.h"
// %EndTag(MSG_HEADER)%
//#include <sstream>
/**
* This tutorial demonstrates simple sending of velocity commands to the IRobot Create in Gazebo.
*/
int main(int argc, char **argv)
{
ros::init(argc, argv, "CreateController");
ros::NodeHandle n;
ros::Publisher vel_pub = n.advertise<geometry_msgs::Twist>("/cmd_vel", 1);
ros::Rate loop_rate(5);
int count = 0;
while (ros::ok())
{
geometry_msgs::Twist cmd_vel;
cmd_vel.linear.x = 0.5;
cmd_vel.linear.y = 0;
cmd_vel.linear.z = 0;
cmd_vel.angular.x = 0;
cmd_vel.angular.y = 0;
cmd_vel.angular.z = 0.4*sin(count);
vel_pub.publish(cmd_vel);
ros::spinOnce();
loop_rate.sleep();
++count;
}
return 0;
}
6 | No.6 Revision |
I've not been able to find any clear examples on how to achieve this. I'm detailing here as far I got. As I make more progress, I will update my answer and hopefully be helpful to other users.
I'm starting with the very basics, so please bear with me.
Steps :
Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:
To send motion commands to the Create from code, write a publisher that advertises a geometry_msgs::Twist message with the velocity commands to "/cmd_vel" topic. Instructions on writing a publisher are here: http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29
#include "ros/ros.h"
#include <math.h>
#include "geometry_msgs/Twist.h"
#include "std_msgs/String.h"
// %EndTag(MSG_HEADER)%
//#include <sstream>
/**
* This tutorial demonstrates simple sending of velocity commands to the IRobot Create in Gazebo.
*/
int main(int argc, char **argv)
{
ros::init(argc, argv, "CreateController");
ros::NodeHandle n;
ros::Publisher vel_pub = n.advertise<geometry_msgs::Twist>("/cmd_vel", 1);
ros::Rate loop_rate(5);
int count = 0;
while (ros::ok())
{
geometry_msgs::Twist cmd_vel;
cmd_vel.linear.x = 0.5;
cmd_vel.linear.y = 0;
cmd_vel.linear.z = 0;
cmd_vel.angular.x = 0;
cmd_vel.angular.y = 0;
cmd_vel.angular.z = 0.4*sin(count);
vel_pub.publish(cmd_vel);
ros::spinOnce();
loop_rate.sleep();
++count;
}
return 0;
}
7 | No.7 Revision |
I've not been able to find any clear examples on how to achieve this. I'm detailing here as far I got. As I make more progress, I will update my answer and hopefully be helpful to other users.
I'm starting with the very basics, so please bear with me.
Steps :
Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:
To send motion commands to the Create from code, write a publisher that advertises a geometry_msgs::Twist message with the velocity commands to "/cmd_vel" topic. Instructions on writing a publisher are here: http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29
#include "ros/ros.h"
#include <math.h>
#include "geometry_msgs/Twist.h"
#include "std_msgs/String.h"
/**
* This tutorial demonstrates simple sending of velocity commands to the IRobot Create in Gazebo.
*/
int main(int argc, char **argv)
{
ros::init(argc, argv, "CreateController");
ros::NodeHandle n;
ros::Publisher vel_pub = n.advertise<geometry_msgs::Twist>("/cmd_vel", 1);
ros::Rate loop_rate(5);
int count = 0;
while (ros::ok())
{
geometry_msgs::Twist cmd_vel;
cmd_vel.linear.x = 0.5;
cmd_vel.linear.y = 0;
cmd_vel.linear.z = 0;
cmd_vel.angular.x = 0;
cmd_vel.angular.y = 0;
cmd_vel.angular.z = 0.4*sin(count);
vel_pub.publish(cmd_vel);
ros::spinOnce();
loop_rate.sleep();
++count;
}
return 0;
}
8 | No.8 Revision |
You can download the modified sdf file for the iRobot create from my website http://sauravag.com/2015/02/how-to-use-irobot-create-with-ros-indigo/
I've not been able to find any clear examples on how to achieve this. I'm detailing here as far I got. As I make more progress, I will update my answer and hopefully be helpful to other users.
I'm starting with the very basics, so please bear with me.
Steps :
Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:
To send motion commands to the Create from code, write a publisher that advertises a geometry_msgs::Twist message with the velocity commands to "/cmd_vel" topic. Instructions on writing a publisher are here: http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29
#include "ros/ros.h"
#include <math.h>
#include "geometry_msgs/Twist.h"
#include "std_msgs/String.h"
/**
* This tutorial demonstrates simple sending of velocity commands to the IRobot Create in Gazebo.
*/
int main(int argc, char **argv)
{
ros::init(argc, argv, "CreateController");
ros::NodeHandle n;
ros::Publisher vel_pub = n.advertise<geometry_msgs::Twist>("/cmd_vel", 1);
ros::Rate loop_rate(5);
int count = 0;
while (ros::ok())
{
geometry_msgs::Twist cmd_vel;
cmd_vel.linear.x = 0.5;
cmd_vel.linear.y = 0;
cmd_vel.linear.z = 0;
cmd_vel.angular.x = 0;
cmd_vel.angular.y = 0;
cmd_vel.angular.z = 0.4*sin(count);
vel_pub.publish(cmd_vel);
ros::spinOnce();
loop_rate.sleep();
++count;
}
return 0;
}
9 | No.9 Revision |
You can download the modified sdf file for the iRobot create from my website http://sauravag.com/2015/02/how-to-use-irobot-create-with-ros-indigo/
I've not been able to find any clear examples on how to achieve this. I'm detailing here as far I got. As I make more progress, I will update my answer and hopefully be helpful to other users.
I'm starting with the very basics, so please bear with me.
Steps :
Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:
To send motion commands to the Create from code, write a publisher that advertises a geometry_msgs::Twist message with the velocity commands to "/cmd_vel" topic. Instructions on writing a publisher are here: http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29
#include "ros/ros.h"
#include <math.h>
#include "geometry_msgs/Twist.h"
#include "std_msgs/String.h"
/**
* This tutorial demonstrates simple sending of velocity commands to the IRobot Create in Gazebo.
*/
int main(int argc, char **argv)
{
ros::init(argc, argv, "CreateController");
ros::NodeHandle n;
ros::Publisher vel_pub = n.advertise<geometry_msgs::Twist>("/cmd_vel", 1);
ros::Rate loop_rate(5);
int count = 0;
while (ros::ok())
{
geometry_msgs::Twist cmd_vel;
cmd_vel.linear.x = 0.5;
cmd_vel.linear.y = 0;
cmd_vel.linear.z = 0;
cmd_vel.angular.x = 0;
cmd_vel.angular.y = 0;
cmd_vel.angular.z = 0.4*sin(count);
vel_pub.publish(cmd_vel);
ros::spinOnce();
loop_rate.sleep();
++count;
}
return 0;
}