This is the Dynamixel motor control code with Dynamixel2Arduino API on RTOS system.
It consist of 2 thread, serial-write & serial-read.
You can publish the command with arguments as string, and subscribe the motor states from OpenRB-150.
-
MCU : OpenRB-150
-
Arduino IDE (2.3.2)
-
Library
Dynamixel2Arduino (0.7.0)
FreeRTOS_SAMD21 (2.3.0)
- STX → '/'
- CTX → ';'
- split → ','
- Substances
- Read (PC to MCU) : Function name and its arguments
- Write (MCU to PC) : motor state
(/ID, hardware_error, Moving, PresentPosition, PresentVelocity, PresentCurrent;)
-
Serial Write
MCU(OpenRB-150) send the motor states by serial-communication
- Normal mode - using
readControlTableItem()
from Dynamixel2Arduino API. - Sync mode - using
SyncRead()
from Dynamixel2Arduino API.
- Normal mode - using
-
Serial Read
MCU(OpenRB-150) receive the protocol by serial-communication
- Normal mode & Sync mode are the same
- You can send command one by one, or send tehm all at once(syncWrite()).
Serial read
use Dynamixel2Arduino class member function (using readControlTableItem API)
- RTOS_readControlTableItem.ino
- definition.hpp
https://emanual.robotis.com/docs/en/parts/controller/openrb-150/
Serial read
use Dynamixel2Arduino Master class member > function
Sync mode (read)
Fast Sync mode (read)
Sync mode (read & write)
Fast Sync mode (read & write)
- RTOS_sync_read.ino
- definition.hpp
- control_table.hpp
https://emanual.robotis.com/docs/en/parts/controller/openrb-150/
-
Form
/motor_id, errcode, MOVING, PresentPosition(degree), PresentVelocity, PresentCurrent;→ e.g. /1,0,0,87.912003,0.000000,0.000000;
-
Form
/Function name(Dynamixel2Arduino), arg1, arg2, ...;
-
Dynamixel2Arduino API
-
Other custom function
-
When running DYNAMIXEL without DYNAMIXEL Shields on OpenCM9.04, OpenCR or custom boards, you might need to change the Serial and DYNAMIXEL Direction Pin.
-
We provide the information below to make it easier to define Serial and Direction pins for specific hardware.
Board Name Serial Direction Pin Note OpenCM9.04 Serial1 28 Uploading Arduino Sketch will erase the factory firmware. The firmware can be recovered with DYNAMIXEL Wizard 2.0 OpenCM485EXP Serial3 22 OpenCR Serial3 84 OpenCR has an FET switch to control power supply to DYNAMIXEL. (Reference link) OpenRB-150 Serial1 (-1)Automatic -
- For the convenience of the user, Dynamixel2Arduino API hardcodes some information in the control table and stores it in flash.
- To do this, you need to add code to some files. In this regard, please refer to PR#3 and PR#7
- Please refer to port_handler.h
- Create a new class by inheriting PortHandler as public. (Like SerialPortHandler and USBSerialPortHandler)