Dynamixelモータ(Protocol2.0)のセットアップ - Qiita
Specification
Model Name | XL330-M288-T | |
---|---|---|
MCU | Cortex-M0+ (64 [MHz], 32bit) | |
Input Voltage | Min. [V] | 3.7 |
Recommended [V] | 5.0 | |
Max. [V] | 6.0 | |
Performance Characteristics | Voltage [V] | 5.0 |
Stall Torque [N·m] | 0.52 | |
Stall Current [A] | 1.5 | |
No Load Speed [rpm] | 104.0 | |
No Load Current [A] | 0.15 | |
Continuous Operation | Voltage [V] | - |
Torque [N·m] | - | |
Speed [rpm] | - | |
Current [A] | - | |
Resolution | Resolution [deg/pulse] | 0.0879 |
Step [pulse] | 4 | |
Angle [degree] | 360 | |
Position Sensor | Contactless absolute encoder (12Bit, 360 [deg]) Maker : ams(www.ams.com), Part No : AS5601 | |
Operating Temperature | Min. [°C] | -5 |
Max. [°C] | 60 | |
Motor | Cored | |
Baud Rate | Min. [bps] | 9,600 |
Max. [bps] | 4,500,000 | |
Control Algorithm | PID | |
Gear Type | Spur | |
Gear Material | Engineering Plastic | |
Case Material | Engineering Plastic | |
Dimensions (WⅹHⅹD) [mm] | 20 X 34 X 26 | |
Dimensions (WⅹHⅹD) [inch] | 0.78 X 1.33 X 1.02 | |
Weight [g] | 0.00 | |
Weight [oz] | 0.63 | |
Gear Ratio | 288.4 : 1 | |
Command Signal | Digital Packet | |
Protocol Type | Half duplex Asynchronous Serial Communication (8bit, 1stop, No Parity) | |
Link (Physical) | TTL Level Multi Drop Bus | |
ID | 0 ~ 252 | |
Feedback | Position, Velocity, Load, Realtime tick, Trajectory, Temperature, Input Voltage, etc | |
Protocol version | Protocol 2.0 | |
Operating Mode / Angle | Current Control mode:Endless turn Velocity Control mode:Endless turn Position Control Mode:360 [deg] Extended Position Control Mode:±256 [rev] Current-based Position Control Mode:±256 [rev] PWM Control Mode:Endless turn | |
Output [W] | - | |
Standby Current [mA] | 15 |
GitHub - kim-xps12/m5stack_board_dynamixel_ttl_rs3485
テストコード
#include <M5Core2.h>
#include <Dynamixel2Arduino.h>
#define DEBUG_SERIAL Serial
HardwareSerial& DXL_SERIAL = Serial1;
Dynamixel2Arduino dxl;
// M5Stack Core2 PORT A
const uint8_t RX_SERVO = 32;
const uint8_t TX_SERVO = 33;
const uint8_t DXL_ID = 1;
const float DXL_PROTOCOL_VERSION = 2.0;
void setup()
{
//M5設定
M5.begin(true, true, true, false);
M5.Lcd.fillScreen(BLACK); // 画面の塗りつぶし
M5.Lcd.setCursor(0, 0); // 文字列の書き出し位置
M5.Lcd.setTextSize(2); // 文字サイズを設定
//dynamixel 設定
DXL_SERIAL.begin(57600, SERIAL_8N1, RX_SERVO, TX_SERVO);
dxl = Dynamixel2Arduino(DXL_SERIAL);
dxl.begin(57600);
dxl.setPortProtocolVersion(DXL_PROTOCOL_VERSION);
dxl.ping(DXL_ID);
dxl.torqueOff(DXL_ID);
dxl.setOperatingMode(DXL_ID, OP_VELOCITY);
dxl.torqueOn(DXL_ID);
}
void loop()
{
M5.update();
// Set Goal Velocity using RPM
static bool rev = false;
static int count = 0;
dxl.setGoalVelocity(DXL_ID, 60*(!rev)-60*rev, UNIT_RPM);
M5.Lcd.setCursor(0, 0);
M5.Lcd.printf("Velocity(rpm) : %.2f,%d", dxl.getPresentVelocity(DXL_ID, UNIT_RPM),count);
if(count > 100)
{
count = 0;
rev = !rev;
}
count++;
}