ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Gazebo or Rviz (or Player/Stage)?

asked 2016-12-07 11:54:03 -0500

FrodeL gravatar image

updated 2016-12-10 15:25:27 -0500

Hi, I'm working on my autonomous RC car, and would like to use ROS to help me visualize and simulate driving the RC car around a track.

The car is Arduino based, and all sensors and calculations are done onboard. YouTube video: Here is the actual environment that my autonomous car drives in.

A friend of mine put together a simple visualization in javascript (see screenshot below) where we can see the car, the red square, drive around the track. The IR sensors it uses are represented as lines going from the car to the walls. This was really nice, and gave a good visualization of when the car decided to turn based on IR sensor inputs.

image description

Now, I'd like to use ROS (and related software) to try and accomplish the same. I've found Gazebo, and have been experimenting briefly with it to create a world and a model, but I'm pretty far away from having a fully functioning simulation.

Then I also came across RViz, which also seems to be able to do something like this. Before I ditch Gazebo I wanted to ask you guys what you would do to accomplish this. Is this a task for Gazebo? Or Rviz? Or something else?

I'll appreciate any feedback you might have.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
2

answered 2016-12-07 14:33:45 -0500

IN GENERAL

Gazebo is more for if you don't have physical hardware. It has a physics engine that allows you to simulate the hardware and an environment.

RVIZ is more for if you do have physical hardware and would like to visualize the data

CAVEATS

Gazebo can be nice even if you have hardware. For instance in a classroom environment with 30 students all trying to use the same robot. Students could use gazebo to simulate and then use the real robot to test, reducing load on the real robot.

RVIZ is useful in both situations, whether the sensor data is real or simulated its nice to be able to visualize it.

edit flag offensive delete link more

Comments

Gazebo is always useful: I would not want to develop for / on any robot without having a simulation around. The fact that I can (almost) effortlessly switch between a real and a simulated version of my robot (without changing application code) is invaluable.

gvdhoorn gravatar image gvdhoorn  ( 2016-12-07 15:16:51 -0500 )edit

In this scenario I do have physical hardware available, BUT would like to use software / simulations to develop the algorithms that the car should use to navigate the track. I imagine the development process will be a lot faster than trying out new firmware in the physical car all the time.

FrodeL gravatar image FrodeL  ( 2016-12-07 15:21:33 -0500 )edit

So I'm imagining mocking up a simulation environment (being Gazebo or Rviz), where I can run some C++ based code (from a ROS node??) which uses virtual IR sensors in the virtual racetrack, and when happy with the result convert that C++ code over to the Arduino on the physical car.

FrodeL gravatar image FrodeL  ( 2016-12-07 15:24:10 -0500 )edit

That sounds like a good plan. Just be warned that there can be issues that arise in the real world that don't in simulation, and vise versa. I have spent many an hour debugging simulation only to realize that it worked when I ran it on the real robot. That happens more for humanoid robots though.

shoemakerlevy9 gravatar image shoemakerlevy9  ( 2016-12-07 15:38:30 -0500 )edit

Will Rviz allow me to make a virtual racetrack with some walls that I can point the virtual IR sensors at? And can Rviz make pretty lines so that I can get a sense of what the IRsensors are seeing?

FrodeL gravatar image FrodeL  ( 2016-12-07 16:01:49 -0500 )edit
1

No, rviz can only visualize data. So if you publish "markers" for your racetrack it will visualize them, or if you publish the data for your ir sensors, it can visualize them. If you want to simulate a racetrack and sensors, then you need a simulator, like gazebo or stage or STDR.

William gravatar image William  ( 2016-12-07 16:20:58 -0500 )edit

It is not uncommon to use gazebo and rviz at the same time. You can also run gazebo "headless" so that it has no GUI, but is only generating sensor data and simulating the kinematics and dynamics of your robot.

William gravatar image William  ( 2016-12-07 16:21:35 -0500 )edit
1

Possibly. If you go the RVIZ only route you can make a black and white racetrack.pgm file (not png), display that as an occupancy map, then create a node to calculate the IR sensor readings based on your position and the occupancy map. If you did this with Gazebo it would do that calculation for you

shoemakerlevy9 gravatar image shoemakerlevy9  ( 2016-12-07 16:23:31 -0500 )edit
1

answered 2016-12-07 12:28:20 -0500

gvdhoorn gravatar image

updated 2016-12-07 12:29:32 -0500

RViz and Gazebo are too very different tools: the former is a visualisation tool that knows how to subscribe to dataflows in your application and then uses plugins to render those dataflows in a 3D environment. The latter is a fully dynamic simulator, used to create physics based simulations to mimic the 'real world'.

In most cases you'll always use RViz, as it's just too handy a tool to not use (it takes seconds to visualise data flowing in your application). Whether you need/want to use Gazebo will depend on whether you want to be able to simulate the environment your robots will find themselves in and their dynamic behaviour.

edit flag offensive delete link more
1

answered 2016-12-08 10:50:14 -0500

BrettHemes gravatar image

You could try Stage a 2(.5)D simulator which immediately came to mind seeing your attached racetrack image. I have used it in the past outside of ROS but it looks like they have a package. The homepage is here. Depending on your modeling complexity needs, this could be a nice answer to what you are looking for without the added complexity of something like Gazebo.

edit flag offensive delete link more

Comments

That looks like a very good suggestion! Having this whole simulation outside of ROS is not a problem at all. I'll look further into Stage :)

FrodeL gravatar image FrodeL  ( 2016-12-08 12:02:41 -0500 )edit

Unfortunately getting Stage working is just too friggin hard. I've used four hours just trying to get it running, but I've been unsuccessful in compiling it on Ubuntu 16.04. Feeling too discouraged I'm turning my focus back to Gazebo and Rviz.

FrodeL gravatar image FrodeL  ( 2016-12-08 16:15:07 -0500 )edit

If you have the packages.ros.org deb repository added to your machine (something you do when installing ROS), then you can just do sudo apt-get install ros-kinetic-stage. That way you don't have to build it. You can also install the ROS-stage compatibility package ros-kinetic-stage-ros.

William gravatar image William  ( 2016-12-08 16:33:24 -0500 )edit

Also, if you're ok with a 2D simulator, you might try http://wiki.ros.org/stdr_simulator , which is more modern than Stage and might be easier to use if it has the features you need.

William gravatar image William  ( 2016-12-08 16:34:02 -0500 )edit

Ah, well, what do you know... I already had Stage installed! Seems to be installed when installing ros-kinetic-desktop-full. Silly me, didn't even think to check. Got the GUI started up, and will look into how I can define my racetrack as a World, and use IR sensors on the model robot.

FrodeL gravatar image FrodeL  ( 2016-12-09 04:58:32 -0500 )edit

Do you know if there is an easy way to install Player (and playerv) on Ubuntu 16.04? Could't find a packages for it. Found only "sudo apt-get install robot-player", but it seems to be only for 12.04 and 14.04, not 16.04.

FrodeL gravatar image FrodeL  ( 2016-12-09 15:23:11 -0500 )edit

I've been trying to get Player working in Ubuntu 16.04 for a while now, but it's just too much work. The Player and Stage projects appear mostly abandoned, and sourcecode hasn't really been maintained the last five or so years. There doesn't seem to be any active community for this,so I'm giving up.

FrodeL gravatar image FrodeL  ( 2016-12-10 15:30:14 -0500 )edit

I've also tried STDR now, but it too seems to not really be actively maintained. It is a bit more active than Player/Stage, but I find the tutorials lacking, and haven't really found an active community around it either.

FrodeL gravatar image FrodeL  ( 2016-12-13 11:17:58 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-12-07 11:54:03 -0500

Seen: 3,029 times

Last updated: Dec 10 '16