DEV Community

Cover image for Luna - My Journey Building a Robotic Dog (and Learning the Hard Way)
Nalin Angrish
Nalin Angrish

Posted on • Originally published at nalinangrish.me

Luna - My Journey Building a Robotic Dog (and Learning the Hard Way)

History

Those who know me might have heard about Luna, and for those who haven't, it's a robotic quadruped (inspired by SPOT by Boston Dynamics) that I have wanted to make since last summer. I started the work by the end of my summer break, but progress remained slow for specific reasons, and I couldn't do much work. The primary reason for this delay was that I had no idea about SolidWorks or any other CAD software I could use to design my bot, so I was starting from scratch. This was my first big-scale project where I was the entire Design and Coding team.

SPOT - by Boston Dynamics

please hire me Boston Dynamics :)

In my third semester, our course titled "Machine Drawing" briefly introduced us to SolidWorks, and that's when I got the push to learn it more deeply, and that's what I did. Moreover, since I already wanted to design Luna, I decided to submit it as my project for the course. I kept the design so I could directly print the parts and assemble them easily after printing.

Design Overview - First Iteration

I completed the design by the end of the third semester, and it was a minimal, small, cute robot powered by 12 SG90 Servo Motors. The design used three motors per leg -

  • 2 for hip movement, and
  • 1 for the knee.

This way, I could get the full range of motion you should expect from a robotic leg.

Old Design

Old Leg Mechanism

With the help of one of my seniors, I got the parts 3D printed in the early days of my 4th semester. However, he did warn me that I wouldn't be able to operate the bot using the motors I had chosen.

Naturally, I ignored him. (Spoiler alert: it didn't work)

So now, since I've printed the parts and bought the electronic components, it is time to build. But wait, exams! By the time I had the parts on my desk, mid-semester exams were waiting to welcome my dumb ass. Then, other commitments started popping up, and I eventually paused the project for a while. The project then started again after the semester ended.

Study aah :/

My Mistakes

Winging it

I encountered my first roadblock pretty early in the project. In hindsight, I now realize I had no proper planning or calculation for the project.

The motors couldn’t even hold a leg straight - not a bug, just the motors having a mid-life crisis at high frequency. They just couldn’t hold torque well, vibrated like crazy under load, and were too weak to handle the robot's weight.

I didn't calculate anything - I just went with the feeling that

"Yeah, these motors are all I've ever used, and they've always worked fine; these bad boys will work fine for this project."

Sorry Arnav bhaiya, I should've listened to you....

Lesson Learnt: Make component and design choices after careful consideration and calculation and listen to seniors' advice.

Definitely never winging it again

Not Simulating or Testing

Since I didn't test/simulate anything, I had no idea whether the things I was planning would work. Had I simulated the bot on software before purchasing the components or 3D printing anything, I would have known that it wouldn't work and would have updated the design and required parts on time, saving money and time.

Lesson Learnt: Simulate or otherwise test your design before ordering components. You're not Ramanujan - test your stuff.

Simulate first, build later

Being Broke

As a student, it made sense that I couldn't spend a lot on parts, but the fact is that good things take time, effort, and money. I could give the time and effort (though I didn't give enough, apparently), but money?

My choice of using SG90s was partly because bigger motors cost more. Spending a little more and designing with better motors in consideration would have worked out better. Tough to control, I get it - but sometimes, cutting corners just means cutting your whole project short.

Lesson Learnt: Don't optimize for cost, but for quality. Spending a little extra right now will help in the long run.

I'll be rich someday (hopefully)

What Now?

Learning from my mistakes, there are a few main choices I made:

  • Calculate what kinds of motors are needed instead of winging it.
  • Plan requirements properly and redesign.
  • Simulate the robot on Gazebo/Pybullet before purchasing anything.

I definitely learnt some shit

With these points now in mind, and after some calculation along with the help of our dear friend ChatGPT, I've decided to use Tower Pro's MG958 Servo Motor. These are 7x heavier than the SG90 servos but have 10x the torque (albeit at 10x the price). Hopefully, they will be suitable, but so as not to make the same mistake again, I'll test this by simulating the bot before placing an order for 12.

Now that I knew what components I would use (hopefully), I redesigned the bot from scratch. The most significant change was in the leg mechanism. In the previous design, I had two motors at the hip and one at the knee. However, in the current design, I changed it to have all three motors at the hip and use linkage mechanisms to move the hip and knee joints properly. This reduces the mass and moment of inertia of the legs, resulting in faster and smoother movements. The inverse kinematics for this might be tricky, but I'm confident I'll manage.

New Design

New Leg Mechanism

The main thing that might take me time is to simulate everything on Gazebo correctly. I've only used Gazebo with PX4-Autopilot as a part of my project on Fault Tolerant Control of Quadrotor with Single Motor Failure.

As I keep working on the project, I’ll also add ROS2 to handle the brain side of things. Once the bot is walking properly in simulation using Gazebo, I’ll share another post with all the updates (and probably a few disasters, too).

More fun stuff is coming soon — stay tuned. 👀

Top comments (0)