Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

AXONS - Homebrew firmware for AX12+ and CM510

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
61 postsPage 4 of 51, 2, 3, 4, 5
61 postsPage 4 of 51, 2, 3, 4, 5

Post by Fraser » Wed Jan 12, 2011 9:48 pm

Post by Fraser
Wed Jan 12, 2011 9:48 pm

Ok Miguel, I will post up the interface class.

When you send a constant PWM to a servo then the speed will be constant under constant load. But every servo is slightly different and so different speeds. And when in a robot then the load is never constant and the speed varies substantially especially at lower motor powers.

It should be fairly easy to incorparate constant speed into the 100Hz control loop. And have it vary the PWM as necessary at 100 Hz on your PC. The position feedback is pretty much noise free so calculating differential of position (speed) for the last few samples should give a good result. I haven't actually tried constant speed yet using this method, but I will.

I cannot think of any advantages or reasons to write speed control into the servo, but perhaps I am missing something and will end up writing it in. Your thoughts on this matter are more than welcome.

A ROS node to interface to Axons would be great. ROS is something I will probably put onto an embedded controller when I get to that stage. There is no rush, I think I will be tampering with this hobby for many years because I eventually want to get a humanoid walking as smoothly as Asimo, I believe humble AX12s can do it.
Ok Miguel, I will post up the interface class.

When you send a constant PWM to a servo then the speed will be constant under constant load. But every servo is slightly different and so different speeds. And when in a robot then the load is never constant and the speed varies substantially especially at lower motor powers.

It should be fairly easy to incorparate constant speed into the 100Hz control loop. And have it vary the PWM as necessary at 100 Hz on your PC. The position feedback is pretty much noise free so calculating differential of position (speed) for the last few samples should give a good result. I haven't actually tried constant speed yet using this method, but I will.

I cannot think of any advantages or reasons to write speed control into the servo, but perhaps I am missing something and will end up writing it in. Your thoughts on this matter are more than welcome.

A ROS node to interface to Axons would be great. ROS is something I will probably put onto an embedded controller when I get to that stage. There is no rush, I think I will be tampering with this hobby for many years because I eventually want to get a humanoid walking as smoothly as Asimo, I believe humble AX12s can do it.
Fraser
Savvy Roboteer
Savvy Roboteer
Posts: 84
Joined: Tue Nov 30, 2010 2:16 pm

Post by Fraser » Wed Jan 12, 2011 9:58 pm

Post by Fraser
Wed Jan 12, 2011 9:58 pm

Here are three classes:

http://www.ledset.com/bioloid/axons/axons_interface_code.zip

Sorry for the windoze bits and pieces,t it should be a fairly easy port. Not many dependencies.

OBJ_AxonsInterface.cpp
This class gives the low level access to axons. It includes a parser, it is set up to receive gyro data on the end of the packet but it will also accept a raw position packet just fine.

OBJ_AxonsControl.cpp
The beginnings of a control class, at the moment position control is implemented, a work in progress but what is there works. For porting you will need to change out the windows PerformanceTimer for some other high priority 100Hz interrupt tick.

OBJ_RobotisMotion.cpp
Parses standard robotis motion .mtn files and plays them into Axons, it works well but tweaks to OBJ_AxonsControl will be needed to duplicate robotis motions exactly.
Here are three classes:

http://www.ledset.com/bioloid/axons/axons_interface_code.zip

Sorry for the windoze bits and pieces,t it should be a fairly easy port. Not many dependencies.

OBJ_AxonsInterface.cpp
This class gives the low level access to axons. It includes a parser, it is set up to receive gyro data on the end of the packet but it will also accept a raw position packet just fine.

OBJ_AxonsControl.cpp
The beginnings of a control class, at the moment position control is implemented, a work in progress but what is there works. For porting you will need to change out the windows PerformanceTimer for some other high priority 100Hz interrupt tick.

OBJ_RobotisMotion.cpp
Parses standard robotis motion .mtn files and plays them into Axons, it works well but tweaks to OBJ_AxonsControl will be needed to duplicate robotis motions exactly.
Fraser
Savvy Roboteer
Savvy Roboteer
Posts: 84
Joined: Tue Nov 30, 2010 2:16 pm

Post by Fraser » Thu Jan 13, 2011 3:33 am

Post by Fraser
Thu Jan 13, 2011 3:33 am

This evening I played with the bioloid premium zig module pair (Zig100 and Zig110).

Some notes that others might find interesting:

As per robotis instructions you can enter the config mode on the Zig100 by plugging it into a zig2serial adapter and sending ! characters as you press the reset button on the zig2serial.

With the Zig110 you can do the same (robotis doesn't document this):

I rigged up jumper cables (zig110 to zig2serial) for RXD,TXD,VCC,GND and sent ! characters.

I pressed reset and nothing happened (because 110 has no pinout for reset)

You have to send the ! characters and then break/make the VCC line.

After entering config I changed the baud dividers to 3, this gives a baud rate of 230400.

I tried to set the CM510 to as close a baud as possible, I got damned close, lower 7 bits (ascii) seemed to flow nicely, but 8th bit gets occasionaly corrupted.

I have just ordered some SMD 8Mhz crystals and will swap them for the 7.3728MHz crystals currently on my zigs.

If all goes well then 100Hz loop freq. (with IMU data) over wireless on Win7 should be possible, faster (probably up to 200Hz) on a linux box.

Note:
to make it easier to plug jumpers in I soldered SIL sockets (actually DIL socket sawn in half) onto my zig2serial. This also gives a much more solid seating for the zig100.
This evening I played with the bioloid premium zig module pair (Zig100 and Zig110).

Some notes that others might find interesting:

As per robotis instructions you can enter the config mode on the Zig100 by plugging it into a zig2serial adapter and sending ! characters as you press the reset button on the zig2serial.

With the Zig110 you can do the same (robotis doesn't document this):

I rigged up jumper cables (zig110 to zig2serial) for RXD,TXD,VCC,GND and sent ! characters.

I pressed reset and nothing happened (because 110 has no pinout for reset)

You have to send the ! characters and then break/make the VCC line.

After entering config I changed the baud dividers to 3, this gives a baud rate of 230400.

I tried to set the CM510 to as close a baud as possible, I got damned close, lower 7 bits (ascii) seemed to flow nicely, but 8th bit gets occasionaly corrupted.

I have just ordered some SMD 8Mhz crystals and will swap them for the 7.3728MHz crystals currently on my zigs.

If all goes well then 100Hz loop freq. (with IMU data) over wireless on Win7 should be possible, faster (probably up to 200Hz) on a linux box.

Note:
to make it easier to plug jumpers in I soldered SIL sockets (actually DIL socket sawn in half) onto my zig2serial. This also gives a much more solid seating for the zig100.
Fraser
Savvy Roboteer
Savvy Roboteer
Posts: 84
Joined: Tue Nov 30, 2010 2:16 pm

Post by Fraser » Fri Jan 14, 2011 9:30 pm

Post by Fraser
Fri Jan 14, 2011 9:30 pm

After playing with stabilisition of a standing humanoid I have decided to write new commands into axons.

I managed to mix quit a bit of gyro pitch and roll data into humanoid joints (all joints). I would like to mix more into certain joints but as I increase gyro mix gain I start to get oscillations, a lot f this is caused by my rather soft control scheme over the serial link, which has to be soft to stop oscillations about position hold.

Despite these oscillations at higher gains, the humanoid can take quite a clip to the back of the head and remain standing.

I believe I will get MUCH better results if I implement what Limor suggested near the beginning of this thread (I always have to find out the hard way :roll:)

The new commands will be able to achieve the same throughput, 100Hz over 250kbaud on Win7:

Velocity command:
All servos can have angular velocity set. Servo will rotate at this velocity until limit angle is reached (see below)

Position command:
Servos will hold the passed positions. The maximum velocity used to achieve this will be the last velocity command received (if none received will use default 0.5 max velocity)

Max limit angle command
Passed value will be stored in EEPROM. Servo will not pass this angle position, even when using existing PWM commands.

Min limit angle command
As above.

Note: Default min/max posn EEPROM values will be written on first time boot. These will be some conservative value within potentiometer endpoints.

Set servos punch
The zero point of the PWM will be adjusted for each servo.

Set servos control gain
This will adjust the linear ramp for position hold control (large values will be possible for spring effect)

Set position compliance
Sets the deadzone about the required position in position hoild

Should be finished in a few weeks.
After playing with stabilisition of a standing humanoid I have decided to write new commands into axons.

I managed to mix quit a bit of gyro pitch and roll data into humanoid joints (all joints). I would like to mix more into certain joints but as I increase gyro mix gain I start to get oscillations, a lot f this is caused by my rather soft control scheme over the serial link, which has to be soft to stop oscillations about position hold.

Despite these oscillations at higher gains, the humanoid can take quite a clip to the back of the head and remain standing.

I believe I will get MUCH better results if I implement what Limor suggested near the beginning of this thread (I always have to find out the hard way :roll:)

The new commands will be able to achieve the same throughput, 100Hz over 250kbaud on Win7:

Velocity command:
All servos can have angular velocity set. Servo will rotate at this velocity until limit angle is reached (see below)

Position command:
Servos will hold the passed positions. The maximum velocity used to achieve this will be the last velocity command received (if none received will use default 0.5 max velocity)

Max limit angle command
Passed value will be stored in EEPROM. Servo will not pass this angle position, even when using existing PWM commands.

Min limit angle command
As above.

Note: Default min/max posn EEPROM values will be written on first time boot. These will be some conservative value within potentiometer endpoints.

Set servos punch
The zero point of the PWM will be adjusted for each servo.

Set servos control gain
This will adjust the linear ramp for position hold control (large values will be possible for spring effect)

Set position compliance
Sets the deadzone about the required position in position hoild

Should be finished in a few weeks.
Fraser
Savvy Roboteer
Savvy Roboteer
Posts: 84
Joined: Tue Nov 30, 2010 2:16 pm

Post by Fraser » Wed Jan 19, 2011 10:16 pm

Post by Fraser
Wed Jan 19, 2011 10:16 pm

INFO REQUEST:

Does anyone know the decimal ranges for VOLTAGE and TEMPERATURE in standard AX12 firmware, are they 10bit (0...1023)?

What are the thresholds for underVOLT, overVOLT and overTEMP?

STATUS REPORT:

ATmega8: progmem 25% used, RAM 8% used.

Comms parser and data structures are in place for all the new commands. Now just working out an accurate and fast way to determine present speed in order to implement constant velocity move.
INFO REQUEST:

Does anyone know the decimal ranges for VOLTAGE and TEMPERATURE in standard AX12 firmware, are they 10bit (0...1023)?

What are the thresholds for underVOLT, overVOLT and overTEMP?

STATUS REPORT:

ATmega8: progmem 25% used, RAM 8% used.

Comms parser and data structures are in place for all the new commands. Now just working out an accurate and fast way to determine present speed in order to implement constant velocity move.
Fraser
Savvy Roboteer
Savvy Roboteer
Posts: 84
Joined: Tue Nov 30, 2010 2:16 pm

Post by Fritzoid » Thu Jan 20, 2011 2:14 pm

Post by Fritzoid
Thu Jan 20, 2011 2:14 pm

Fraser,

As far as I can tell...

The control table entries for Current Voltage and Current Temperature along with their Limit values are all 8-bits.

You can set the temperature limit within the range 0-150 (0x00-0x96).
The voltage limits can be set between 50 and 250 (0x32-0xFA) each.

The 10-bit temperature reading from the AD port is converted to an 8-bit temperature value using an internal table.

The AD voltage reading is scaled before being compared to the high and low voltage limits. The scaling factor (13/64) assures that the result will be limited to 8 bits.

I don't think that there's much more to it.
Fraser,

As far as I can tell...

The control table entries for Current Voltage and Current Temperature along with their Limit values are all 8-bits.

You can set the temperature limit within the range 0-150 (0x00-0x96).
The voltage limits can be set between 50 and 250 (0x32-0xFA) each.

The 10-bit temperature reading from the AD port is converted to an 8-bit temperature value using an internal table.

The AD voltage reading is scaled before being compared to the high and low voltage limits. The scaling factor (13/64) assures that the result will be limited to 8 bits.

I don't think that there's much more to it.
Fritzoid
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 331
Joined: Mon Dec 18, 2006 1:00 am

Post by Fraser » Thu Jan 20, 2011 7:17 pm

Post by Fraser
Thu Jan 20, 2011 7:17 pm

Thanks Fritzoid,

I should have looked at the AX12 robotis PDF a little more :oops: doh!

So I'm guessing if I shift the ADC values down to 8 bits then I can simply use the initial thresholds as specifed by robotis:

the Highest Limit Temperature = 85(0x55)
the Lowest Limit Voltage = 60(0X3C)
the Highest Limit Voltage = 190(0xBE)

edit:
I'll check the 10 bit values first, for all I know the sensors might not use the full 10 bit range and so may only need 1 shift or maybe no shift.
Thanks Fritzoid,

I should have looked at the AX12 robotis PDF a little more :oops: doh!

So I'm guessing if I shift the ADC values down to 8 bits then I can simply use the initial thresholds as specifed by robotis:

the Highest Limit Temperature = 85(0x55)
the Lowest Limit Voltage = 60(0X3C)
the Highest Limit Voltage = 190(0xBE)

edit:
I'll check the 10 bit values first, for all I know the sensors might not use the full 10 bit range and so may only need 1 shift or maybe no shift.
Fraser
Savvy Roboteer
Savvy Roboteer
Posts: 84
Joined: Tue Nov 30, 2010 2:16 pm

Post by Fritzoid » Thu Jan 20, 2011 8:26 pm

Post by Fritzoid
Thu Jan 20, 2011 8:26 pm

Hi Fraser,

As mentioned above, the temperature reading is converted into an 8-bit value using an internal table. The conversion is done by table look-up because the temperature sensor (thermistor) does not respond linearly.

Now obviously it's a lot more work to do it by table look-up, so I think Robotis must have had a good reason for doing it that way!
Hi Fraser,

As mentioned above, the temperature reading is converted into an 8-bit value using an internal table. The conversion is done by table look-up because the temperature sensor (thermistor) does not respond linearly.

Now obviously it's a lot more work to do it by table look-up, so I think Robotis must have had a good reason for doing it that way!
Fritzoid
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 331
Joined: Mon Dec 18, 2006 1:00 am

Post by Fraser » Fri Jan 21, 2011 12:14 pm

Post by Fraser
Fri Jan 21, 2011 12:14 pm

Hi Fritzoid, Thanks for that, I must break the habit of not reading every word, I usually do it more very late at night.

All that software work so robotis can save a few cents on the sensor. That would be a big work detour for me and I don't have a suitable thermometer to straighten it all up with.

I supppose adjustable temp threshold is more a luxury than a necessity, I could start out with a more crude: That's too hot... H-bridge disabled until cool down. Just comparing the non linear reading against a preset threshold.

Now the question is how hot does a servo case feel just before robotis firmware disables H-bridge? I will have to try a gentle stall with robotis firmware and use the back of my finger waiting for cut out.

edit:
I can't think of any reason to have adjustable safety limit for temperature, but there must be one.
Hi Fritzoid, Thanks for that, I must break the habit of not reading every word, I usually do it more very late at night.

All that software work so robotis can save a few cents on the sensor. That would be a big work detour for me and I don't have a suitable thermometer to straighten it all up with.

I supppose adjustable temp threshold is more a luxury than a necessity, I could start out with a more crude: That's too hot... H-bridge disabled until cool down. Just comparing the non linear reading against a preset threshold.

Now the question is how hot does a servo case feel just before robotis firmware disables H-bridge? I will have to try a gentle stall with robotis firmware and use the back of my finger waiting for cut out.

edit:
I can't think of any reason to have adjustable safety limit for temperature, but there must be one.
Fraser
Savvy Roboteer
Savvy Roboteer
Posts: 84
Joined: Tue Nov 30, 2010 2:16 pm

Post by SK » Fri Jan 21, 2011 3:33 pm

Post by SK
Fri Jan 21, 2011 3:33 pm

Fraser wrote:edit:
I can't think of any reason to have adjustable safety limit for temperature, but there must be one.

That's quite easy: During testing and development you might not want to overstress servos and let them get too hot. If you have your robot take part in a competition OTOH, you might accept some overheating, because you can't afford a servo shutting down at that point in time.
Fraser wrote:edit:
I can't think of any reason to have adjustable safety limit for temperature, but there must be one.

That's quite easy: During testing and development you might not want to overstress servos and let them get too hot. If you have your robot take part in a competition OTOH, you might accept some overheating, because you can't afford a servo shutting down at that point in time.
SK
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 105
Joined: Mon Jun 26, 2006 1:00 am
Location: near Frankfurt/Main, Germany

Post by Fraser » Fri Jan 21, 2011 11:13 pm

Post by Fraser
Fri Jan 21, 2011 11:13 pm

Thanks SK! that makes sense. I'll put in a set threshold command for voltages and temp and work toward straightening out the temp reading. I've been close to buying one of those red laser non contact thermometers in the past now I have a good excuse :)

edit: I hope when my sons (1 + 3) get older that I can attend some robo comps with them, that would be cool! Perhaps by then there will be some big compos held in europe.
Thanks SK! that makes sense. I'll put in a set threshold command for voltages and temp and work toward straightening out the temp reading. I've been close to buying one of those red laser non contact thermometers in the past now I have a good excuse :)

edit: I hope when my sons (1 + 3) get older that I can attend some robo comps with them, that would be cool! Perhaps by then there will be some big compos held in europe.
Fraser
Savvy Roboteer
Savvy Roboteer
Posts: 84
Joined: Tue Nov 30, 2010 2:16 pm

Post by Fraser » Thu Feb 10, 2011 1:45 am

Post by Fraser
Thu Feb 10, 2011 1:45 am

Firmware dev is on hold due to other coding commitments, but here's a short vid showing some sinusoid based motion using the currently released version of firmware:

phpBB [media]
Firmware dev is on hold due to other coding commitments, but here's a short vid showing some sinusoid based motion using the currently released version of firmware:

phpBB [media]
Fraser
Savvy Roboteer
Savvy Roboteer
Posts: 84
Joined: Tue Nov 30, 2010 2:16 pm

Usb2Dynamixel

Post by MOHIT JINDAL » Sat Feb 12, 2011 6:24 am

Post by MOHIT JINDAL
Sat Feb 12, 2011 6:24 am

Hi Fraser,
Your Axons have 18 .hex files to control 18 Ax12.
How I can link the .hex files to Visual C++ to control Bioloid From Pc using Usb2Dynamixel ?
Thanks. :roll:
Hi Fraser,
Your Axons have 18 .hex files to control 18 Ax12.
How I can link the .hex files to Visual C++ to control Bioloid From Pc using Usb2Dynamixel ?
Thanks. :roll:
MOHIT JINDAL
Savvy Roboteer
Savvy Roboteer
Posts: 178
Joined: Wed Nov 10, 2010 7:43 am

Re: Usb2Dynamixel

Post by Fraser » Tue Feb 15, 2011 2:34 pm

Post by Fraser
Tue Feb 15, 2011 2:34 pm

MOHIT JINDAL wrote:Hi Fraser,
Your Axons have 18 .hex files to control 18 Ax12.
How I can link the .hex files to Visual C++ to control Bioloid From Pc using Usb2Dynamixel ?
Thanks. :roll:


Hi,

I think you should start with robotis dynamixel SDK first and use the synch write command to control all of your servos.

But if you want to experiment then try this:

You program the servos with the HEX files. And then you send out packets from the PC to control the servos PWM.

Remove one servo from your robot and program it with HEX file 1 from the Axons zipfile. The readme.pdf tells you how to program the servo.

Connect it to your PC using usb2dynamixel.

From your PC send out a PWM packet to this one servo.

The format of the PWM packet is detailed in the readme.pdf included with the Axons zipfile.

I posted some code for Miguel earlier in this thread that includes everything you need to send and receive packets from Axons.

Do not try and install Axons on a humanoid robot until you are familiar with how it works, it is quite easy to cut your finger or damage cables if the robot goes crazy.
MOHIT JINDAL wrote:Hi Fraser,
Your Axons have 18 .hex files to control 18 Ax12.
How I can link the .hex files to Visual C++ to control Bioloid From Pc using Usb2Dynamixel ?
Thanks. :roll:


Hi,

I think you should start with robotis dynamixel SDK first and use the synch write command to control all of your servos.

But if you want to experiment then try this:

You program the servos with the HEX files. And then you send out packets from the PC to control the servos PWM.

Remove one servo from your robot and program it with HEX file 1 from the Axons zipfile. The readme.pdf tells you how to program the servo.

Connect it to your PC using usb2dynamixel.

From your PC send out a PWM packet to this one servo.

The format of the PWM packet is detailed in the readme.pdf included with the Axons zipfile.

I posted some code for Miguel earlier in this thread that includes everything you need to send and receive packets from Axons.

Do not try and install Axons on a humanoid robot until you are familiar with how it works, it is quite easy to cut your finger or damage cables if the robot goes crazy.
Fraser
Savvy Roboteer
Savvy Roboteer
Posts: 84
Joined: Tue Nov 30, 2010 2:16 pm

Dynamixel Synchronization Control

Post by MOHIT JINDAL » Wed Feb 16, 2011 9:27 am

Post by MOHIT JINDAL
Wed Feb 16, 2011 9:27 am

Thanks Fraser;

Can you tell me which function in Dynamixel SDK is used to actually move the AX12 Dynamixels ?

Code: Select all
for( i=0; i<NUM_ACTUATOR; i++ )

{

id[i] = i+1;

phase[i] = 2*PI * (float)i / (float)NUM_ACTUATOR;

}

// Set goal speed

dxl_write_word( BROADCAST_ID, P_GOAL_SPEED_L, 0 );

// Set goal position

dxl_write_word( BROADCAST_ID, P_GOAL_POSITION_L, AmpPos );

_delay_ms(1000);


And in which format the task code and MTN files are loaded in CM510 ?
Are they loaded in HEX files in AVR256 or same .TSK and .MTN ?

Thanks. :) [/code]
Thanks Fraser;

Can you tell me which function in Dynamixel SDK is used to actually move the AX12 Dynamixels ?

Code: Select all
for( i=0; i<NUM_ACTUATOR; i++ )

{

id[i] = i+1;

phase[i] = 2*PI * (float)i / (float)NUM_ACTUATOR;

}

// Set goal speed

dxl_write_word( BROADCAST_ID, P_GOAL_SPEED_L, 0 );

// Set goal position

dxl_write_word( BROADCAST_ID, P_GOAL_POSITION_L, AmpPos );

_delay_ms(1000);


And in which format the task code and MTN files are loaded in CM510 ?
Are they loaded in HEX files in AVR256 or same .TSK and .MTN ?

Thanks. :) [/code]
MOHIT JINDAL
Savvy Roboteer
Savvy Roboteer
Posts: 178
Joined: Wed Nov 10, 2010 7:43 am

PreviousNext
61 postsPage 4 of 51, 2, 3, 4, 5
61 postsPage 4 of 51, 2, 3, 4, 5