Gazebo | Ignition | Community
Ask Your Question

Robot_sim_person's profile - activity

2017-03-09 09:27:38 -0500 received badge  Famous Question (source)
2017-03-08 12:09:31 -0500 received badge  Popular Question (source)
2017-03-07 11:59:51 -0500 asked a question How do you close gazebo using c++

Hi,

I'm trying to queue several programs in the command window to run gazebo for several hours without me monitoring it. However to do this, I need to close gazebo at some point if a condition is met i.e.:

if ( x == 1 ) { CloseGazebo(); }

I'm happy for it to end the c++ plugin as well. I've found a few online solutions such as:

http://stackoverflow.com/questions/10...

I was just wondering if there was a less forceful command already present in gazebo.

2017-03-07 11:57:27 -0500 received badge  Famous Question (source)
2017-01-18 09:01:45 -0500 received badge  Notable Question (source)
2017-01-18 04:19:19 -0500 commented answer How to properly use get_sensor?

If I try to find the sensor without the world name, i.e: sensorLocation = /*"default::" +*/ this->model->GetName() + "::hokuyo::link::laser"; the get_sensor function will crash. But it will work fine if I either include all the names, or just the sensor name. The whole thing is: sensorLocation = "default::" + this->model->GetName() + "::hokuyo::link::laser"; Just the sensor name is: sensorLocation = "laser";

2017-01-17 12:17:02 -0500 received badge  Popular Question (source)
2017-01-17 08:39:39 -0500 answered a question How to properly use get_sensor?

It turns out you can either use just the sensor_name for the string, or the whole thing. But nothing in between (i.e. "model_name::link_name::sensor_name" is not acceptable.

An easy way to get an example of this is to print GetScopedName() on the terminal ( "model_sensor->GetScopedName()" ) .

2017-01-16 03:38:20 -0500 received badge  Notable Question (source)
2017-01-16 03:37:56 -0500 asked a question How to properly use get_sensor?

Hi,

I have some code which uses get_sensor to get a laser sensor, however when I want to use two of this model, they get muddled up as I can't reference the full model name.

sensors::SensorPtr model_sensor;

model_sensor = sensors::get_sensor("laser"); // this is fine when there's only one laser sensor

I want to get something like:

model_sensor = sensors::get_sensor("my_model::hoyoko::link::laser"); but I'm confident this is wrong as gazebo crashes with this new code.

I have the get_sensor refference : http://osrf-distributions.s3.amazonaw... (Ctrl f "get_sensor" to find the relevant part)

But I don't fully understand what they mean by " This name should be fully scoped. This means _name = world_name::model_name::link_name::sensor_name."

Any help would be much appreciated, thanks!

2017-01-16 03:31:17 -0500 received badge  Notable Question (source)
2017-01-13 16:51:54 -0500 received badge  Popular Question (source)
2017-01-12 03:26:48 -0500 asked a question Using multiple identical models with plugins

Hi,

I've created a basic robot that can avoid walls and generally move around a map. But when I tried to place two of the same model into gazebo, the second model started misbehaving (colliding with walls etc), from what I've found online this is because two programs are trying to use one terminal leading to lots of misinformation.

I was wondering if anyone else has done this and if so how they've done it, from what I can find online (see link below) it's something to do with namespaces. The only problem with the solution below is that I'm trying not to use ROS with this project, and I can't find any information about .launch files on gazebo.

http://robotics.stackexchange.com/que...

TL:DR want to put lots of the same model in gazebo (the model has a plugin) but they stop working properly when I do this.

2016-12-12 17:09:13 -0500 received badge  Popular Question (source)
2016-12-07 04:36:55 -0500 received badge  Supporter (source)
2016-12-07 04:36:41 -0500 commented answer pointing to a ray sensor

This worked perfectly, thanks!

2016-12-07 04:36:30 -0500 received badge  Scholar (source)
2016-12-05 22:44:29 -0500 asked a question pointing to a ray sensor

(New to gazebo)

Hi, I'm trying to access the ray sensor part of the hoyuko sensor in c++:

<sensor name="laser" type="ray">

    <pose>0.01 0 0.0175 0 -0 0</pose>

    <ray>

      <scan>

        <horizontal>

          <samples>640</samples>

          <resolution>1</resolution>

          <min_angle>-2.26889</min_angle>

          <max_angle>2.268899</max_angle>

        </horizontal>

      </scan>

      <range>

        <min>0.08</min>

        <max>10</max>

        <resolution>0.01</resolution>

      </range>

    </ray>

    <plugin name="laser" filename="libRayPlugin.so" />

    <always_on>1</always_on>

    <update_rate>30</update_rate>

    <visualize>true</visualize>

  </sensor>

But I can't find or figure out the code required anywhere. I've looked through the other questions on this site, the tutorials and the API. The main thing I've figured out is that to use the functions in RaySensor you need a reference object. But I don't want to create a new object as it already exists in my model. instead I made a RaySensorPtr but have been unable to point to the RaySensor.

Before showing the code I should note that the Hoyuko model is a sub-model of my model (i.e. this->model does not reference the hoyuko model)

public: void OnUpdate(const common::UpdateInfo & /*_info*/)
{
  // Apply a small linear velocity to the model.
  this->model->SetLinearVel(math::Vector3(.3, 0, 0));

  int sensor_num = this->model->GetSensorCount();

  sensors::SensorPtr model_sensor = sensors::get_sensor("laser"); //points to sensor

  //RayShapePtr MultiRayShape::Ray(const unsigned int 0) const //DOESN'T WORK

  gazebo::sensors::RaySensorPtr model_ray_sensor;

  //double testNum = model_sensor->ray->AngleMax(); DOESN'T WORK

  //double testNum = this->model->sensor->ray->AngleMax(); DOESN'T WORK

  //model_ray_sensor = sensors::RaySensor::GetLaserShape(); DOESN'T WORK

  //physics::MultiRayShapePtr multi_ray_sensor = sensors::RaySensor::GetLaserShape(); DOESN'T WORK

  //model_ray_sensor = sensors::RaySensor::get_sensor("laser"); DOESN'T WORK

  double sensor_update_rate = model_sensor->GetUpdateRate(); //from generic sensor class

  printf("Sensor name: %f \n", sensor_update_rate); //%f NOT %d!!!!
  //printf("Sensor resolution: %f \n", sensor_angle_resolution); //%f NOT %d!!!!
  //printf("Sensors: %u \n", sensorNum);
}

TLDR; I can point to the sensor class and print it's update rate. But I can't figure out how to point to the raysensor class.