BioloidCControl User's Guide PDF
BioloidCControl User's Guide PDF
BioloidCControl is an alternative firmware for the Robotis Bioloid Premium Kit humanoid type robots.
Its aim is to replicate the functionality of the original Robotis firmware (which is not open source),
giving the user more options in terms of behaviour control. It is based on:
The main control loop implements a finite state machine which can receive commands via the serial
port. Commands can be issued using RoboPlus Terminal either using a Zig2Serial or the serial cable. A
complete command reference is provided below.
Prerequisites
1. Robotis Bioloid Premium Kit with ZigBee modules (Zig2Serial for wireless control)
2. RoboPlus software (for Terminal and RoboPlus Motion)
3. AVR Studio 5.1 – can be downloaded from www.atmel.com
4. Perl if you want to use your own motion file
Getting Started
6. Open serial.h and select the serial interface (Zig2Serial or cable) that you will be using
// Define which mode of transport is used
// Use SERIAL_CABLE for Rs-232 cable from USB2Dynamixel to CM-510
7. Open BioiloidCControl.c and check the configuration options at the top for any adjustments
you would like to make
8. If you used the Perl script in step 2 to create a new motion.h file, copy the code in
motionPageInit.c to the motionPageInit() function in motion.c
9. Build the solution in AVR Studio
10. Transfer the .hex file to the CM-510 controller using RoboPlus Terminal (make sure you set
serial speed to 57,600bps)
a. Connect the robot using the serial cable
b. Hold down Shift-# whilst pressing the Robot power button to start the bootloader
c. You should see: ‘SYSTEM O.K. (CM510 Boot loader V1.51)’
d. Enter ‘ld’ to load the .hex file
e. In the RoboPlus Terminal Menu pick Flies -> Transmit File
f. Navigate to the directory where the .hex file is and select the file
g. Click OPEN to start the transfer
h. Wait for the transfer to complete
11. Type ‘go’ in RoboPlus Terminal or cycle the power on the CM-510 once the download is
complete
12. Wait for the PLAY LED to flash and then press the START button
13. Issue commands at the prompt as per the table below
STOP Execute the exit page(s) of the current motion being performed. This command
does not disable torque.
Mxxx Execute the motion page with the number xxx. This will execute the sequence if
the page(s) have a Next Page entry.
SIT Execute the Sit Down motion page and disable torque.
STND Execute the Stand motion page.
BAL Execute the balance page (balancing using gyros not yet implemented).
FGUP Get up from slip forward (robot is face down)
BGUP Get up from slip backward (robot is on its back)
WRDY Execute the Walk Ready motion page
WFWD Walk Forward
WBWD Walk Backward
WLT Walk Left Turn
WRT Walk Right Turn
WLSD Walk Left Side
WRSD Walk Right Side
WFLT Walk Forward Left Turn
WFRT Walk Forward Right Turn
WFLS Walk Forward Left Side
WFRS Walk Forward Right Side
WBLT Walk Backward Left Side
WBRT Walk Backward Right Side
WAL Walk Avoid Left
WAR Walk Avoid Right
WBLT Walk Backward Left Turn
WBRT Walk Backward Right Turn
/*
* BioloidCControl.c - Replacement firmware for the Robotis Bioloid CM-510 controller
* and Bioloid Premium Kit based humanoid robots (Type A/B/C).
*
* Requires a motion.h file generated by the translate_motion.pl Perl script.
*
* Supports all motions, including walking, gyro, DMS, buzzer, LEDs, buttons and
* serial connection via cable and ZIG2Serial.
*
* Performs initialisations and then runs main control loop
*
*/
global.h
/*
* global.h - Basic definitions for the Robotis Bioloid CM-510 controller.
* contains hardware definitions and command list
*
*/
clock.c
/*
* clock.c - millisecond and microsecond clock
*
*/
buzzer.c
/*
* buzzer.c - Functions for controlling the buzzer on the Robotis CM-510
* These function use a timer1 PWM to generate the note frequencies and
* timer1 overflow interrupt to time the duration of the notes, so the
* buzzer can be playing a melody in the background while the rest of
* the code executes.
* Based on the Pololu library
*/
button.c
/*
* button.c - Functions and Interrupt Service Routines for controlling
* the five push buttons on the Robotis CM-510 controller.
*
*
*/
/*
* adc.c - Library for using the analog inputs on the Robotis CM-510
* controller. Reads ADC0 for battery voltage and ADC1-ADC6 from
* the external 5-pin ports. By default ports are assigned as follows:
* GyroX = CM-510 Port3 = ADC3 = PORTF3
* GyroY = CM-510 Port4 = ADC4 = PORTF4
* DMS = CM-510 Port5 = ADC5 = PORTF5
* Based on the Pololu library
*/
// function that reads all the sensors from the main loop
// SENSOR_READ_INTERVAL in global.h determines how often the sensors are read
// BATTERY_READ_INTERVAL in global.h determines how often the battery voltage is read
// Returns: int flag = 0 when no new values have been read
// int flag = 1 when new values have been read
int adc_readSensors();
// function to process the sensor data when new data become available
// detects slips (robot has fallen over forward/backward)
// and also low battery alarms at this stage
// Returns: int flag = 0 no new command
// int flag = 1 new command
int adc_processSensorData();
// take a single analog reading of the specified channel and return result in
millivolts
uint16 adc_readMillivolts(uint8 channel);
// take 'sample' readings of the specified channel and return the average
uint16 adc_readAverage(uint8 channel, uint16 samples);
// take 'sample' readings of the specified channel and return the average in
millivolts
uint16 adc_readAverageMillivolts(uint8 channel, uint16 samples);
led.c
/*
* led.c - Functions for controlling the six LEDs
* on the Robotis CM-510 controller.
*/
/*
* serial.c - Functions for the serial port PC interface on the
* Robotis CM-510 controller.
* Can either use serial cable or Zig2Serial via Zig-110
*
* Based on the embedded C library provided by Robotis
*
*/
dynamixel.c
/*
* dynamixel.c - Functions for the Dynamixel interface on the
* Robotis CM-510 controller.
*
* Based on the embedded C library provided by Robotis
*
*/
// Function to write data into the control table of the Dynamixel actuator
// Length N+3 (N is the number of data to be written)
// Instruction 0x03
// Parameter1 Starting address of the location where the data is to be written
// Parameter2 1st data to be written
// Parameter3 2nd data to be written, etc.
// In this case we have 1 or 2 parameters respectively
// Returns communication status - see dxl_get_result
int dxl_write_byte(int id, int address, int value);
int dxl_write_word(int id, int address, int value);
// Function setting goal and speed for all Dynamixel actuators at the same time
// Uses the Sync Write instruction (also see dxl_sync_write_word)
// Inputs: NUM_ACTUATOR - number of Dynamixel servos
// ids - array of Dynamixel ids to write to
// goal - array of goal positions
// speed - array of moving speeds
//Returns: commStatus
int dxl_set_goal_speed( int NUM_ACTUATOR, const uint8 ids[], uint16 goal[], uint16
speed[] );
pose.c
/*
* pose.c - functions for assuming poses based on motion pages
*
*/
motion.c
/*
* motion.c - functions for executing motion pages
* requires a motion.h file created by the translate_motion Perl script
*
*/
// This function initiates the execution of a motion step in the given motion page
// Page - number of the motion page
// Returns (long) start time of the step
unsigned long executeMotionStep(int Step);
// This function initializes the joint flexibility values for the motion page
// Returns (int) 0 - all ok
// -1 - communication error
int setMotionPageJointFlexibility();
/*
* walk.c - Functions for walking
*
*/