Interfacing with the Dongbu HerkuleX servo motor
in
Integration and Hardware
•
5 months ago
I'm trying to control a DRS-0101 servo. It connects through a little serial breakout board to a pc, and required a specific type of byte-protocol for it's communication. There's already an arduino library for it, but since I'm planning a setup with a lot of servo's I would prefer direct control via the pc. Anyone who has tried this before?
I have a processing sketch in which I tried to rewrite the Arduino library, but I got stuck at the communication protocol structure. It shouldn't be impossible, as someone points out here:
http://botscene.net/2012/10/20/getting-started-with-the-herkulex-drs-0101/. Here is a link to the manual that describes the protocol:
http://hovis.co.kr/guide/herkulexeng.pdf
And here is an excerpt from the library that shows how they package a command to send it to the servo over serial.
- void CHerkuleX::torqueOn(uint8_t id)
- {
- send_buf[0] = 0xFF; // Packet Header
- send_buf[1] = 0xFF;
- send_buf[2] = 0x0A; // Packet Size
- send_buf[3] = id; // Servo ID
- send_buf[4] = DR_SERVO_CMD_RAM_WRITE; // Command Ram Write
- send_buf[7] = 0x34; // Address 52
- send_buf[8] = 0x01; // Length
- send_buf[9] = 0x60; // Torque ON
- send_buf[5] = (send_buf[2]^send_buf[3]^send_buf[4]^send_buf[7]^send_buf[8]^send_buf[9]) & 0xFE;
- send_buf[6] = (~send_buf[5])&0xFE;
- send(send_buf, 10);
- }
Send function
- void CHerkuleX::send(byte* buf, uint8_t size)
- {
- Serial3.write(buf, size);
- }
Anyone who can give me some advice? I can also post my earlier attempt if needed.
2