Society of Robots
Search and Index
MISC
 Parts List
 Robot Forum
 Chat
 Member Pages
 Axon MCU
 Robot Books
 Shop
 Contact

SKILLS
 How To Build
  A Robot
  Tutorial

 Calculators
 Mechanics
 Programming
 Miscellaneous

 Robots
 Space

HARDWARE
 Actuators
 Batteries
 Electronics
 Materials
 Microcontrollers
 Sensors

SCIENCE
 Robot Journals
 Robot Theory
 Conferences


    PROGRAMMING - ROBOT SIMULATION

    Robot Simulation

    What a Robot Simulator is NOT
    Everyone wants a cool 'robot simulator' where a 3D animated robot runs around a 3D course. But actually, that is not what a simulator is or what it is for. That is simply a 3D rendering or animation with no purpose other than for visual demonstration.

    So then if not for 3D visualization, what is it for?

    Simulation tests a theory!
    Simulation is used as a quicker and/or simpler method for testing out ideas, theories, and software with robots. If you don't know what you are testing, then you don't need a simulator. Following are a few examples.

    Simulation is for Testing Ideas
    Lets say you haven't built a robot yet, but want to test out an idea without spending tons of time and money building the robot to do it. With a simulator you can have an 'instant' robot to work with. This is great for those who prefer to program over working with hardware.

    Simulation to Test Software
    Lets say you wrote up this really neat pathfinder algorithm and you want to test the code for not just bugs, but also on effectiveness of the algorithm for a robot. Well you can test it on an actual robot, but doing so is a long and tedious process. First you turn on the bot, program it, place it in the start position, let it run, then record what happened. You typically need to do that several times to find and average. Given the results, you go back and restart that whole process a few dozen times, tweaking it all the time. Each individual run can take minutes to do, not including issues with recharging batteries and hardware failures, resulting in hours or days of lost time. With a simulator, you can run dozens of tests within just minutes.

    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 of Robot in Wavefront

    Simulation to Develop Theories
    Lets say you are designing a robot, but have no idea what features are important. For example, you are designing a four-wheeled robot with a mass for 5kg, what is the optimal spacing between the wheels? 5 inches? 15 inches? How would you develop an equation to determine this?

    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?
    There actually are a few circumstances where this is useful. If you wanted to demonstrate your robot concept to non-technical people that can potentially give you lots of money, then you'd want to *animate* your robot. 3D graphics are also very helpful as CAD tools, something I like to use when designing complicated parts and assemblies. Doing it all on paper is a pain . . .

    ERP v1b CAD

    Disadvantages of Simulation
    There are many disadvantages to simulating a robot. This is because simulations only simulate what you tell it to simulate. (Yea, a no-brainer, but you'd be surprised . . .)

    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?
    Check out my list of robot simulation software. You might also find some in the below ads if Google is smart enough:





Get Your Ad Here

Has this site helped you with your robot? Give us credit - link back, and help others in the forums!
Society of Robots copyright 2005-2014
forum SMF post simple machines