My Hexapod Simulation

wow. That ain’t so bad.

The C++ Win32 API library I use compiles to about 1.4MB of extra file space :frowning: It sucks… But Windows GUI is really annoying. Borland makes life easier, but I cant find a good object list.

Sweet work :slight_smile:

Quick question. How is the model made? Did you make the model in a 3D Modeling program and then export it so Java can rotate the joints? Or do you have a file with sticks and mesh?

A stick and mesh system will allow for flexibility so the simulator can be used for different types of robots. Just import a different file, and poof! You’ve got a simulation of a scout or a BRAT.

-robodude666

The model consists of some OBJ files modeling the individual parts of the bot (in my implementation one leg consist of three seperate OBJ files). But it would also be possible to export the complete bot as one file.

In Java3D the complete 3D model is then built using the different components. The scenegraph defines the hierarchical relationship between the parts (body of the hexapod as root object->translation to one leg->rotation of servo1->translation to servo2->rotation of servo2->translation to servo3->rotation of servo3).
This relationship is created in Java and not read from the OBJ file.

It is certainly possible to do something like that, but it usually tends to become complex in the end. Creating a 3D BRAT simulator would be possible with some simple controls to change the servo positions or to record/play a sequence.
But the physical effects like gravity/friction are still missing (the BRAT would just move the body parts but not actually move forward).

Perhaps the most general approach would be to create a skeletal simulation tool without 3D meshes, but with the possibility to attach real 3D meshes to each bone. (Reminds me of 3DS Max using Biped for the skeleton and Physique to create the skin).
This would be very interesting to develop, and should not be too difficult to implement when only the most important features are implemented. (Of course only forward kinematics. A general N-link inverse kinematic algorithm would probably not be realtime anymore).

Finding the time to work on such a project is the true problem :slight_smile:

Martin

You and Zenta do awesome work. Might you be inclined to release your work for others to enjoy? I’d like to check it out, even if I had to pay for it.

Thanks!

I didn’t have the time to work on this project for the last few weeks. I just tested the code on my machine on windows (a few weeks back) and now on linux. It seems to work fine but the usual disclaimer applies (no warranty, use at your own risk, etc.).
gridvision.ch/robot.zip
The file contains the compiled version (robot.jar) and the sources in the src directory. A shell script (start.sh) to start the tool on linux is included.

Following software is required to build/run:
Java6 JDK from java.sun.com/javase/downloads/index.jsp
Java3D from java3d.dev.java.net/
Serial API from rxtx.org/
A Java IDE from jetbrains.com/ or eclipse.org/ or netbeans.org/

The sourcecode is completely undocumented and pretty messy. Feel free to contact me (ICQ: 77313116) if you have any questions/ideas.

I recommend to check the “Run” checkbox as soon as you successfully started the tool and then start to experiment with the controls on the user interface.
You can use the mouse to control the 3D view. Left button & drag = rotate, middle button & drag = zoom, right button & drag = translate. shift & left button set the red target cylinder used in waypoint mode.

The first steering cross is used to control the body offset. The second controls the body pitch/yaw.
You can drag the mouse on the third steering cross to control the walking direction of the hexapod. The red dot on this steering cross controls the walking radius of the hexapod. Dragging the red dot to the right makes the hexapod walk foreward.
Dragging the red dot to the middle makes the rotation radius smaller. The hexapod will eventually rotate on place when the red dot is in the middle of the cross.
The fourth steering cross is almost the same, just with the reverse walking direction.
It uses some time to get used to this type of control, but you can also enable the “Walk to Way Point” checkbox and set the target point for a simpler way to control the hexapod.

The class with the main method is:
ch.gridvision.robot.RobotControlGUI

The serial communication API is disabled in the sourcecode, you have to replace the line:
robotController = new NullRobotController();
with the line:
robotController = new ServoRobotController();
to reenable the serial API in the class RobotControlGUI. You also have to check that the correct port and parameters are used in the class ServoRobotController.

Martin

Wow! :open_mouth: That was very nice of you! I have to study your code one time…

Cool! 8)

Well, I guess this means it is time for me to learn java!

hello!
under what license are you releaseing your source code?
could you release a copy that includes a file specifying a license?

Thanks,
Andrew

I think the BSD license would be the most permissive one. Does this license work for you, or would you prefer another type of license?
Are you planning to use the code in a commercial application (just curious).

Regards,
Martin

Not a commercial application, we are just going to play around with a hexapod here at the university, and I taught it would be a nice touch to be able to test our code without the actual robot.
I think BSD would be great.
We have not decided yet if we would use this, but anyway it is always a good idea to Not leave out the file specifying the license from the package.

Sorry for responding so late, i forgot to check the “notify” box.

I uploaded a new version containing a LICENSE.txt (BSD license).

thanks alot!

Have you tried to play around with Simbad (simbad.sourceforge.net)? I think it would be interesting to integrate these two projects. I started with that, but I found Player/Gazebo (playerstage.sourceforge.net) which can be something I’m looking for.

Hello, I have a hexapod robot BH3-R and i would like to add a simulation on PC, i will try to make like you, can you tell me a need a bytecode compiler like Java SDK??, and how i can calculate the moving position of legs and platform, i see in your applet you choose a angle move about 60 degrees, thanks again and i wish to respond to my post, i wish you all good, best regards, Ghiu, Andrei!

complimenti per il simulatore, sarebbe molto felice di avere una copia dei file già pronti.
robogeppo: lol: