PDA

View Full Version : Virtual Testing



Firestorm65
02-21-2009, 01:17 PM
What kind of program would I need to virtually build our robot to test our control code? Basically, I want to prove we can make it walk before we can start actually building it.

lnxfergy
02-21-2009, 01:50 PM
What kind of program would I need to virtually build our robot to test our control code? Basically, I want to prove we can make it walk before we can start actually building it.

I dont think such a software package exists. You can definately do some simulation of mechanical properties in Autodesk Inventor or SolidWorks, but I don't believe the physics packages are good enough to actually determine something like "at this point the robot would fall down..."

Some robot models exist in packages like Player/Stage or Microsoft Robotics Studio, but again, I don't think the physics engines are up to doing the task you want.

Personally, I'm very against simulation for such complex tasks -- there are just too many variables involved to accurately model a simulation. By the time you've finished simulating, you could have built the entire robot and be weeks or months ahead on development...

-Fergs

Nammo
02-21-2009, 03:21 PM
Some robot models exist in packages like Player/Stage or Microsoft Robotics Studio, but again, I don't think the physics engines are up to doing the task you want.


Gazebo (the 3D simulator in Player/Stage) isn't bad. It can model a lot of physical interactions in 3D and is open-source and extensible enough to add other kinds you're interested in.

But Inxfergy is 100% correct in that there is no substitute for real robot time on real hardware. No program on earth comes close to simulating the actual complexity of real motor control and real sensors in the real world.

Just the motion of a single motor attached to a single wheel or joint is impossible to simulate realistically -- every motor is different, as is every driver circuit board, even if they all have identical designs and specs. Every fiber of carpet or table surface is different. All these tiny differences in real life compound in a way that doesn't happen in simulation.

Thus you can spend months getting things working in simulation and have wasted months -- none of the work you do in sim necessarily applies to the real world.



Personally, I'm very against simulation for such complex tasks -- there are just too many variables involved to accurately model a simulation. By the time you've finished simulating, you could have built the entire robot and be weeks or months ahead on development...


In my experience, simulation helps debug the real robot. Debugging a complex robot in a complex environment in real time can be so difficult that you _can't_ solve the problem without simulation -- even if your 'simulator' is just graph paper and a pencil.

I've found simulation useful to answer questions like, 'If this one part of the robot, or its environment, worked perfectly, what is the impact on the other pieces?' This helps me narrow down the root cause for problems observed on the real robot.

For example, you can simulate perfect sensors, perfectly square walls, perfectly reproducible conditions. You can step through the robot code in 'fake time' (while real robots necessarily use real time), rewind, replay, tweak parameters, and generally get a far more thorough understanding of a problem. It's much faster to do this sitting at a computer than on the floor rerunning potentially long/slow tasks again and again.

But you can't develop a working robot entirely in simulation. There is no substitute for real testing.

- Nathan

lnxfergy
02-21-2009, 03:43 PM
I wanted to clarify a little bit on my stance on simulation. I agree with you in that I think simulation can be a great way to debug the high-level logic of a robot's functioning, however I think that simulation often causes us to get "over-excited" about our results, especially when the inputs or outputs of such simulation would normally be interfacing with real hardware

{aside}I think one of the greatest examples of this is found in Mapping and Localization. Throughout the late 60s and early 70s, most algorithms ran only in simulation, and focused on finding "unique" points in the world, almost always defined as corners. This is an excellent idea, except that when such work was translated to real robots they found a major issue - the primary sensory for ranging available at the time was Sonar -- and anybody who has used a sonar will instantly realize that sonar sensors cannot find corners, the sonar pin hits the walls around the corner... {/aside}

A further point is that simulation is just an approximation... the more parameters and variables you take into account, the closer the approximation will be, but we can almost never find all the variables required for a particular simulation. This is an especially important point when a person has never done something in question... if you've never built a walking robot, how the heck can you know all the variables involved in making it work... I would conjure that most people who have built numerous walking robots would be hard-pressed to develop a software simulation package for their walker...

-Fergs

ScuD
02-21-2009, 04:23 PM
Just my two cents on simulation here;

Last week I had to give some PhD students an introductory class of the PCB layout tool that's used on our department- people who are obviously a lot smarter than me, and only a few years younger-
After the lecture I had them play around with the tool for a while, and the first questions I got were:
So how do we simulate this schematic? And can we have the tool automatically place the components on the board?

I feel that there's a loss with reality when taking simulation too far. You can write 4000 lines of code and simulate an apple falling from a tree to determine it's trajectory once it's hit the ground, but I'd rather sit on the grass on a sunny day and watch a real apple fall.

Now don't get me wrong, I couldn't live without simulating the firmware I've written for a new project / bot / whatever, but simulation is nothing more than that - simulation.

An example. You've written some code that uses a variable which will only run once that variable is zero. In simulation, it works perfectly. Run it on the microcontroller, and it does nothing.
In most cases, that free cell in the micro that you've declared as the variable is not 0 by default, but 255. Bam.

Offcourse this is an example of bad programming where you didn't initialize the variable correctly, but that's just the point. You should have thought of that.

Your bot simulates as walking perfectly, but once you've built it and get it going, you forgot to take into account the minute difference in center of gravity as the connector from the battery pack sways with each step, causing it to fall to it's left after 3 steps.

Simulation is a great tool, but keep it a tool. Remember that every living being uses more than simple equasions to do what it needs to do.

And now I feel like a priest. So Lynn, please move this post to some off-topic space, and replace it with 'fluffy powdered puppy tummies' if you'd be so kind :veryhappy:

CogswellCogs
02-21-2009, 11:45 PM
I'm a big fan of Microsoft Robotics Developer Studio. It comes with a visual simulation engine that includes the Ageia physics engine. So, in ScuD's example, the sway of the battery pack IS taken into account. You can also do things like see the forces exerted on your servos as the bot moves.

The hobby level of RDS is free. There are some limitations on it, but you can at least learn the environment and see if it does what you what. The full version is $500. There's decent documentation and examples. Those are important because the learning curve is pretty steep. In my opinion, the pay-off is worth it.

Here's a short video of the Kondo KHR-1 in using RDS simulation.
YouTube - Microsoft Robotics Studio Simulation: Kondo KHR-1

Of course, the points made by the other gentlemen are still very valid. No simulation is 100% (or even 90%) accurate. Still, I believe it can save time and effort in the long run by letting you do a lot of the trial-and-error stuff without building and rebuilding your hardware.

Here's the RDS site link and the related RoboChamps site.

http://msdn.microsoft.com/en-us/robotics/default.aspx
http://www.robochamps.com/

- CogswellCogs