collapse

Welcome!



Welcome to Robot Rebels, an online robot maker community.

Register today to post your projects, ask questions, share knowledge and meet like-minded people from around the world.


The RobotRebel.org Community

Author Topic: Commissioning a Nano Leg Module  (Read 119 times)

BaldwinK

  • Member
  • ****
  • B
  • Posts: 13
Commissioning a Nano Leg Module
« on: November 28, 2017, 11:42:31 AM »
Summary

•   For each motor rotation is calibrated in degrees and the origin is set.

•   A gait pattern and lookup strings are calculated using an IK macro.

•   Setpoints are sent to each module and actual angles are reported back and shown on screen.

•   Graphs of actual angle versus theoretical show good correlation.

•   A short video was made of the modules under test.

I make extensive use of Excel spreadsheets to minimise the drudgery of these processes. However, as Erco has made me realise, not everyone has the means of running the program so only screenshots will be shown here. With care you can obtain a legitimate second-hand CD and key for around £10.

Commissioning

Commissioning is perhaps the most tedious part of robot building. After the construction of the body and limbs, fitting the servos and wiring up all the electronics it still won’t move until instructed. Strictly the next stages are calibration and then gait pattern generation - but often these two get combined.

As an example, I once used a TV remote to address each of 12 servos in turn to position them by entering a number 75-255. Each ‘posture’ was painstakingly recorded and added to so that a sequence of moves could be performed. All went well until a motor failed and had to be replaced. The bot then moved with a limp!

It is easy to spend a lot of time building up the patterns of movement and this work should not have to be redone if the physical parameters change. So we have to define a common interface suited to the bot and its special needs, and then generate the movement instructions for that interface.

Depending on the microprocessor capabilities it may be possible to do this with standard pulse width controlled servos. That number 75-255 suggests 180 degrees, but they are not degrees, and 0 is not defined either. Calibration may involve sending pulse widths within the 10µS ‘boundaries’ to convert real degrees to servo position.

Calibration

Using a Nano to control four motors in a leg module makes the calibration process simpler. With the 12 volt power turned off, the motors can be turned by hand and their angular position shown on the console. The feedback pot has stabilised 5V across it and the wiper connects to an analogue input. Without dismantling the bot it may be sufficient to hold a protractor against each motor whilst turning it and noting the ADC values.

However, it is much more accurate to disconnect each joint in turn, and fit onto the motor spline a protractor fixed to a servo horn. I use part of a CD case marked indelibly with 15-degree segments. Turning the motor with this attachment, the values 0-1023 displayed for each segment are entered directly into a spreadsheet sharing the screen. It doesn’t matter where the measurements start, just note the value every 15 degrees.

Spreadsheets have a lot of features to help with calibration. First the entries are graphed to show the non-linearity of the pot. This is a gentle curve so a real kink is probably an entry error.

Next Excel can fit a trendline to the graph and display its equation in a text box. This is a second order polynomial in the form y = ax2 + bx + c. We can then copy the three coefficients from the text box and paste them into cells for further calculation. The leg Nano now has the ability to translate from ADC pot values into degrees. Reconnecting the motor to the joint we can note the ADC value at a reference point, eg when the knee is straight. Enter this value and the spreadsheet will convert to degrees-of-offset for the translation.

Cal3.JPG
*Cal3.JPG (38.26 kB . 684x330 - viewed 26 times)

Note that each motor angular calibration will not need to be repeated and is held on record in the spreadsheet documentation. If re-positioned on the spline, only the reference value may need to change.

When the leg data is complete, the spreadsheet helpfully provides all the CSV strings for pasting across to the Arduino code. No pencil required!

Cal4.JPG
*Cal4.JPG (62.62 kB . 812x415 - viewed 26 times)
 
Here are two such leg modules, combined to form the hind part of a quadruped and weighing 600g. It will be fitted with training wheels to test movement but first it is hoisted onto a stand for the rotational measurements.

Hind Part.jpg
*Hind Part.jpg (72.28 kB . 1000x562 - viewed 25 times)

Digitigrades like cats, dogs and even birds walk on their fingers and toes. The foot is lengthened so the heel appears to be a wrong facing knee. In nature the increased leg length gives a higher top speed and the Z-shaped leg folds up nicely to let the trailing foot move forward over rough terrain.

Starting at the heel (H), zero degrees is when the foot is in line with the tibia. The construction here is rigid and the motors are blocky so 135 degrees is the most it can rotate. Similarly for the knee (K).

Third motor up is the main forward/backward drive and I think of it as pitch at the hip (P). Animals are narrow across the hips and suspending this main motor under the chassis mounted motor keeps all in line one above the other. 60 degrees is when the femur is vertical, zero will be close to the body.

The chassis motor is mounted 40 degrees to the horizontal. This combines the roll and rotate functions at the hip (R). Performance changes with geometry so it is not perfect but does save a drive motor. 60 degrees is when the bot would walk straight ahead, moving the limb outwards to the side would increase the reported angle. The other leg limits movement here so there is a less usable range.

Gait Pattern Generation

This subject has been covered separately before. Here is the Excel IK macro running a creep walk - where only one leg is off the ground at a time. This means each leg must spend only 25% of the cycle time in returning to the start position.

Xgait2.gif
*Xgait2.gif (195.98 kB . 705x392 - viewed 26 times)

The input to the calculation is just the position of the toe in 20 frames. So when y = 0 the toe is on the ground. To the left or right of the hip is given by the x value.
 
Toe.JPG
*Toe.JPG (9.4 kB . 400x128 - viewed 27 times)

The macro button calculates all the angles needed to have the toe at the target positions in all the frames. The second hind leg is shown here running 50% out of phase. The forelegs are also shown using a slightly different IK calculation but phased in the usual sequence used by all quadrupeds.

This is offline Inverse Kinematics. It is not necessary to provide every motor angle – just feed in the ‘toe pattern’ and the spreadsheet will sort the answers.

Telemetry

The i2c master sends setpoint angles as four bytes to each i2c slave module. The master can also read back the actual current positions as determined from the ADC values.  Excel can cope with the 3200 values obtained below and show the walk data for any motor. A major difference between input and output can highlight a sticking gearbox for example.

Tele.JPG
*Tele.JPG (22.64 kB . 449x239 - viewed 27 times)

This is a comparison of the heel and pitch motors of one leg. The staircase effect is because the setpoint data is repeated four times to control the speed. The motors follow in time as best they can. A change of slope shows a variation of speed under load but the overall result is that the motors can keep up.

Demonstration


The hind leg modules are attached to a ‘bits box’ containing the i2c master, 1000 mAH 3C lipo and 5V UBEC. The training wheels are heavily weighted to maintain stability. All up weight is now 1.3kg so the motors have real work to do.

The four-legged gait is incomplete here, the front legs will provide additional drive at all times.

Conclusion

Copying computer-generated angles into Arduino code and executing the expected movement is encouraging. However, using widely spaced training wheels does mask all problems of balance. The inset to the moving Excel graph shows the theoretical ‘triangle of support’ as the gait progresses. Marginally unstable in only a couple of frames the bot should stand safely in most of the poses. But as soon as a dozen motors start to move then the centre of mass will change and momentum and external disturbances will upset the balance.

Further development will need 3D IK to position the toes laterally; the unusual setting of the roll/rotate motor will make for interesting trigonometry. Then the IK calculation must move into the bot itself so it can respond dynamically to input from an IMU or other sensors.

 

* Search


* Recent Topics

metal chassis desktop bot by craighissett
[December 14, 2017, 06:55:16 AM]


LEGO by Impala
[December 13, 2017, 09:46:53 PM]


Your workshop space by viswesh
[December 07, 2017, 09:32:47 PM]


printed CNC engraver by tinhead
[December 05, 2017, 05:09:44 PM]


Albert Michelson's Harmonic Analyzer by jinx
[December 05, 2017, 01:05:48 PM]


Raspberry Pi / Python eBook - free for the next 11 hours! by MEgg
[December 03, 2017, 04:20:50 PM]


Fun Fact by Impala
[December 03, 2017, 11:26:45 AM]


CZ-1 2.0: problems, calibration and printing, part2 by MEgg
[December 02, 2017, 12:15:34 PM]


Commissioning a Nano Leg Module by BaldwinK
[November 28, 2017, 11:42:31 AM]


T-HR3 by jinx
[November 21, 2017, 03:41:11 PM]


MKS Sbase by jinx
[November 20, 2017, 03:53:21 PM]


Skull Line Follower by Ittiporng
[November 20, 2017, 03:23:18 AM]


Just scary to me... by jinx
[November 16, 2017, 03:05:30 AM]


"Artie" version 3.0 (RTV3) by jinx
[November 14, 2017, 03:11:04 AM]


Anycubic Kossel (pulley) by Bajdi
[November 13, 2017, 04:48:04 PM]

* Recent Posts

Re: metal chassis desktop bot by craighissett
[December 14, 2017, 06:55:16 AM]


Re: LEGO by Impala
[December 13, 2017, 09:46:53 PM]


Re: Autodownload items (was: Re: LEGO) by MEgg
[December 11, 2017, 02:59:41 PM]


Re: Your workshop space by viswesh
[December 07, 2017, 09:32:47 PM]


Re: Your workshop space by tinhead
[December 07, 2017, 08:50:59 PM]


Re: Your workshop space by MEgg
[December 07, 2017, 03:13:51 PM]


Re: Your workshop space by mogul
[December 07, 2017, 02:43:22 PM]


Re: printed CNC engraver by tinhead
[December 05, 2017, 05:09:44 PM]


printed CNC engraver by jinx
[December 05, 2017, 04:59:18 PM]


Albert Michelson's Harmonic Analyzer by jinx
[December 05, 2017, 01:05:48 PM]


Re: Your workshop space by craighissett
[December 04, 2017, 09:32:32 AM]


Re: Your workshop space by tinhead
[December 04, 2017, 09:26:32 AM]


Re: Raspberry Pi / Python eBook - free for the next 11 hours! by MEgg
[December 03, 2017, 04:20:50 PM]


Re: Fun Fact by Impala
[December 03, 2017, 11:26:45 AM]


Changed calibration after long time by MEgg
[December 02, 2017, 12:15:34 PM]