main_2017-jan-08_08-33-00pm-000_customizedview10640570712

Quad-legged robot ideas

My humanoid robot updates have temporarily taken a backseat due to some other distractions, such as the FPV quadcopter, and now this! Updates on the Bioloid will still continue however, as I am far from done with it.

So as another side-project, I’ve been thinking about trying to build a custom robot from the ground-up, rather than basing it on an existing platform like the Bioloid.


CAD software

I have been using FreeCAD for the Bioloid project, which is a great free tool but somewhat hard to use and lacking many of the features found in modern CAD software.

As I need to design a large number of new parts, I’ve been looking around for a good CAD software with most or all of the following key features:

  • free, or at least licenced for hobbyist use
  • parametric modelling
  • export to STL
  • 3D printing support tools a plus, but not necessary
  • nice renderer?

Autodesk’s line of tools seem to meet these requirements very well. Autodesk 123D seemed like an excellent choice, with more advanced features than its sibling Tinkercad, a CAD program which runs inside a web browser. However, Autodesk has recently been restructuring its suite of tool according to this announcement, so this lead me to check out Fusion 360.

It has a very flexible licensing model, which means it can be used for free as a student, educator, start-up and most importantly, as an enthusiast (non-profit). I have only been using it for a few days, but so far it seems impressive. It works very similar to SolidWorks, and has a number of useful features such as direct integration with various 3D printing tools and services, and an easy-to-use renderer. One thing that may be seen as a downside is the fact that everything is stored on the cloud, but local backups are possible.

 


Components & 3D printing

The main design of the robot will be centred around the use of Dynamixel’s AX range of servos, as they are the most competitively priced motors I’ve found for the power and features they offer. Most other high-torque servos are prohibitively expensive, considering I will need about 16 and each costs over £100!

The exact model will probably be the AX-12A, which is an improved version of the AX-12+ used on the Bioloid. I might be able to stretch to the faster, more expensive AX-18A, however as their external design is identical, any frames used will be compatible with both.

 

For the basic servo joints I will be using a combination of the plastic frames in the Robotis range, as well as possibly some metal frames by Trossen Robotics. The rest of the robot will be designed with 3D printed parts in mind. Whether I go for an expensive online 3D printing service or try and revive my 3D printer remains to be seen.


Inspiration:

These are a few images as well as designs by other hobbyists which I am using as inspiration:

Onwards and upwards

It’s been a while since the last update on the Bioloid robot, and that has mainly been due to a recent distraction in the form of a racing quadcopter!

This is my first build or a drone/quad, and I wanted to create if from parts rather than a kit in order to learn more about the current technologies and options available.


The quad

I have chosen a 210 mm X-frame quad, which on hind-sight is maybe slightly too small for a beginner. Perhaps I should have gone for the larger 250 mm, but the 210 hasn’t turned out too bad, other that the limited space for electronics and the steep learning curve in flying!

For the flight controller, I originally used an AfroFlight Naze32AfroFlight Naze32 Rev.6 10 DOF, but then switched to an SPRacingF3 mini, as I couldn’t run the XSR receiver in SBUS mode, use Smart Port telemetry (in SoftSerial mode) and control the LED strip all at the same time with the Naze32. The SPRacingF3 also has a much faster CPU and more expansion options for future add-ons, but it comes at a much higher price!

The receiver/transmitter are both from FrSky. The Taranis transmitter is a great piece of equipment and so far seems like a good investment in general. Perhaps I will write another post focusing more on this in the future.

Learning about the various comms protocols (PPM, SBUS, SmartPort etc.) and how to wire up the electronics was an interesting challenge, since I was using a mix of hardware and most of the information was scattered around the net. However, once the hardware was connected I was surprised at how easy it was to configure the software. Both the controllers I’ve used supported Cleanflight, which is installed a Chrome browser extension, and getting it to communicate and control the FC was very straighforward.

As of now I have only flown line-of-sight a handful of times, and it is definitely a challenge, particularly as the sensitive throttle makes the altitude very tricky to control. Then again I have only been using the default PID controller settings, so tuning them may help.

A first-person view (FPV) camera and viewing system is definitely the top priority for future upgrades!


Pictures


Components

  • Chassis, main electronics & rotors
  • Comms
    • Transmitter: FrSky Taranis X9D Plus
    • Receiver: FrSky XSR
  • Lighting & power
    • LED strip: Lumenier Digital RGB Arm LED Board
    • Power Distribution Board (PDB): CC3D
    • Battery: Drone Lab 1500mah 4s 50-100c 14.8V LiPo
Screenshot from 2016-07-20 23-37-37

Tweaking PIDs

Following from my previous post on PID control, I have integrated my old test PID code into a more usable form in the GUI. I will quickly describe what the old test balancer did, and then the recent updates:

I started with the notes from this useful article as a baseline, but then built a very simple C++ class around it. I have also included some fairly standard modifications to the “vanilla” (ideal form) PID controller:

  • Calculating the derivative of the process variable, rather than of the error, to avoid large and sudden outputs in response to a large increase in error.
  • Prevention of integral windup by constraining the integral term and controller output between a minimum and maximum value.

I then started adding additional features built around the controller, which are:

  • Derived class which works on the standard form of the PID controller
  • Qt “widget” class, which displays a number of spin boxes and sliders for controlling the three gains and the output limits of the PID (as well as the min/max limits of the user controls)
  • A graph to trace the set point (SP) and process variable (PV) against time
  • A procedure which starts/stops the PID loop for balancing, in a separate thread (more on this below)

The aim is to control the forward/backward balance of the robot on a slanting surface. The balancing works by adjusting the ankle motors to match the pitch of the IMU link (see older posts here and here). For example, if the robot is on a board which lowered downwards by 5 degrees, the ankles will also point downwards by 5 degrees. The motor’s position is directly controlled by the IMU pitch, and the PID is actually controlling the moving speed with which the motors will reach that position. Unfortunately it’s not possible to do torque or direct speed control with the AX-12 motors.

With only some limited manual tuning, the initial results are fairly good for small and slow movements of a slopes surface, but it will need some tuning to stop the robot from oscillating at higher speeds and falling over. I will continue improving this method, possibly by using more PIDs to control the knee and hip motors at the same time. For now, here is an image of what it looks like running in the GUI:

Screenshot from 2016-07-20 23-37-37


Some useful links on the basics of PID control

Symmetric foot separation.

Balancing ideas

I had briefly tried in the past a simple balancing function using a PID controller, which aims to balance the Bioloid using the ankle motors, by trying to keep the IMU (accelerometer/gyro) vertical. The result was mixed success, but was only an early test. I am considering revisiting this balancing test, but this time using a number of PID controllers to control multiple groups of leg motors(e.g. hips, knees and ankles), while also using the GUI to make testing faster and easier.

 

On another note, I recently came across the Nengo Neural Simulator, which is a framework for creating neural networks of leaky integrate-and-fire (LIF) neurons for creating complex computational models. It has been used to create Spaun, the world’s largest functional brain model which is able to perform a number of functions such as vision, memory, counting, as well as drawing what is sees by controlling a simple arm.

What stands out is how easy it is to use the Nengo GUI to build neural networks. The interface runs in the browser and visualisations of neuron spiking activity and other metrics are easily shown for each graphical object. There is also support for scripting in Python. Installing it and trying it out for yourself is pretty simple, just follow the Getting Started guide here.

 

It would be really interesting to see if some form of PID controller could be built using Nengo, and then used to control the Bioloid’s balancing!