ROBOTIS-GIT / Dynamixel2Arduino

DYNAMIXEL protocol library for Arduino
Apache License 2.0
88 stars 55 forks source link

ControlTableItem not pointing to the right adress in EEPROM for AX-12A motors #120

Closed etiennemontenegro closed 1 year ago

etiennemontenegro commented 1 year ago

I've been trying to dynamically change between wheel mode and joint mode for a couple days without success and looking through the library i noticed that when i call :

dxl.setOperatingMode(id, OP_POSITION)

the function writes to the wrong addresses in the EEPROM. It writes to 10 and 11 and should write to 6 and 8 on both these lines:

https://github.com/ROBOTIS-GIT/Dynamixel2Arduino/blob/3a54c46425e6076eeb708ec2e7786d8478092951/src/Dynamixel2Arduino.cpp#L595-L596

pointing to actuator.h : https://github.com/ROBOTIS-GIT/Dynamixel2Arduino/blob/3a54c46425e6076eeb708ec2e7786d8478092951/src/actuator.h#L268-L269

I saw in actuator.cpp that there is the old control table for the AX-12A with the right addresses : https://github.com/ROBOTIS-GIT/Dynamixel2Arduino/blob/3a54c46425e6076eeb708ec2e7786d8478092951/src/actuator.cpp#L15-L55

Is there a way to replace the control table in actuator.h with this one during the sketch initialisation so i can use the higer level functions of the library like dxl.setOperatingMode(id, OP_POSITION) ???

Thanks for your help.

etiennemontenegro commented 1 year ago

Looking a bit deeper in the code, there is a writeControlTableItem() function that takes the model of the motor as argument to change the controlTableItem to the right number for the model passed in argument to the function