My Hexapod Simulation

I’m using Java as the programming language of choice because I know the language best and the software should run on windows and linux without porting. Java3D is an abstracted library and can run on top of OpenGL or Direct3D, it’s just a matter of setting a flag to switch between OGL/D3D.

The commands are generated on the fly. There’s no need to create a sequence first. In the end the bot should act autonomous based on object detection/recognition. That’s the reason I want to create the locomotion first and then start to add behaviour.

Martin

Hello everyone,

I added two new videos.
The first video shows the highlighting of servos in positions mechanically not possible on the real bot.
In this video I also use the new capability to control the angle between the legs.
youtube.com/watch?v=lP64iNDrKZQ

The second video shows the hexapod in the waypoint mode.
The locomotion algorithm controls the steering of the bot to reach the red waypoint. The waypoint can be changed using the mouse.
The algorithm is very basic and only calculates the rotation point of the bot depending on the angle between bot/waypoint and depending on the distance of the waypoint.
I can still manually change between gait types and other parameters like body height, pitch, yaw and angle between legs.
youtube.com/watch?v=p9FrDbRz56Y

Martin

HEHE! :laughing:

Awesome! The best simulation I have ever seen.
Is it possible to walk around the waypoint? Meaning that the waypoint is the centerpoint of rotation.

Your program are just excellent!

It is already possible to walk around a point while looking at this point when controlling the direction/rotation of the bot manually :smiley:
youtube.com/watch?v=mYj_9QjOvOQ

I would have to slightly adjust the waypoint mode when the bot should do this automatically.

Thanks
Martin

Impressive! 8)

I have managed to do the same with my excel program. But your solution are so extremely elegant.

Keep up the good work!

Looking forward to see your live walking hexapod!

I uploaded a new video showing the simulation with the real hexapod side by side.
youtube.com/watch?v=zIJSidNh0yo

Martin

OK! I don’t have any words left…

VERY IMPRESSIVE!!!

So cool! Had to admit, I’m a bit envious…
:astonished:

Very nice work :slight_smile: How big is the whole program? All of the files together.

I’m envious of both of you =P

Depends what files we count. The runnable compiled program with all data files (3D objects, textures etc.) without required libraries is 1.6MB.
Classes only are 300kb but this already contains video processing, steering behaviour and environment classes not used in the demos.
Source code required to run the demos is currently around 150kb.

Thanks,
Martin

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!