What a Robot Simulator is NOT
So then if not for 3D visualization, what is it for?
Simulation tests a theory!
Simulation is for Testing Ideas
Simulation to Test Software
A perfect example was when I was writing my wavefront robot pathfinder algorithm. From experience I knew it would be incredibly difficult and time consuming to work out all the bugs on the actual hardware. So instead I wrote up a quick simulator to debug the algorithm. It probably saved me a week of coding and testing! See the below image of the simulation.
Now you may be asking, where is the pretty 3D animations of a robot running around? As I said before, simulations aren't for display, they exist for functional reasons. For my wavefront test, letters and numbers in a command prompt was much more efficient/effective than a graphic display.
You can find more information and simulation source code in my wavefront tutorial.
Simulation to Develop Theories
You could just guess, but what if that value is actually very important for the performance of your robot? Or maybe instead of guessing you could build ~10 robots, each with a different spacing, to find the best one.
But a better way would be simulation. For this particular example, what you would do is put the robot in a physics simulator. You run about 10 simulations where the spacing is different and the terrain is different, and then identify patterns to select the best spacing. Its basically a scientific experiment done in software.
When I was designing my Carpet Monkey robot there was the question about tail length. Robot engineers have in the last ~10 years or so found that adding a tail to climbing robots greatly enhances their climbing ability, but no one quite knew quantitatively why. An even harder question is, how long should that tail be? Well my Carpet Monkey definitely needed a tail to function, but I didn't want to build a dozen different tail lengths to see which was best. So I ran a physics simulation on it using Phun 2D:
To my knowledge this is the first quantitative analysis of robot tails ever done. Tail lengths on the many other climbing robots were guessed based on subjective experiments. Feel free to download my Carpet Monkey Phun file. Here is a method to transfer a robot design to Phun. Also, a dual claw version Phun file. Thanks lucidliquid!
Other simulations include computational fluid dynamics (CFD), stress analysis, analog circuit analysis, dynamics testing, control stability analysis, pathfinding, FEA, etc.
Why can't I have pretty 3D graphics?
Disadvantages of Simulation
If you forget something, say friction, or make an error, such as the wrong units for gravity, it will give a false result. Most simulations are very simplified: no sensor noise, no friction, no computational lag in the robot, all objects are perfect cubes, water is incompressible, etc. Just because your robot will work in the simulation doesn't mean it will work in real life! Of course you can spend lots of time making your simulation perfect, but if you require 100% realistic settings its probably better to just test with a real robot. Before designing your simulation, you need to decide what you can simplify and what needs to remain realistic.
Simulation sometimes takes a really long time. A single CFD test run for my robot fish takes between 1 to 2 days on an expensive high-speed blade server. Testing the actual real life robot fish takes like 5 minutes. So why use the CFD? Because I don't need a robot fish already built to test it!
Simulations are often wrong. They are wrong because the experimenter makes a mistake, or isn't sure what features are most important and hence oversimplifies - common for new experimental theories. Often you need to compliment the simulation with real life experiments for comparison to make sure the simulation is accurate. I once had a simulation giving a force result 100x larger than the real life experiment - turned out there was a math error in it. If a scientist reports some new result he found in a simulation, but offers no real life evidence/experiments, you can quickly call him out. He has no proof that his simulations aren't flawed.
I had this flawed simulation problem when designing my single part suspension system wheels for my ERP. Of course in simulation it worked perfectly. But in reality I didn't expect bending creep to appear days or weeks after using the wheel. It took me several redesigns and *experimental testing* to fix the problem:
As such, simulation should be used as a complimentary tool, but isn't an end-all solution.
Where do I get simulation software?
Has this site helped you with your robot? Give us credit -
link back, and help others in the forums!
Society of Robots copyright 2005-2013