Gazebo | Ignition | Community
Ask Your Question

camilla's profile - activity

2019-09-10 14:33:15 -0600 received badge  Famous Question (source)
2015-06-23 23:52:59 -0600 received badge  Taxonomist
2013-09-19 18:56:29 -0600 received badge  Famous Question (source)
2013-06-12 11:43:52 -0600 received badge  Student (source)
2013-05-22 07:01:45 -0600 received badge  Notable Question (source)
2013-05-18 02:18:49 -0600 received badge  Popular Question (source)
2013-05-15 04:26:26 -0600 asked a question Automatic creation of Gazebo world

Hi,

Is there the possibility of create a Gazebo world from a map created with gmapping(.pgm image) automatically?

2013-04-19 13:35:50 -0600 received badge  Famous Question (source)
2013-03-13 04:29:23 -0600 received badge  Notable Question (source)
2013-03-11 07:33:21 -0600 received badge  Popular Question (source)
2013-02-27 08:31:13 -0600 asked a question How to implement a IRsensor plugin gazebo ros

Hi
I'm using ROS electric and I want to simulate an IRSensor in Gazebo. I've found a tutorial about creating new plugins but it works only for Fuerte. Anyone can help me to understand how to create a new controller gazebo_ros_IR similar to gazebo_ros_laser.

EDIT: I looked at gazebo plugins and on the base of gazebo_ros laser I created a new package with two files:
ir_controller_file.h,

#ifndef GAZEBO_ROS_IR_HH
#define GAZEBO_ROS_IR_HH

#define USE_CBQ
#ifdef USE_CBQ
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
#endif

#include <gazebo/Controller.hh>
#include <gazebo/Param.hh>

#include <ros/ros.h>
#include <boost/thread/mutex.hpp>
#include <sensor_msgs/Range.h>

namespace gazebo
{
  class IRSensor;

class GazeboRosIr : public Controller
{
  /// \brief Constructor
  /// \param parent The parent entity, must be a Model or a Sensor
  public: GazeboRosIr(Entity *parent);

  /// \brief Destructor
  public: virtual ~GazeboRosIr();

  /// \brief Load the controller
  /// \param node XML config node
  protected: virtual void LoadChild(XMLConfigNode *node);

  /// \brief Init the controller
  protected: virtual void InitChild();

  /// \brief Update the controller
  protected: virtual void UpdateChild();

  /// \brief Finalize the controller
  protected: virtual void FiniChild();

  /// \brief Put laser data to the ROS topic
  private: void PutIrData();

  /// \brief Keep track of number of connctions
  private: int IrConnectCount;
  private: void IrConnect();
  private: void IrDisconnect();
  private: int deprecatedIrConnectCount;
  private: void DeprecatedIrConnect();
  private: void DeprecatedIrDisconnect();

  /// \brief The parent sensor
  private: IRSensor *myParent;

  /// \brief pointer to ros node
  private: ros::NodeHandle* rosnode_;
  private: ros::Publisher pub_;
  private: ros::Publisher deprecated_pub_;

  /// \brief ros message
  private: sensor_msgs::Range irMsg;

  /// \brief topic name
  private: ParamT<std::string> *topicNameP;
  private: std::string topicName;
  private: ParamT<std::string> *deprecatedTopicNameP;
  private: std::string deprecatedTopicName;

  /// \brief frame transform name, should match link name
  private: ParamT<std::string> *frameNameP;
  private: std::string frameName;

  /// \brief Gaussian noise
  private: ParamT<double> *gaussianNoiseP;
  private: double gaussianNoise;

  /// \brief Gaussian noise generator
  private: double GaussianKernel(double mu,double sigma);

  /// \brief A mutex to lock access to fields that are used in message callbacks
  private: boost::mutex lock;

  /// \brief hack to mimic hokuyo intensity cutoff of 100
  private: ParamT<double> *hokuyoMinIntensityP;
  private: double hokuyoMinIntensity;

  /// \brief for setting ROS name space
  private: ParamT<std::string> *robotNamespaceP;
  private: std::string robotNamespace;

#ifdef USE_CBQ
  private: ros::CallbackQueue ir_queue_;
  private: void IrQueueThread();
  private: boost::thread callback_queue_thread_;
#endif

};

/** \} */
/// @}

}

#endif

and ircontrollerfile.cpp

#include <algorithm>
#include <assert.h>


#include <ir_controller_package/ir_controller_file.h>

#include <gazebo/Sensor.hh>
#include <gazebo/Global.hh>
#include <gazebo/XMLConfig.hh>
#include <gazebo/HingeJoint.hh>
#include <gazebo/World.hh>
#include <gazebo/Simulator.hh>
#include <gazebo/gazebo.h>
#include <gazebo/GazeboError.hh>
#include <gazebo/ControllerFactory.hh>
#include <gazebo/IRSensor.hh>
#include <pluginlib/class_list_macros.h>

namespace gazebo
{

GZ_REGISTER_DYNAMIC_CONTROLLER("ir_controller_package", GazeboRosIr);

////////////////////////////////////////////////////////////////////////////////
// Constructor
GazeboRosIr::GazeboRosIr(Entity *parent)
    : Controller(parent)
{
  this->myParent = dynamic_cast<IRSensor*>(this->parent);

  if (!this->myParent)
    gzthrow("GazeboRosIr controller requires a IR Sensor as its parent");

  Param::Begin(&this->parameters);
  this->robotNamespaceP = new ParamT<std::string>("robotNamespace", "/", 0);
  //this->hokuyoMinIntensityP = new ParamT<double>("hokuyoMinIntensity", 101.0, 0);
  this->gaussianNoiseP = new ParamT<double>("gaussianNoise", 0.0, 0);
  this->topicNameP = new ParamT<std::string>("topicName", "", 1);
  this->deprecatedTopicNameP = new ParamT<std::string ...
(more)
2013-02-18 02:46:34 -0600 received badge  Famous Question (source)
2013-02-18 02:46:34 -0600 received badge  Popular Question (source)
2013-02-18 02:46:34 -0600 received badge  Notable Question (source)
2013-02-18 01:18:34 -0600 received badge  Famous Question (source)
2013-02-07 01:07:53 -0600 received badge  Popular Question (source)
2013-02-07 01:07:53 -0600 received badge  Notable Question (source)
2013-02-05 11:53:19 -0600 received badge  Popular Question (source)
2013-02-05 11:53:19 -0600 received badge  Notable Question (source)
2013-02-01 04:45:53 -0600 commented answer corobot urdf

I have seen that there is a model in MRDS but i don't now where to find it

2013-01-31 05:44:03 -0600 asked a question corobot urdf

Is there the possibility to simulate the corobot in gazebo? Where can I find the corresponding urdf file?

2013-01-22 05:03:24 -0600 received badge  Editor (source)
2013-01-22 05:02:55 -0600 commented answer how to see the robot path

Thx, but I'm yet able to do it in rviz, i have the problem that what the robot does in rviz is different from what it does in gazebo so I want to do it in gazebo too for debbuging purposes.

2013-01-18 07:34:55 -0600 asked a question how to see the robot path

What should I do to see the path done by the robot during the simulation in gazebo non in rviz?

2013-01-17 01:38:26 -0600 commented answer Problem using Gazebo with ROS

Yes I know, but I can see the robot moving also in rviz and what I see there is different from what I see in gazebo, further more if I look at the values published on the /odom topic they're coherent with the position of the robot in rviz but not with the one that the robot has in Gazebo.

2013-01-16 04:05:31 -0600 asked a question Problem using Gazebo with ROS

I'm developing a node which controls the navigation of a p3dx equipped with a laser rangefinder.
I'm simulating the navigation in Gazebo and also in rviz, to see the ranges detected by the laser.
But what the p3dx does in gazebo is different from what it does in rviz. The navigation displayed in rviz is correct, instead the one in gazebo isn't.
How is it possible?
I'm using pioneer3dx.gazebo.launch:

<launch>

  <include file="$(find gazebo_worlds)/launch/empty_world.launch"/>

  <include file="$(find p2os_urdf_mod)/launch/upload_pioneer3dx.xml"/>

  <!-- push robot_description to factory and spawn robot in gazebo -->
  <node name="spawn_pioneer" pkg="gazebo" type="spawn_model" 
    args="-z 0.051 
          -urdf 
          -param robot_description  
          -model robot_description" 
    respawn="false" output="screen" />

  <!-- Controller Manager -->
  <include file="$(find pr2_controller_manager)/controller_manager.launch" />

  <!-- load controllers -->
  <node name="diffdrive" pkg="gazebo_plugins" type="gazebo_ros_diffdrive" respawn="true" output="screen"/>


</launch>

The node that I developed reads some parameters about the desired trajectory and publishes the correct linear and angular speed on the topic /cmd_vel.
I checked the odometry published by "gazebo_ros_diffdrive" controller on the topic /base_pose_ground_truth and it is coherent with what i see in rviz.
Any suggestion? Is it possible that the reason for this is that in Gazebo are taken into account some effects as friction, or gravity which aren't considered in rviz?