Hi,
I wanted to show my robot here. Its features are similar to Boston Dynamics Handle robot: It can balance on two wheels, jump, drive on ramps and use its arms. And it’s all controlled by a Jetson Nano.
I put a short description, along with the code and all the files needed to reproduce, here:
# Creating a Two-Wheeled Robot - And How to Teach it to Jump
In this "Blog Post", I want to demonstrate the challenges I faced while making this robot and explain the history of it a bit. I don't have an actual blog, so I'll just host it here on Github, together with the Source Code of the project.
It all started when I learned about [Raspibotics MABEL robot](https://raspibotics.wixsite.com/pibotics-blog/post/01-build-a-self-balancing-robot-with-legs-boston-dynamics-handle-inspired), together with a list of materials and a description how to build it. I've always been interested in Robotics and this guide seemed like a good place to start. I also had some extra time due to Corona. My goal was to rebuild this MABEL robot, and then to improve upon it. The robot is basically a small version of [Handle by Boston Dynamics](https://www.youtube.com/watch?v=-7xvqQeoA8c) but lacks some of its features: Jumping, moving on a ramp and grabbing things. I wanted to add these features.
Building MABEL went surprisingly smooth. I bought a 3D printer, learned some electronics, learned how to do some basic 3D modeling in blender and wrote some code that I put on a Raspberry Pi and connected everything together. You can see the initial version below (right) next to my inspiration (left):


You can't see it balancing there, but it has stepper motors on the wheels and a total of 4 servo motors for its "legs". Getting the robot to balance wasn't difficult. You put in an IMU sensor, implement a so called PID controller and tune 3 parameters until it balances. There are a lot of resources out there that explain this in detail.
The difficult part is what you don't see in the video: the jumping. The servo motors move with maximum speed in that video. And the wheels don't even leave the ground. I realized then that I needed completely different motors. Unfortunately I didn't know much about motors back then. So I started experimenting a bit. I took a brushed motor with a built in gear (those a very cheap and easy to use) and tried to load a spring with it. Once the spring is released, it could use all the stored energy at once for the jump. Kangaroos use a similar trick to jump, so it should work right?

As you can see above, it didn't work at all. Again, the feet didn't even leave the ground. And the body of the robot wasn't even attached yet. It was clear then that my intuition about this was completely off and I decided to simulate it before actually building it. Making a simulation takes some time, but it would quickly pay off. You can try out lots of different motors and robot designs much faster than building it for real. I briefly tried to build a physics engine from scratch for this, after all, how difficuilt can it be to simulate a little robot? Well, the math was too hard, so I gave that up pretty quickly. I also searched for what people in the robotics industry use, but I couldn't find anything that was lightweight and free. I had some experience with 3d physics engines at that point, but I was a bit reluctant to use those. I didn't really need a 3D simulation for this, the robot can be easily reduced to 2 dimensions if you just care about the jumping. And all the 3D math and collision detection would complicate things quite a bit. Luckily I found out about [Box2D](https://box2d.org/), a lightweight 2D physics engine. It's primarily made for games, but I figured it would be accurate enough for this. And it was surprisingly simple to use. All I needed to do was to calculate the torque output for a given motor and current and recreate the robot in that simulation environment. I also checked that the simulation was sufficiently accurate with [Stanford Doggo](https://github.com/Nate711/StanfordDoggoProject) (a robot which [jumps on for legs](https://www.youtube.com/watch?v=YeUpceVrUfg)). That's an Open Source robot with all motor specs published, so I could simulate that robot and check that the jump height in the simulation matches the one in the video. And it did actually match. I had to use a very small delta time step, it was much slower than realtime, but the accuracy seemed pretty good.
With the simulation environment running and validated, the rest was pretty easy. I evaluated a couple of motors, varied the gear ratio and leg length a bit and then compared the cost of the motors to the jump height. This is the simulation of the configuration I decided to build:
This file has been truncated. show original
Here is also a video, demonstrating some of the robots abilities:
The robot also has access to a Chat GPT like LLM, allowing it to have some conversations:
Let me know what you think ;)
1 Like