How to create simulated Raspberry Pi + arduino based pipline in ROS ?

asked 2020-04-18 14:30:01 -0600

WizB0Y gravatar image

First of all I'm sorry, if this sound too beginners kinda question. But I searched google for as couple of days to try find straight answer for this question. I couldn't find any tutorial, article who explained how to simulate these underlying platforms(arduino/raspberry-pi) and circuits together with ROS & RViz.

The robot in question : A 4 wheel stepper motor driven car run by arduino and controlled by raspberry.

The actual physical system in question : Raspberry Pi will contain the map of route the robot car has to travel. So it will send direction commands to arduino, which in turn will use motor drivers to drive the stepper motors to move the car/robot. So basically a standard raspberry + arduino based robot driving setup.

My question is how to emulate this system in ros. I do have all the mentioned hardware, but I don't wanna use any of it.

So what the expected system/pipeline should be: Write a python program which runs on a simulated raspberry pi system in ROS which sends required signals to simulated arduino in ROS using rosserial. This will be interpreted in arduino which will contain roslib based sketch uploaded which will generate appropriate PWM signals on its pins. Now a simulated motor driver circuit, like L289n, will be connected to that arduino's pins. The movement of these wheels will move a simulated robot/car in the simulated environment, this is what RViz is used for I think.

So my question is what softwares, packages, plugins should be used with ROS to create all this simulated pipeline ?

edit retag flag offensive close merge delete

Comments

So my question is what softwares, packages, plugins should be used with ROS to create all this simulated pipeline ?

I'm pretty sure the answer is going to be "none", as what you ask is not typically the level at which anything is simulated with the generally available simulators in the ROS community.

Without knowing more about why you would want to simulate hw like this, it also sounds like it would be unnecessary.

gvdhoorn gravatar image gvdhoorn  ( 2020-04-18 14:48:46 -0600 )edit

Consider a scenario : we want to drive our robot which is guide by our program.

Now in physical world, Suppose the code generates instruction to move robot by 1m forward, so the arduino generates required PWM signals to drive the stepper motors now may be bcoz of the weight of robot or too much slope of the ground the robot only moves by 0.8 m.

Now if we havhowke similar setup in ROS + RViz(with Physics enabled) the robot will still move by 1 m bcoz the underlying electronic circuits are not actually emulated.

we miss train our code this way. On the other hand if we had all underlying emulated and connected to ROS & RViz then the physical force generated in RViz bcoz of physics engine would give us the reduced motion bcoz the robot is actually driven by those motors and not moved directly in "world ...(more)

WizB0Y gravatar image WizB0Y  ( 2020-04-19 03:11:08 -0600 )edit

If you really want to go down this deep -- which I can see being valuable for some applications, not sure this is one, but only you can judge that -- you'll probably have to do most of the legwork yourself. I don't believe there are any ready-made pieces for you to reuse, other than what you've most likely already found.

Some comments:

  • RViz is not a simulator. It's a visualisation tool. Gazebo is a physics enabled simulator, but just one of the many which you could potentially use with ROS
  • the example you give sounds like something which a closed-loop position controller would take care of. Open-loop there are probably going to be significant differences between any simulation and the real world, but incorporating feedback control is a commonly used approach to mitigate that. Not sure I'd personally, immediately start with simulating everything down to the ...
(more)
gvdhoorn gravatar image gvdhoorn  ( 2020-04-19 06:09:15 -0600 )edit

the robot is actually driven by those motors and not moved directly in "world space".

I'm not sure I understand you correctly here, but there may be a misunderstanding: many simulations of ROS robots apply joint torques to the simulated joints of a robot. They do not move robots by teleportation or moving objects around with "world forces".

Using joint torques would already be much closer to the type of simulation you seem to be after.

gvdhoorn gravatar image gvdhoorn  ( 2020-04-19 06:11:00 -0600 )edit