Inspection robot: Difference between revisions

From Rsewiki
Line 179: Line 179:
|}
|}


These results are approximate as the steady state error varies a little between steps. From these results it can be seen that with a P-gain of 400 and a step-size of 50, good results are obtained (i.e. a small steady-state error). It is also seen that the effect of the D-gain is  
These results are approximate as the steady state error varies a little between steps. From these results it can be seen that with a P-gain of 400 and a step-size of 50, good results are obtained (i.e. a small steady-state error). Again it is seen that the effect of the D-gain is negligible.
It is noticed that steady-state errors tend to be larger when stepping on the high end of the potentiometer (i.e. steps 750-775, 800-850, 700-900 etc.). It should also be noticed that steady-state errors tend to be larger when moving from a higher position to a lower one (i.e. a step from 900 to 700 yields a larger steady-state error than moving from 700 to 900).
It is noticed that steady-state errors tend to be larger when stepping on the high end of the potentiometer (i.e. steps 750-775, 800-850, 700-900 etc.). It should also be noticed that steady-state errors tend to be larger when moving from a higher position to a lower one (i.e. a step from 900 to 700 yields a larger steady-state error than moving from 700 to 900).



Revision as of 16:08, 5 August 2015

Installation and use noted for 4/6-legged inspection robot.


Mobotware on a Raspberry PI

Installation - see How-to guide on main page.


Mobotware on a Beaglebone Black

Installation - ask Søren Hansen in 326/014 or Jens Christian Andersen in 326/020.

A small guide has been made, describing how to connect to the Beaglebone Black, how to mount it's file system, change I2C frequency and how to run RHD and RHDtest. The guide can be downloaded here: BBB_guide_101v3.pdf

RHD Plugin

Starting

When Mobotware has been installed, log on to the Beaglebone Black using a terminal with the following command:

ssh root@<BBB-ip>

Then navigate to the appropriate plugin folder. The exact path may vary depending on the installation. Most common paths are:

rhd/plugins/4legged/
rhd/plugins/6legged/
rhd/trunk/plugins/4legged/
rhd/trunk/plugins/6legged/

Then, the RHD can be started which will initiate I2C communication with the servo motor. To read out/set variables, RHDtest can be started in another terminal window.

NOTE: The RHD plugin needs to be compiled before using it for the first time after installation of Mobotware. This is done by navigating to the appropriate folder above, and writing the command "Make".

Features

The RHD plugin for the 4/6-legged inspection robot, as seen from the paths above, exists in two versons - one for the 6-legged robot and one for the 4-legged robot. The differences between the two plugins are minimal as both are designed for using the Beaglebone Black and communicating with the modified OpenServo PCB using I2C. The plugins are configured by modifying the XML-file: rhdconfig.xml.

Main differences between plugins:

4-legged 6-legged
Read gains from rhdconfig.xml Y N
Change of servo I2C address N Y
Support PID control N Y
Support PD control Y Y

Servomotor

Hardware

The Hitec HS646-WP electric servo motor are used for the inspection robot. See Hitec's website for specifications. The servo does not provide feedback by default, and is therefore augmented with the OpenServo project's PCB and software/firmware. The PCB and firmware are modified to fit the purpose of the inspection robot, and utilizes an ATmega168 MCU (datasheet, 34 MB PDF).

Potentiometer

Mounting: Green towards motor, yellow in center and red away from motor, or maybe more likely, motor is turned 180 deg. NOTE: The A/D converter of the ATmega168 MCU is 10-bits, giving potentiometer readouts between 0-1023.

If the potentiometer or motor terminals have been inverted, this can be compensated for by changing the macro SWAP_PWM_DIRECTION_ENABLED in the firmware source file config.h. This should only be a problem if new servomotors are augmented with the OpenServo PCB and the installer are not cautious.

Power

The supply voltage should be at least 6.5V to allow the regulator to properly produce 5V for the MCU. The maximum supported voltage is around 18V (the maximum rating of the weakest components). Operating with 10-12V is considered sufficient.

PCB Layout

The layout of the modified OpenServo PCB with connections can be seen in the pictures below (front and backside). A diagram/schematic of the modified OpenServo PCB can be seen here

The modification to the standard OpenServo PCB consists of moving two capacitors to make room for the motor (visible on side A).

Firmware

Bug

An earlier version of the firmware contains a bug that causes the firmware to crash if the PWM duty cycle becomes larger than 76% (196/255). When the firmware crashes, communication and control are lost and the servomotor will spin out of control. It is highly recommended to test if a servomotor has this bug, before use. This is tested by removing a gear from the gear-train of the servomotor and then demand a large PWM duty cycle (a P-gain of 150 and error of about 500 achieves this). If the error is present, update the servo firmware to the August 2015 version (version can be seen in main.c).

Features

As of August 2015, the servomotor firmware for the modified OpenServo PCB supports the following:

  • Fixed bug that caused the firmware to crash when PWM duty cycle became larger than 76% (196/255).
  • Sampling of Back-EMF (only up to duty-cycle of 76%, due to discharge time of armature coil).
  • Sampling of voltage, position and armature current.
  • PID control (The integration is untested).
  • 500 Hz PWM control.
  • 500 Hz internal sampling rate (once per PWM cycle).
  • Up to 400 kHz I2C bus frequency (Max supported by the ATmega168 MCU).
Needs Testing
  • Integration part of build-in PID-controller.
  • Anti-windup limits of integrator.

Programming of Servomotors

In order to update the firmware of the servomotors, the backside is opened by unscrewing the four philips-head screws and removing the back panel. The OpenServo PCB should be visible with side B facing out. The servomotor is then CAREFULLY placed in the created programming stand. There is only one way to orient the servomotor correctly in the programming stand! When oriented correctly, the pins of the programmer will connect to terminals: MISO1, MOSI1, SCK1, RESET-P and GND-P of the modified OpenServo PCB (see diagram).

The servomotor is then programmed by connecting the programming stand to the ISP port of an STK500/600 programmer and using AVRdude.

NOTE: The servomotor needs external power while being programmed.

Programming stand.

Operation

Worth Knowing

  • A P-gain is needed to make the servo run. A value of about 50 is a good starting point.
  • A D-gain does not affect the precision/overshooting. See the "Controller Characteristics" section for test results.
  • Internal sampling of Back-EMF, voltage, position and current runs at 500 Hz (once per PWM cycle).
  • Maximum obtainable external sampling rate with 400 kHz I2C bus frequency is approx 1249 Hz with a single servomotor and approx 312 Hz with four servomotors (a single robot leg). However, these frequencies cannot be obtained continuously.

Controller Characteristics

Tests have been conducted with regards to determining the precision of the servomotor depending on the PD-controller gains. The table below shows the results of different step responses. The servomotor is tested while standing on its own without any load. The steady-state position error ess, and error e (the step size), are in A/D units.

P = 100, e = 600
D = 0 D = 50 D = 100 D = 150
ess = 12 ess = 15 ess = 15 ess = 15

From these results it is seen that the D-gain has a very limited impact on the controller performance.

In order to avoid overshooting too much, small steps have been performed with large P-gains. The idea is to obtain a precise movement for a large step by making multiple small ones. The results can be seen in the table below. The steady-state position error ess, and error e (the step size), are in A/D units (approximate).

P = 400, D = 0
e = 25 e = 50 e = 75 e = 100 e = 200 e = 500
ess = 7 ess = 2 ess = 6 ess = 5 ess = 6 ess = 9
P = 400, D = 50
e = 25 e = 50 e = 75 e = 100 e = 200 e = 500
ess = 7 ess = 2 ess = 7 ess = 8 ess = 7 ess = 8
P = 400, D = 100
e = 25 e = 50 e = 75 e = 100 e = 200 e = 500
ess = 8 ess = 1 ess = 6 ess = 3 ess = 5 ess = 9

These results are approximate as the steady state error varies a little between steps. From these results it can be seen that with a P-gain of 400 and a step-size of 50, good results are obtained (i.e. a small steady-state error). Again it is seen that the effect of the D-gain is negligible.

It is noticed that steady-state errors tend to be larger when stepping on the high end of the potentiometer (i.e. steps 750-775, 800-850, 700-900 etc.). It should also be noticed that steady-state errors tend to be larger when moving from a higher position to a lower one (i.e. a step from 900 to 700 yields a larger steady-state error than moving from 700 to 900).

Old RHD Plugin

The initial version of the RHD plugin was connected to a servomotor using the USBISS converter (USB-to-I2C), and is not longer used.

Setting and main status for N servos (up to 24) implemented. Debug status for 1 servo implemented (first 48 registers are monitored)

Commands (write with register adress above 0x7f) is working

0x82 (130) enable PWM
0x83 (131) disable PWM
etc - see main.c in software

Change of I2C address is not implemented in this version (There is a save to EEPROM command).