Gazebo | Ignition | Community
Ask Your Question

GAugusto's profile - activity

2019-06-25 13:33:07 -0600 received badge  Nice Answer (source)
2013-09-26 09:00:48 -0600 commented answer How to control a Robot?

you can also try using http://wiki.ros.org/teleoptwistkeyboard , change the cmgvel to gazebo/cmdvel and see what topics you get

2013-09-26 08:57:54 -0600 commented answer How to control a Robot?

or just rosrun the turtlebot_key.cpp manualy and see what topics u get.

2013-09-26 08:54:48 -0600 commented answer How to control a Robot?

btw something i remembered, i think you can change the name of topics with launch files, could be good to give it a look just to be safe. or just rosrun the turtlebot_key.cpp manualy and see what topics u get.

2013-09-26 08:52:33 -0600 commented answer How to control a Robot?

i dont really see what to do, the objective should be to match the topics names. i suspect that somewhere both gazebo and turtlebot are adding prefixs by default, and thats where it needs changing :/ sorry i cant be of much more help.

2013-09-25 11:27:43 -0600 commented answer How to control a Robot?

ok, then try looking abit into the turtle bot controller for "turtlebottelopkeyboard/cmdvel" and change it to "gazebo/cmdvel". then try again.

2013-09-25 11:01:19 -0600 commented answer How to control a Robot?

those seam to be gazebo topics, did you use the "rostopic list" command or "gztopic list"?

2013-09-25 10:54:36 -0600 commented answer How to control a Robot?

change the "gz" to "turtlebottelopkeyboard" this is needed. to create the correct cmd vel topic.

i was using verison 1.5 and ROS fuerte, maybe on new versions the prefix "gazebo is always added. try also to change the published topic on the teleop controller by adding "gazebo" before "turtlebottelopkeyboard/cmdvel" to get "gazebo/turtlebottelopkeyboard/cmdvel" from the controller.

2013-09-25 10:37:26 -0600 commented answer How to control a Robot?

hmm, launch only the turtle bot controller, then type rostopic list and put here the topics it creates pls

2013-09-24 21:40:26 -0600 commented answer How to control a Robot?

for example, if you have a controller publishing twist messages to "robot2/cmdvel" topic then you can change the plugin from "gz/cmdvel" to the same topic by changing the string name1 of the plugin from "gz" to "robot2". in case of a single robot it usualy does not have prefix so if you change the string name1 to "" (empty string) you will get the topic "/cmdvel". hope i was clear enough :S

2013-09-24 21:40:16 -0600 commented answer How to control a Robot?

for example, if you have a controller publishing twist messages to "robot2/cmdvel" topic then you can change the plugin from "gz/cmdvel" to the same topic by changing the string name1 of the plugin from "gz" to "robot2". in case of a single robot it usualy does not have prefix so if you change the string name1 to "" (empty string) you will get the topic "/cmdvel". hope i was clear enough :S

2013-09-24 21:35:12 -0600 received badge  Commentator
2013-09-24 21:35:12 -0600 commented answer How to control a Robot?

the idea should be the same, the robot should have the topics for the vel comands, you just need to edit whatever controller (or the plugin) your using to publish the velocity commands to those topics. you can also change the plugin to match the controllers topics, whatever u see fit, they just need to match. in the same link at the end i sugest the use of one keyboard controller and to edit the controller to publish to the respective topics.

2013-09-24 09:38:54 -0600 answered a question How to control a Robot?

you have a few tutorials on older versions. the underscores used to set text to italic are making a few typos, make sure to notice them

1-this tutorial shows how to set the model velocities. http://gazebosim.org/wiki/Tutorials/1.3/intermediate/control_model for the above tutorial you might also find this usefull.

// *** QUATERNION / POSE DATA ******

  static double qw,qx,qy,qz, Rrad, Prad, Yrad;
  math::Vector3 p = model->GetWorldPose().pos;
  math::Quaternion r = model->GetWorldPose().rot;
  //from quaternion to Roll Pitch Yaw, in radians
  qw=r.w;   qx=r.x;     qy=r.y;     qz=r.z;
  Rrad=atan2(  2*(qw*qx+qy*qz),  1-2*(qx*qx+qy*qy)  );  //Roll
  Prad=asin(2*(qw*qy-qz*qx));                           //Pitch
  Yrad=atan2(  2*(qw*qz+qx*qy),  1-2*(qy*qy+qz*qz)  );  //Yaw

// ***************

        //set velocities

        float velx,vely;
        velx=Vlin*cos(Yrad);
        vely=Vlin*sin(Yrad);    
        this->model->SetLinearVel(math::Vector3(velx, vely, 0));
        this->model->SetAngularVel(math::Vector3(0, 0, Vang));

// ***************

2- or you can control the model using aplying joint forces, but this needs a robot with joints as wheels http://gazebosim.org/wiki/Tutorials/1.3/controlrobot/mobilebase

hope this helps.

2013-07-23 05:56:38 -0600 received badge  Guru (source)
2013-07-23 05:56:38 -0600 received badge  Great Answer (source)
2013-04-03 23:24:43 -0600 received badge  Enlightened (source)
2013-04-03 23:24:43 -0600 received badge  Good Answer (source)
2013-04-03 11:45:33 -0600 commented answer Is there simulation oriented tutorials?

@amit, added a plugin on another answer (linked in this). still havent used the navigation stack tho. advise you again to give it a look (http://www.ros.org/wiki/navigation) for what you asked here.

2013-04-03 11:36:19 -0600 commented answer What Is The Best Way to0 Learn GAZEBO in ROS For Beginners?

@amit hi, i edited my answer, hope that helps. also some parts where the text is italic are missing "_" underscores and that might give the typos. saddly can't find a way around it.

2013-04-03 11:33:15 -0600 edited answer What Is The Best Way to0 Learn GAZEBO in ROS For Beginners?

hello. ROS simulator gazebo is outdated, use the gazebosim here wich is the one being updated and developed.

You can follow the tutorials here to learn how to use sensor data and move models and then use a plugin to send data to ROS. You will need some knowledge of ROS publishing/subscribe to topics and types of messages, but once this "bridge" is set up you can use ROS to send vel commands to your gazebo robot.

At the moment i have a robot in gazebo that sends laser scans and Pose to ROS and receives geometry_msgs/Twist (linear and angular vel) to move him around. With this i'm able to use ROS gmapping and rviz to create the maps just like in any other ROS simulation.

EDIT/UPDATE: @amit, and everyone who might find this usefull to use Gazebosim and ROS, this assumes you have done the tutorials, specialy Control model and ROS-enabled plugin. Also i'm using gazebo-1.4 and ROS fuerte.

WARNING: this is what i did, i'm not using join commands (and don't intend to for now), only set the velocity of the model, using a robot model without friction and the hokuyo model for laser, already in the gazebo models library (gazebosim.org/models). I'm almost sure that you can use the tutorial "box" (not tried it myself tho).

->If there are better ways of doing it please feel free to comment.

TYPOS: the forum feature that uses underscores "_" to set italic text is setting some parts of my answer to italic without me wanting to and removing underscores where it should not.

Be sure to get familiar with ROS messages, in this case geometrymsgs/Twist , geometrymsgs/PoseStamped (http://www.ros.org/wiki/geometrymsgs) and sensormsgs/LaserScan (http://ros.org/wiki/sensor_msgs) and have some understanding of publishing/subscribing topics in ROS. I tried to clean, comment and remove unecessary code the best i could. Hope you get the basic ideas of how things work and then experiment on your own.

#include <boost/bind.hpp>
#include <gazebo.hh>
#include <physics/physics.hh>
#include <common/common.hh>
#include <stdio.h>

#include "ros/ros.h"
#include "geometry_msgs/Twist.h"
#include "geometry_msgs/PoseStamped.h"
#include "sensor_msgs/LaserScan.h"

#include "gazebo/gazebo.hh"
#include "gazebo/physics/physics.hh"
#include "gazebo/common/common.hh"
#include "gazebo/sensors/RaySensor.hh"
#include "gazebo/sensors/SensorManager.hh"
#include "math/Vector3.hh"
#include <math/gzmath.hh>

static float Vlin=0.0, Vang=0.0; // set as global 

namespace gazebo
{   
  class ROSModelPlugin : public ModelPlugin
  {   
    public: ROSModelPlugin()
    {
      // Start up ROS
      std::string name1 = "gz"; // this is what appears in the rostopics
      int argc = 0;
      ros::init(argc, NULL, name1);      
    }
    public: ~ROSModelPlugin()
    {
      delete this->nh;
    }

    public: void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
    {
      // Store the pointer to the model
      this->model = _parent;

      // ROS Nodehandle
      this->nh = new ros::NodeHandle("~");
      // ROS Subscriber
      this->subvel = this->nh->subscribe<geometry_msgs::Twist>("cmd_vel", 1000, &ROSModelPlugin::ROSCallback_Vel, this );

      this->nh = new ...
(more)
2013-04-02 15:00:44 -0600 received badge  Nice Answer (source)
2013-04-01 03:53:56 -0600 received badge  Nice Answer (source)
2013-03-28 11:18:33 -0600 commented answer Multilple plugin loading

hello. was facing the same problem today. is there an estimated time for the bug to be fixed?

2013-03-27 20:13:33 -0600 commented answer Control Model Tutorial: Sensor isn't attached

then probably there was a bug/accident during the installation. unfortunately i cant help you more. :( last resource scenario reinstall gazebo, BUT make a backup of your .bashrc file (gedit ~/.bashrc) just to be safe before you reinstall.

2013-03-27 19:53:32 -0600 commented answer Control Model Tutorial: Sensor isn't attached

that is very strange,the sensor is really unattached from the model. i just finished redoing the tutorial and it worked, tho im using gazebo1.4 the sdf is still 1.3 :/ can you see the rays (blue field) moving with the box?

2013-03-27 19:04:18 -0600 commented answer Control Model Tutorial: Sensor isn't attached

yes, indeed it should be 179 (i used to use 181samples). well the ranges seam correct. did moving the box manualy changed the range values? if not then the sensor is not moving with the model, wich is wierd because the model description seams correct.

2013-03-27 15:00:46 -0600 answered a question Control Model Tutorial: Sensor isn't attached

hi. try to check if each ray is measuring correctly.

edit the plugin to:

      this->model->SetLinearVel(math::Vector3(0, 0, 0)); //so it does not move

and add this below it

      // console output
      static int rgcount =0;
      rgcount ++;
      if(rgcount>=2000)
      { 
         rgcount = 0; 
         float r0 = this->raysensor->GetRange(0); //index 0
         float r90 = this->raysensor->GetRange(90); //index 90
         float r180 = this->raysensor->GetRange(179); //index 179
         printf("0deg:   %3.3f \n90deg:  %3.3f \n180deg: %3.3f \n\n", r0, r90, r180);

      }

then manualy put/move cubes at these angles changing distances, see if the values match or if they give the same number as before. also move the box with the sensor manualy around to see if the sensor moves with the box.

edit: index 180 -> 179

2013-03-27 12:39:21 -0600 received badge  Supporter (source)
2013-03-27 11:12:09 -0600 commented answer Is there simulation oriented tutorials?

if you are short in time i might not be the best person to help you as i would advise you to use a ROS-plugin controling a robot with vel comands sent by ros. then "remap" the topic where the navigation stack publish vel comands to the topic of your plugin. but this will take some time to set up unfortunatly. sorry i can't be of more help :(

2013-03-27 11:06:07 -0600 commented answer Is there simulation oriented tutorials?

hi. from what i understood you want to give a final destination point and send the robot there while mapping/avoiding obstacles, right? ros have a navigation stack that does path planing (avoid obstacles) by giving the destination point (http://www.ros.org/wiki/navigation), i havent explored this stack yet so i cant say for sure how it works (in code) but for example you can use rviz to manualy set the end point and the nav stack gives the vel commands for it to reach the destination.

2013-03-22 22:24:09 -0600 answered a question Is there simulation oriented tutorials?

hello.

There is a section in the tutorial version 1.3, that is not on 1.4 and 1.5, "Controling a robot". specialy (http://gazebosim.org/wiki/Tutorials/1.3/intermediate/controlmodel) and (http://gazebosim.org/wiki/Tutorials/1.3/controlrobot/mobile_base) , this should get you a good idea how to move robots with the model velocity or with joint commands.

i advise you to first get a simple plugin controlling the robot movement avoiding obstacles and then, if you want to control it with ROS, make a ROS-enabled plugin like the one in the tutorials and edit it to subscribe linear and angular velocity from a ROStopic with geometrymsgs/Twist (http://ros.org/doc/api/geometrymsgs/html/msg/Twist.html).

You should research about message types for rostopics, publishing and subscribing to ROStopics with diferent message types before trying to create your own plugin to talk with ROS

SIDE NOTE: once you have some insight of the tutorials this might be usefull to save you sometime later on if you are not familiar with quaternions (i wasn't), so remember this when you try to get a robot Roll Pitch Yaw angles:

math::Quaternion r = model->GetWorldPose().rot;
//from quaternion to roll pitch yaw, in radians
qw=r.w;     qx=r.x;     qy=r.y;     qz=r.z;
Rrad=atan2(  2*(qw*qx+qy*qz),  1-2*(qx*qx+qy*qy)  ); //roll
Prad=asin(2*(qw*qy-qz*qx));                          //pitch
Yrad=atan2(  2*(qw*qz+qx*qy),  1-2*(qy*qy+qz*qz)  ); //yaw

this might also be usefull in the model plugin (not joint velocity commands tho):

//set velocities
float Vlin=0.5; //Linear velocity wanted
float Vang=1.0; //Angular velocity wanted
float velx=Vlin*cos(Yrad);
float vely=Vlin*sin(Yrad);  
this->model->SetLinearVel(math::Vector3(velx, vely, 0));
this->model->SetAngularVel(math::Vector3(0, 0, Vang));

the above code will make the robot move in a circle. you can then, with laser data for example, change Vlin and Vang to your will.

i hope the above code examples will save you time instead of spending to much time trying to learn everything by yourself like i did.

EDIT added a somewhat simple/basic plugin i'm using to publish to rostopics, might be usefull http://answers.gazebosim.org/question/1991/what-is-the-best-way-to0-learn-gazebo-in-ros-for/