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

I've also been looking for something similar, have not been able to find any clear examples on how to achieve this.

I've also been looking for something similar, have not been able to find any clear examples on how to achieve this.

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 :

  1. Follow the ROS instruction guidelines for Hydro [follow ros.org]
  2. Setup your catkin workspace (again instructions in ROS wiki)
  3. Download and install standalone gazebo. Instructions here for the ROS compatible version 1.9 http://gazebosim.org/wiki/1.9/install
  4. Start here for tutorials on working with ROS and Gazebo. Complete all the tutorials http://gazebosim.org/wiki/Tutorials/1.9/Overview_of_new_ROS_integration
  5. Download the IRobot Create SDF from the online repo. It is possible to download the entire library of models from https://bitbucket.org/osrf/gazebo_models
  6. Put the "create" folder from the downloaded models into your ~/catkin_ws/src/ directory

Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:

  1. From the terminal launch roscore. $roscore
  2. Launch gazebo with an empty world. $roslaunch gazebo_ros empty_world.launch
  3. In another terminal, spawn the create into the gazebo instance. Change directory to your create model. Then: $rosrun gazebo_ros spawn_model -file ~/catkin_ws/src/create/model-1_4.sdf -sdf -model create
  4. Then send commands to make the robot move. $rostopic pub /cmd_vel geometry_msgs/Twist -- '[1.0, 0.0, 0.0]' '[0.0, 0.0, 1]'

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 :

  1. Follow the ROS instruction guidelines for Hydro [follow ros.org]
  2. Setup your catkin workspace (again instructions in ROS wiki)
  3. Download and install standalone gazebo. Instructions here for the ROS compatible version 1.9 http://gazebosim.org/wiki/1.9/install
  4. Start here for tutorials on working with ROS and Gazebo. Complete all the tutorials http://gazebosim.org/wiki/Tutorials/1.9/Overview_of_new_ROS_integration
  5. Download the IRobot Create SDF from the online repo. It is possible to download the entire library of models from https://bitbucket.org/osrf/gazebo_models
  6. Put the "create" folder from the downloaded models into your ~/catkin_ws/src/ directory
  7. Insert the differential drive plugin into the model-1_4.sdf file. Some changes had to be made to suit the create sdf. The plugin info can be found in the gazeo ros integration tutorials at http://gazebosim.org/wiki/Tutorials/1.9/ROS_Motor_and_Sensor_Plugins. I am unable to paste the modified xml markup or attach it. So email me at sauravag@tamu.edu for the file.

Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:

  1. From the terminal launch roscore. $roscore
  2. Launch gazebo with an empty world. $roslaunch gazebo_ros empty_world.launch
  3. In another terminal, spawn the create into the gazebo instance. Change directory to your create model. Then: $rosrun gazebo_ros spawn_model -file ~/catkin_ws/src/create/model-1_4.sdf -sdf -model create
  4. Then send commands to make the robot move. $rostopic pub /cmd_vel geometry_msgs/Twist -- '[1.0, 0.0, 0.0]' '[0.0, 0.0, 1]'

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 :

  1. Follow the ROS instruction guidelines for Hydro [follow ros.org]
  2. Setup your catkin workspace (again instructions in ROS wiki)
  3. Download and install standalone gazebo. Instructions here for the ROS compatible version 1.9 http://gazebosim.org/wiki/1.9/install
  4. Start here for tutorials on working with ROS and Gazebo. Complete all the tutorials http://gazebosim.org/wiki/Tutorials/1.9/Overview_of_new_ROS_integration
  5. Download the IRobot Create SDF from the online repo. It is possible to download the entire library of models from https://bitbucket.org/osrf/gazebo_models
  6. Put the "create" folder from the downloaded models into your ~/catkin_ws/src/ directory
  7. Insert the differential drive plugin into the model-1_4.sdf file. Some changes had to be made to suit the create sdf. The plugin info can be found in the gazeo ros integration tutorials at http://gazebosim.org/wiki/Tutorials/1.9/ROS_Motor_and_Sensor_Plugins. I am unable to paste the modified xml markup or attach it. So email me at sauravag@tamu.edu for the file.

Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:

  1. From the terminal launch roscore. $roscore
  2. Launch gazebo with an empty world. $roslaunch gazebo_ros empty_world.launch
  3. In another terminal, spawn the create into the gazebo instance. Change directory to your create model. Then: $rosrun gazebo_ros spawn_model -file ~/catkin_ws/src/create/model-1_4.sdf -sdf -model create
  4. Then send commands to make the robot move. $rostopic pub /cmd_vel geometry_msgs/Twist -- '[1.0, 0.0, 0.0]' '[0.0, 0.0, 1]'

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;
}

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 :

  1. Follow the ROS instruction guidelines for Hydro [follow ros.org]
  2. Setup your catkin workspace (again instructions in ROS wiki)
  3. Download and install standalone gazebo. Instructions here for the ROS compatible version 1.9 http://gazebosim.org/wiki/1.9/install
  4. Start here for tutorials on working with ROS and Gazebo. Complete all the tutorials http://gazebosim.org/wiki/Tutorials/1.9/Overview_of_new_ROS_integration
  5. Download the IRobot Create SDF from the online repo. It is possible to download the entire library of models from https://bitbucket.org/osrf/gazebo_models
  6. Put the "create" folder from the downloaded models into your ~/catkin_ws/src/ directory
  7. Insert the differential drive plugin into the model-1_4.sdf file. Some changes had to be made to suit the create sdf. The plugin info can be found in the gazeo ros integration tutorials at http://gazebosim.org/wiki/Tutorials/1.9/ROS_Motor_and_Sensor_Plugins. I am unable to paste the modified xml markup or attach it. So email me at sauravag@tamu.edu for the file.

Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:

  1. From the terminal launch roscore. $roscore
  2. Launch gazebo with an empty world. $roslaunch gazebo_ros empty_world.launch
  3. In another terminal, spawn the create into the gazebo instance. Change directory to your create model. Then: $rosrun gazebo_ros spawn_model -file ~/catkin_ws/src/create/model-1_4.sdf -sdf -model create
  4. Then send commands to make the robot move. $rostopic pub /cmd_vel geometry_msgs/Twist -- '[1.0, 0.0, 0.0]' '[0.0, 0.0, 1]'

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;
}

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 :

  1. Follow the ROS instruction guidelines for Hydro [follow ros.org]
  2. Setup your catkin workspace (again instructions in ROS wiki)
  3. Download and install standalone gazebo. Instructions here for the ROS compatible version 1.9 http://gazebosim.org/wiki/1.9/install
  4. Start here for tutorials on working with ROS and Gazebo. Complete all the tutorials http://gazebosim.org/wiki/Tutorials/1.9/Overview_of_new_ROS_integration
  5. Download the IRobot Create SDF from the online repo. It is possible to download the entire library of models from https://bitbucket.org/osrf/gazebo_models
  6. Put the "create" folder from the downloaded models into your ~/catkin_ws/src/ directory
  7. Insert the differential drive plugin into the model-1_4.sdf file. Some changes had to be made to suit the create sdf. The plugin info can be found in the gazeo ros integration tutorials at http://gazebosim.org/wiki/Tutorials/1.9/ROS_Motor_and_Sensor_Plugins. I am unable to paste the modified xml markup or attach it. So email me at sauravag@tamu.edu for the file.

Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:

  1. From the terminal launch roscore. $roscore
  2. Launch gazebo with an empty world. $roslaunch gazebo_ros empty_world.launch
  3. In another terminal, spawn the create into the gazebo instance. Change directory to your create model. Then: $rosrun gazebo_ros spawn_model -file ~/catkin_ws/src/create/model-1_4.sdf -sdf -model create
  4. Then send commands to make the robot move. $rostopic pub /cmd_vel geometry_msgs/Twist -- '[1.0, 0.0, 0.0]' '[0.0, 0.0, 1]'

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;
}

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 :

  1. Follow the ROS instruction guidelines for Hydro [follow ros.org]
  2. Setup your catkin workspace (again instructions in ROS wiki)
  3. Download and install standalone gazebo. Instructions here for the ROS compatible version 1.9 http://gazebosim.org/wiki/1.9/install
  4. Start here for tutorials on working with ROS and Gazebo. Complete all the tutorials http://gazebosim.org/wiki/Tutorials/1.9/Overview_of_new_ROS_integration
  5. Download the IRobot Create SDF from the online repo. It is possible to download the entire library of models from https://bitbucket.org/osrf/gazebo_models
  6. Put the "create" folder from the downloaded models into your ~/catkin_ws/src/ directory
  7. Insert the differential drive plugin into the model-1_4.sdf file. Some changes had to be made to suit the create sdf. The plugin info can be found in the gazeo ros integration tutorials at http://gazebosim.org/wiki/Tutorials/1.9/ROS_Motor_and_Sensor_Plugins. I am unable to paste the modified xml markup or attach it. So email me at sauravag@tamu.edu for the file.

Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:

  1. From the terminal launch roscore. $roscore
  2. Launch gazebo with an empty world. $roslaunch gazebo_ros empty_world.launch
  3. In another terminal, spawn the create into the gazebo instance. Change directory to your create model. Then: $rosrun gazebo_ros spawn_model -file ~/catkin_ws/src/create/model-1_4.sdf -sdf -model create
  4. Then send commands to make the robot move. $rostopic pub /cmd_vel geometry_msgs/Twist -- '[1.0, 0.0, 0.0]' '[0.0, 0.0, 1]'

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;
}

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 :

  1. Follow the ROS instruction guidelines for Hydro [follow ros.org]
  2. Setup your catkin workspace (again instructions in ROS wiki)
  3. Download and install standalone gazebo. Instructions here for the ROS compatible version 1.9 http://gazebosim.org/wiki/1.9/install
  4. Start here for tutorials on working with ROS and Gazebo. Complete all the tutorials http://gazebosim.org/wiki/Tutorials/1.9/Overview_of_new_ROS_integration
  5. Download the IRobot Create SDF from the online repo. It is possible to download the entire library of models from https://bitbucket.org/osrf/gazebo_models
  6. Put the "create" folder from the downloaded models into your ~/catkin_ws/src/ directory
  7. Insert the differential drive plugin into the model-1_4.sdf file. Some changes had to be made to suit the create sdf. The plugin info can be found in the gazeo ros integration tutorials at http://gazebosim.org/wiki/Tutorials/1.9/ROS_Motor_and_Sensor_Plugins. I am unable to paste the modified xml markup or attach it. So email me at sauravag@tamu.edu for the file.

Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:

  1. From the terminal launch roscore. $roscore
  2. Launch gazebo with an empty world. $roslaunch gazebo_ros empty_world.launch
  3. In another terminal, spawn the create into the gazebo instance. Change directory to your create model. Then: $rosrun gazebo_ros spawn_model -file ~/catkin_ws/src/create/model-1_4.sdf -sdf -model create
  4. Then send commands to make the robot move. $rostopic pub /cmd_vel geometry_msgs/Twist -- '[1.0, 0.0, 0.0]' '[0.0, 0.0, 1]'

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;
}

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 :

  1. Follow the ROS instruction guidelines for Hydro [follow ros.org]
  2. Setup your catkin workspace (again instructions in ROS wiki)
  3. Download and install standalone gazebo. Instructions here for the ROS compatible version 1.9 http://gazebosim.org/wiki/1.9/install
  4. Start here for tutorials on working with ROS and Gazebo. Complete all the tutorials http://gazebosim.org/wiki/Tutorials/1.9/Overview_of_new_ROS_integration
  5. Download the IRobot Create SDF from the online repo. It is possible to download the entire library of models from https://bitbucket.org/osrf/gazebo_models
  6. Put the "create" folder from the downloaded models into your ~/catkin_ws/src/ directory
  7. Insert the differential drive plugin into the model-1_4.sdf file. Some changes had to be made to suit the create sdf. The plugin info can be found in the gazeo ros integration tutorials at http://gazebosim.org/wiki/Tutorials/1.9/ROS_Motor_and_Sensor_Plugins. http://gazebosim.org/tutorials?tut=ros_gzplugins. I am unable to paste the modified xml markup or attach it. So email me at sauravag@tamu.edu for the file.

Assuming you completed all the steps above, here are the instructions to control the icreate with velocity commands from terminal:

  1. From the terminal launch roscore. $roscore
  2. Launch gazebo with an empty world. $roslaunch gazebo_ros empty_world.launch
  3. In another terminal, spawn the create into the gazebo instance. Change directory to your create model. Then: $rosrun gazebo_ros spawn_model -file ~/catkin_ws/src/create/model-1_4.sdf -sdf -model create
  4. Then send commands to make the robot move. $rostopic pub /cmd_vel geometry_msgs/Twist -- '[1.0, 0.0, 0.0]' '[0.0, 0.0, 1]'

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;
}