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

libavr/libbioloid C library for CM5 released!

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
289 postsPage 8 of 201 ... 5, 6, 7, 8, 9, 10, 11 ... 20
289 postsPage 8 of 201 ... 5, 6, 7, 8, 9, 10, 11 ... 20

Post by anjocama » Mon Mar 23, 2009 11:15 am

Post by anjocama
Mon Mar 23, 2009 11:15 am

I bought the IMU board only a few days.
I bought the IMU board only a few days.
anjocama
Savvy Roboteer
Savvy Roboteer
Posts: 36
Joined: Wed Jan 14, 2009 10:53 am

Post by anjocama » Mon Mar 23, 2009 2:59 pm

Post by anjocama
Mon Mar 23, 2009 2:59 pm

Hi RandomMatt & StuartL,

I am using your example library code for show the values of ADXL330 with the HUV IMU but i am not sure that returned values are correct. Can you help me? :D

for (int i = 0; i < HZ; i++) {
dx_get_huv_imu(120, &imu);
printf("x: %d y: %d z: %d\n", imu.accel.x, imu.accel.y, imu.accel.z);
timer_delay(7);
}
Hi RandomMatt & StuartL,

I am using your example library code for show the values of ADXL330 with the HUV IMU but i am not sure that returned values are correct. Can you help me? :D

for (int i = 0; i < HZ; i++) {
dx_get_huv_imu(120, &imu);
printf("x: %d y: %d z: %d\n", imu.accel.x, imu.accel.y, imu.accel.z);
timer_delay(7);
}
anjocama
Savvy Roboteer
Savvy Roboteer
Posts: 36
Joined: Wed Jan 14, 2009 10:53 am

Post by RandomMatt » Mon Mar 23, 2009 7:42 pm

Post by RandomMatt
Mon Mar 23, 2009 7:42 pm

possibly... I'm afraid i don't have much information to go on - so i shall guess wildly!


First thing: that code fragment looks sensible. you might want to also display .rate.x / .y / .z as well - it is possible that your thinggy is wired to the wrong pins (not that it matters - they are all just wired to adcs!)


Second thing: does dx_get_HUV_IMU_accel_X(120) return sensible values?(same question for Y and Z axis and _rate_*)? If not - then it suggests a hardware problem of some sort.

if you wanted to, you could just use the 'm' command in the supervisor to display the memory of the imu - this might be easier than playing with dx_get_*()


Third thing: dx_get_huv_imu() makes use of the calibration structure. Are you sure you have sensible values in it? For what it is worth, the code uses an exponential moving average - if you don't want this, set .alpha to 256.

The description of the filter is in dynamixel.h (line 81 - 83). You'll notice that you also need to be careful about the values you choose for .m and .c


Other than that - I'm afraid I'll need more information before I can think of what could have gone wrong.
possibly... I'm afraid i don't have much information to go on - so i shall guess wildly!


First thing: that code fragment looks sensible. you might want to also display .rate.x / .y / .z as well - it is possible that your thinggy is wired to the wrong pins (not that it matters - they are all just wired to adcs!)


Second thing: does dx_get_HUV_IMU_accel_X(120) return sensible values?(same question for Y and Z axis and _rate_*)? If not - then it suggests a hardware problem of some sort.

if you wanted to, you could just use the 'm' command in the supervisor to display the memory of the imu - this might be easier than playing with dx_get_*()


Third thing: dx_get_huv_imu() makes use of the calibration structure. Are you sure you have sensible values in it? For what it is worth, the code uses an exponential moving average - if you don't want this, set .alpha to 256.

The description of the filter is in dynamixel.h (line 81 - 83). You'll notice that you also need to be careful about the values you choose for .m and .c


Other than that - I'm afraid I'll need more information before I can think of what could have gone wrong.
RandomMatt
Savvy Roboteer
Savvy Roboteer
Posts: 117
Joined: Sat Dec 20, 2008 11:16 pm

Post by anjocama » Tue Mar 24, 2009 11:53 pm

Post by anjocama
Tue Mar 24, 2009 11:53 pm

Ok. Thanks,

I will do more tests about this and then tell you more info
Ok. Thanks,

I will do more tests about this and then tell you more info
anjocama
Savvy Roboteer
Savvy Roboteer
Posts: 36
Joined: Wed Jan 14, 2009 10:53 am

Post by tito_veneno » Thu May 07, 2009 11:22 pm

Post by tito_veneno
Thu May 07, 2009 11:22 pm

Hey everybody!

I just bought a bioloid kit and really want to program it using the libbioloid..

However, I'm trying to run the example.c code that comes with the library, and I keep getting back this error, which I can't figure out how to fix:

Code: Select all
..libavr/flash.h:35: undefined reference to `trig_cos'

I get a bunch of other warnings just like that one...

I am currently using the AVR Studio to compile it and create the make file.

I appreciate any help! Thanks guys!
Hey everybody!

I just bought a bioloid kit and really want to program it using the libbioloid..

However, I'm trying to run the example.c code that comes with the library, and I keep getting back this error, which I can't figure out how to fix:

Code: Select all
..libavr/flash.h:35: undefined reference to `trig_cos'

I get a bunch of other warnings just like that one...

I am currently using the AVR Studio to compile it and create the make file.

I appreciate any help! Thanks guys!
tito_veneno
Robot Builder
Robot Builder
Posts: 7
Joined: Thu May 07, 2009 11:17 pm

Post by tito_veneno » Mon May 11, 2009 5:54 pm

Post by tito_veneno
Mon May 11, 2009 5:54 pm

hey Matt and StuartL

I figured out why it wasn't working. I didn't have gcc installed.

One more question though, is there a way to set the AX-12 servos to the mode "endless turn" so they can be used as a wheel??

Thank you for your help!
hey Matt and StuartL

I figured out why it wasn't working. I didn't have gcc installed.

One more question though, is there a way to set the AX-12 servos to the mode "endless turn" so they can be used as a wheel??

Thank you for your help!
tito_veneno
Robot Builder
Robot Builder
Posts: 7
Joined: Thu May 07, 2009 11:17 pm

Post by RandomMatt » Mon May 11, 2009 8:39 pm

Post by RandomMatt
Mon May 11, 2009 8:39 pm

Reading page 17 of the AX12 manual...
If both values for the CW Angle Limit and the CCW Angle Limit are set to 0, an Endless Turn mode can be implemented by setting the Goal Speed.


So, assuming you have set id, dir and speed to the desired values...
Code: Select all
dx_set_minmax_angle(id, SERVO_MIN, SERVO_MIN);
uint16_t value = (dir ? 0x400 : 0x000) + speed;
dx_write(id, A_goal_speed, 2, &value);



Note... untested code as i'm not near a robot. And come to thing of it I should implement a dx_set_speed() function... I'll add it to the todo list.
Reading page 17 of the AX12 manual...
If both values for the CW Angle Limit and the CCW Angle Limit are set to 0, an Endless Turn mode can be implemented by setting the Goal Speed.


So, assuming you have set id, dir and speed to the desired values...
Code: Select all
dx_set_minmax_angle(id, SERVO_MIN, SERVO_MIN);
uint16_t value = (dir ? 0x400 : 0x000) + speed;
dx_write(id, A_goal_speed, 2, &value);



Note... untested code as i'm not near a robot. And come to thing of it I should implement a dx_set_speed() function... I'll add it to the todo list.
RandomMatt
Savvy Roboteer
Savvy Roboteer
Posts: 117
Joined: Sat Dec 20, 2008 11:16 pm

Post by tito_veneno » Tue May 12, 2009 8:24 pm

Post by tito_veneno
Tue May 12, 2009 8:24 pm

Perfect! thanks a lot.. i'm going to test it right now!

Thanks again!
Perfect! thanks a lot.. i'm going to test it right now!

Thanks again!
tito_veneno
Robot Builder
Robot Builder
Posts: 7
Joined: Thu May 07, 2009 11:17 pm

Post by tito_veneno » Fri May 15, 2009 9:29 pm

Post by tito_veneno
Fri May 15, 2009 9:29 pm

Hey guys,

I'm trying to implement a function that uses the function to raise a certain number to a power, pow(a, b), so i need to include the math.h header file. I am using it to convert the sensor readings I get from AX-S1 into centimeter values.

However, when I include the math.h I get an bunch of errors like

Code: Select all
/../avr/include/math.h:103: error: conflicting types for 'trig_cosf'

bioloid/trig.h:43: error: previous declaration of 'trig_cosf' was here



Do you know of any way to fix this? Thank you
Hey guys,

I'm trying to implement a function that uses the function to raise a certain number to a power, pow(a, b), so i need to include the math.h header file. I am using it to convert the sensor readings I get from AX-S1 into centimeter values.

However, when I include the math.h I get an bunch of errors like

Code: Select all
/../avr/include/math.h:103: error: conflicting types for 'trig_cosf'

bioloid/trig.h:43: error: previous declaration of 'trig_cosf' was here



Do you know of any way to fix this? Thank you
tito_veneno
Robot Builder
Robot Builder
Posts: 7
Joined: Thu May 07, 2009 11:17 pm

Post by StuartL » Sat May 16, 2009 9:26 am

Post by StuartL
Sat May 16, 2009 9:26 am

Your math.h will include sines and cosines which you REALLY don't want to use. Either you write a pow() function yourself or you bodge the header files so that the libbioloid sin(), cos() etc from trig.h no longer conflicts with the avr math.h.

I suggest you google for a fast embedded pow() function and implement that in one of your sources.
Your math.h will include sines and cosines which you REALLY don't want to use. Either you write a pow() function yourself or you bodge the header files so that the libbioloid sin(), cos() etc from trig.h no longer conflicts with the avr math.h.

I suggest you google for a fast embedded pow() function and implement that in one of your sources.
StuartL
Savvy Roboteer
Savvy Roboteer
Posts: 350
Joined: Mon Jun 04, 2007 3:46 pm
Location: Thatcham, Berkshire, UK

Post by wingzerox8 » Thu May 21, 2009 1:17 am

Post by wingzerox8
Thu May 21, 2009 1:17 am

hi, i've been trying to work with the libraries for a project and so far i've tried the example.c and the libraries and they're working very well. However, since i'm not very efficient in C coding, i was wondering if someone can elaborate a bit more on the humanloid walking algorithm and the AX-S1 sensor readings. I've tried to studied the codes posted here, and i've attempted to analyze the code and worked with it, but so far i haven't had much success.

For example:

i've tried to do uint8_t *data = dx_read(100, P_IRDATA_L, 3); , but i'm not really sure of the P_IRDATA_L part.

and i've also tried the
DX_RAM(26, 8, R, IR_data_left);
DX_RAM(27, 8, R, IR_data_center);
DX_RAM(28, 8, R, IR_data_right);

but i'm getting errors. I could really use some help regarding some of these points, thank you.
hi, i've been trying to work with the libraries for a project and so far i've tried the example.c and the libraries and they're working very well. However, since i'm not very efficient in C coding, i was wondering if someone can elaborate a bit more on the humanloid walking algorithm and the AX-S1 sensor readings. I've tried to studied the codes posted here, and i've attempted to analyze the code and worked with it, but so far i haven't had much success.

For example:

i've tried to do uint8_t *data = dx_read(100, P_IRDATA_L, 3); , but i'm not really sure of the P_IRDATA_L part.

and i've also tried the
DX_RAM(26, 8, R, IR_data_left);
DX_RAM(27, 8, R, IR_data_center);
DX_RAM(28, 8, R, IR_data_right);

but i'm getting errors. I could really use some help regarding some of these points, thank you.
wingzerox8
Newbie
Newbie
Posts: 2
Joined: Thu May 21, 2009 12:59 am

Post by RandomMatt » Thu May 21, 2009 1:10 pm

Post by RandomMatt
Thu May 21, 2009 1:10 pm

wingzerox8 wrote:However, since i'm not very efficient in C coding, i was wondering if someone can elaborate a bit more on the humanloid walking algorithm and the AX-S1 sensor readings.


The humanoid walking is 'simply' playing a selection of stances at the correct rate. You can use dx_get_stance() to help - i.e. manually position the robot and then get the code to tell you all the servo positions.

For the AX-S1, I need to write some better documentation(*). In the meantime try something like:
Code: Select all
uint8_t value = dx_get_IR_data_left(id);


* - The documentation is currently the single comment at the top of dynamixel_memory.h. And, yes, it is a bit cryptic. Basically each DX_RAM line defines a dx_get_*() and a dx_set_*() function - the * is replaced by the 4th argument in the DX_RAM() macro.
wingzerox8 wrote:However, since i'm not very efficient in C coding, i was wondering if someone can elaborate a bit more on the humanloid walking algorithm and the AX-S1 sensor readings.


The humanoid walking is 'simply' playing a selection of stances at the correct rate. You can use dx_get_stance() to help - i.e. manually position the robot and then get the code to tell you all the servo positions.

For the AX-S1, I need to write some better documentation(*). In the meantime try something like:
Code: Select all
uint8_t value = dx_get_IR_data_left(id);


* - The documentation is currently the single comment at the top of dynamixel_memory.h. And, yes, it is a bit cryptic. Basically each DX_RAM line defines a dx_get_*() and a dx_set_*() function - the * is replaced by the 4th argument in the DX_RAM() macro.
RandomMatt
Savvy Roboteer
Savvy Roboteer
Posts: 117
Joined: Sat Dec 20, 2008 11:16 pm

Post by wingzerox8 » Wed May 27, 2009 11:32 pm

Post by wingzerox8
Wed May 27, 2009 11:32 pm

ty for the help with the ir code. However i still cannot get the dx_get_stance to work, since there doesn't seem to be any output when i press 'g' on the example.c. It seems to just exit/pause the program when i do so. I've been trying to do it the long way but checking each servo position by printf. Does dx_set_stance work the same way, in that i can set the positions of the servos then running dx_set_stance?

Also, for the battery charging, the default way to charge before was plugging in charger, then turn on, then press up i think... but with these new C libraries how do i go about charging? when i looked at the supervisor settings, under battery settings i noticed that the charger is off. Will it charge by itself if i have the charger plugged in eventually? or do i have to battery_enablecharger(1) somewhere to enable?

Also last question, for:
angle_t knee_angle = - A90 + flash_read16(&android_leg_ABC[hyp]) - 33; // 33 == angle offset for weird knee joint alignment
angle_t thigh_angle = -atan2(target.y, -target.z) - flash_read16(&android_leg_ACB[hyp]) - 33; // As above

what do the android_leg_ABC and android_leg_ACB represent? what does the ABC and ACB represent?
ty for the help with the ir code. However i still cannot get the dx_get_stance to work, since there doesn't seem to be any output when i press 'g' on the example.c. It seems to just exit/pause the program when i do so. I've been trying to do it the long way but checking each servo position by printf. Does dx_set_stance work the same way, in that i can set the positions of the servos then running dx_set_stance?

Also, for the battery charging, the default way to charge before was plugging in charger, then turn on, then press up i think... but with these new C libraries how do i go about charging? when i looked at the supervisor settings, under battery settings i noticed that the charger is off. Will it charge by itself if i have the charger plugged in eventually? or do i have to battery_enablecharger(1) somewhere to enable?

Also last question, for:
angle_t knee_angle = - A90 + flash_read16(&android_leg_ABC[hyp]) - 33; // 33 == angle offset for weird knee joint alignment
angle_t thigh_angle = -atan2(target.y, -target.z) - flash_read16(&android_leg_ACB[hyp]) - 33; // As above

what do the android_leg_ABC and android_leg_ACB represent? what does the ABC and ACB represent?
wingzerox8
Newbie
Newbie
Posts: 2
Joined: Thu May 21, 2009 12:59 am

Post by RandomMatt » Thu May 28, 2009 7:54 am

Post by RandomMatt
Thu May 28, 2009 7:54 am

interesting... when you press 'g' it should carry on working. Have you edited
the const robot FLASH robot structure? Do you have servos 1 and 2 both connected? What happens if you use the i of m commands in the supervisor (press '~' to get to it).


To give you an idea as to how it should work:
* press '<' to switch the servos off (i.e. no torque)
* move the servos (this will have no effect on the output of example.c)
* press 'g' (this will cause the output of the example.c to match the servo positions)
* press '>' to switch the servos back on (now they'll try to maintain the position you put them in).

---

The battery is easier to answer: assuming you have an original robotis battery you need to be careful (they are very poor battery packs, i've set fire to one). Therefore the default code doesn't ever charge the battery. I'd recommend that you invest in a decent 3 cell LiPo and charger and get rid of the robotis NiCad pack.

If you're not afraid of the consequences you can get the code to automatically do everything for you with the robotis pack: just update the MV_* constants in libbioloid/bioloid/battery.h

MV_FLASH is the (milli)volt level below which the power light will flash
MV_CHARGE is the (milli)volt level below which the battery charger is switched on
MV_STOP is the (milli)volt level below which the robot will reset

At the moment MV_CHARGE and MV_STOP are equal - so the battery is never charged, the robot just resets instead.
If you make MV_CHARGE equal to MV_FLASH then the battery will start to charge when the led flashes. it'll stop charging when you either reset the robot or the battery voltage hasn't increased for a while.

And if you do this: don't leave the robot unattended - the battery pack could catch fire!
interesting... when you press 'g' it should carry on working. Have you edited
the const robot FLASH robot structure? Do you have servos 1 and 2 both connected? What happens if you use the i of m commands in the supervisor (press '~' to get to it).


To give you an idea as to how it should work:
* press '<' to switch the servos off (i.e. no torque)
* move the servos (this will have no effect on the output of example.c)
* press 'g' (this will cause the output of the example.c to match the servo positions)
* press '>' to switch the servos back on (now they'll try to maintain the position you put them in).

---

The battery is easier to answer: assuming you have an original robotis battery you need to be careful (they are very poor battery packs, i've set fire to one). Therefore the default code doesn't ever charge the battery. I'd recommend that you invest in a decent 3 cell LiPo and charger and get rid of the robotis NiCad pack.

If you're not afraid of the consequences you can get the code to automatically do everything for you with the robotis pack: just update the MV_* constants in libbioloid/bioloid/battery.h

MV_FLASH is the (milli)volt level below which the power light will flash
MV_CHARGE is the (milli)volt level below which the battery charger is switched on
MV_STOP is the (milli)volt level below which the robot will reset

At the moment MV_CHARGE and MV_STOP are equal - so the battery is never charged, the robot just resets instead.
If you make MV_CHARGE equal to MV_FLASH then the battery will start to charge when the led flashes. it'll stop charging when you either reset the robot or the battery voltage hasn't increased for a while.

And if you do this: don't leave the robot unattended - the battery pack could catch fire!
RandomMatt
Savvy Roboteer
Savvy Roboteer
Posts: 117
Joined: Sat Dec 20, 2008 11:16 pm

Post by RandomMatt » Fri Jun 12, 2009 1:34 pm

Post by RandomMatt
Fri Jun 12, 2009 1:34 pm

I've recently found and fixed a possible crash. I'd suggest that you all upgrade to libbioloid rev1225 or newer.

The cause of the crash was a race condition, and therefore you could be lucky enough not to see it.

--

The other two advantages of upgrading are:
* smaller compiled code size
* some documentation - although it is still in a very poor state
I've recently found and fixed a possible crash. I'd suggest that you all upgrade to libbioloid rev1225 or newer.

The cause of the crash was a race condition, and therefore you could be lucky enough not to see it.

--

The other two advantages of upgrading are:
* smaller compiled code size
* some documentation - although it is still in a very poor state
RandomMatt
Savvy Roboteer
Savvy Roboteer
Posts: 117
Joined: Sat Dec 20, 2008 11:16 pm

PreviousNext
289 postsPage 8 of 201 ... 5, 6, 7, 8, 9, 10, 11 ... 20
289 postsPage 8 of 201 ... 5, 6, 7, 8, 9, 10, 11 ... 20