HerkuleXLib  1.1
Arduino library to drive HerkuleX DRS-0101 and DRS-0201
Classes | Enumerations | Variables
/home/benoit/sketchbook/libraries/HerkuleXLib/HkxCommunication.h File Reference

Communication management of the Arduino library for HerkuleX servo (DRS-0101 and DRS-0201 models) More...

#include "Arduino.h"
#include "HkxStatus.h"

Go to the source code of this file.

Classes

class  HkxMaybe< T >
 Class to manage optional parameters. More...
 
class  HkxPrint
 Class to manage the print of the messages. More...
 
class  HkxUnitConversion
 Class to manage unit conversions. More...
 
class  HkxCommunication
 Class to manage the communication. More...
 

Enumerations

enum  hkxCommand : uint8_t {
  HKX_CMD_ROM_WRITE = 0x01, HKX_CMD_ROM_READ = 0x02, HKX_CMD_RAM_WRITE = 0x03, HKX_CMD_RAM_READ = 0x04,
  HKX_CMD_I_JOG = 0x05, HKX_CMD_S_JOG = 0x06, HKX_CMD_STAT = 0x07, HKX_CMD_ROLLBACK = 0x08,
  HKX_CMD_REBOOT = 0x09
}
 Available commands. More...
 
enum  hkxMemory : bool { HKX_ROM = 0, HKX_RAM = 1 }
 Memory type. More...
 
enum  hkxBaudrate : uint32_t {
  HKX_57600 = 57600, HKX_115200 = 115200, HKX_200000 = 200000, HKX_250000 = 250000,
  HKX_400000 = 400000, HKX_500000 = 500000, HKX_666666 = 666666
}
 Baud rate. More...
 
enum  hkxTorqueControl : uint8_t { HKX_TORQUE_FREE = 0x00, HKX_TORQUE_BREAK = 0x40, HKX_TORQUE_ON = 0x60 }
 Torque control. More...
 
enum  hkxLEDControl : uint8_t {
  HKX_LED_OFF = 0x00, HKX_LED_GREEN = 0x01, HKX_LED_BLUE = 0x02, HKX_LED_RED = 0x04,
  HKX_LED_CYAN = 0x03, HKX_LED_YELLOW = 0x05, HKX_LED_PINK = 0x06, HKX_LED_WHITE = 0x07
}
 LED control. More...
 
enum  hkxControlMode : uint8_t { HKX_CTRL_POSITION = 0x00, HKX_CTRL_ROTATION = 0x01 }
 Control mode. More...
 
enum  hkxMaybeHasNoValue : bool { HKX_NO_VALUE }
 No value. More...
 

Variables

const bool HKX_DEV = true
 
const uint8_t HKX_WAIT_TIME = 10
 
const uint8_t HKX_NUMBER_SEND_TRIALS = 5
 
const uint8_t HKX_NUMBER_CONNECT_TRIALS = 2
 
const uint8_t HKX_SERIAL_BUFFER = 64
 
const uint8_t HKX_MAX_ID = 0xFD
 
const uint8_t HKX_ID_ALL = 0xFE
 
const uint8_t HKX_MAX_POLICY = 0x7F
 
const uint8_t HKX_MAX_TEMPERATURE = 0xFE
 
const uint8_t HKX_MAX_VOLTAGE = 0xFE
 
const uint8_t HKX_MAX_ACCELERATION_RATIO = 50
 
const uint8_t HKX_MAX_TIME = 0xFE
 
const uint8_t HKX_MAX_POSITIONNING = 0xFE
 
const uint8_t HKX_MAX_SATURATOR_OFFSET = 0xFE
 
const uint8_t HKX_MAX_MIN_PWM = 0xFE
 
const uint16_t HKX_MAX_PWM = 0x3FF
 
const uint16_t HKX_MAX_POSITION = 0x3FF
 
const uint16_t HKX_MAX_CONTROL_PARAM = 0x7FFF
 
const uint8_t HKX_MAX_CHECK_PERIOD = 0xFE
 

Detailed Description

Communication management of the Arduino library for HerkuleX servo (DRS-0101 and DRS-0201 models)

Author
Benoit Puel (conta.nosp@m.ct@b.nosp@m.enoit.nosp@m.puel.nosp@m..com)
Version
1.1
Date
26 December 2015

Enumeration Type Documentation

enum hkxBaudrate : uint32_t

Baud rate.

Baud rate of the serial communication with the servos.

  • HKX_57600: 57600 (from experience, this baud rate does NOT work properly),
  • HKX_115200: 115200 bps,
  • HKX_200000: 200000 bps,
  • HKX_250000: 250000 bps,
  • HKX_400000: 400000 bps,
  • HKX_500000: 500000 bps,
  • HKX_666666: 666666 bps.
enum hkxCommand : uint8_t

Available commands.

Available commands allowed for the servo requests (see Manual p40).

  • HKX_CMD_ROM_WRITE: write registers in the ROM (non-volatile),
  • HKX_CMD_ROM_READ: read registers in the ROM (non-volatile),
  • HKX_CMD_RAM_WRITE: write registers in the RAM (volatile),
  • HKX_CMD_RAM_READ: read registers in the RAM (volatile),
  • HKX_CMD_I_JOG: move the servos with individual playtime for each (asynchronous),
  • HKX_CMD_S_JOG: move the servos with the same playtime for all (synchronous),
  • HKX_CMD_STAT: read the status,
  • HKX_CMD_ROLLBACK: reset to factory default,
  • HKX_CMD_REBOOT: reboot.
enum hkxControlMode : uint8_t

Control mode.

Control mode to apply:

  • HKX_CTRL_POSITION: the servo is control in angle position (angle position)
  • HKX_CTRL_ROTATION: the servo is control in continues rotation (angle velocity)
enum hkxLEDControl : uint8_t

LED control.

LED control to apply: off (switch off), green, blue, red, cyan, yellow, pink or white.

  • HKX_LED_OFF,
  • HKX_LED_GREEN,
  • HKX_LED_BLUE,
  • HKX_LED_RED,
  • HKX_LED_CYAN,
  • HKX_LED_YELLOW,
  • HKX_LED_PINK,
  • HKX_LED_WHITE,
enum hkxMaybeHasNoValue : bool

No value.

No value for HkxMaybe class.

  • HKX_NO_VALUE
enum hkxMemory : bool

Memory type.

Memory type:

  • HKX_ROM: non-volatile memory (EEP)
  • HKX_RAM: volatile memory (RAM)
enum hkxTorqueControl : uint8_t

Torque control.

Torque control to apply:

  • HKX_TORQUE_FREE: no resistance to the movements (or let say mechanical resistance only)
  • HKX_TORQUE_BREAK: the motor resists but allows the movements
  • HKX_TORQUE_ON: the motor maintain its position (don't allow movements)

Variable Documentation

const bool HKX_DEV = true

Activation increase the number of checks that are necessary is the library is stable

const uint8_t HKX_ID_ALL = 0xFE

ID value to call all the servos

const uint8_t HKX_MAX_ACCELERATION_RATIO = 50

Maximum possible value of the acceleration ratio

const uint8_t HKX_MAX_CHECK_PERIOD = 0xFE

Maximum possible value for the check periods (LED blink, ADC fault check, packet garbage check, stop detection and overload detection)

const uint16_t HKX_MAX_CONTROL_PARAM = 0x7FFF

Maximum possible value for the control parameters (KP, KD, KI, FFG1 and FFG2)

const uint8_t HKX_MAX_ID = 0xFD

Maximum possible value of the ID that can be attributed to the servo

const uint8_t HKX_MAX_MIN_PWM = 0xFE

Maximum possible value for the minimum PWM of the saturator

const uint8_t HKX_MAX_POLICY = 0x7F

Maximum possible value for the polices (LED and Torque)

const uint16_t HKX_MAX_POSITION = 0x3FF

Maximum possible value for the position

const uint8_t HKX_MAX_POSITIONNING = 0xFE

Maximum possible value for the positioning (dead zone, stop threshold and in position margin)

const uint16_t HKX_MAX_PWM = 0x3FF

Maximum possible value for the PWM

const uint8_t HKX_MAX_SATURATOR_OFFSET = 0xFE

Maximum possible value for the saturator offset

const uint8_t HKX_MAX_TEMPERATURE = 0xFE

Maximum possible value of the limit temperature allowed to run the servo

const uint8_t HKX_MAX_TIME = 0xFE

Maximum possible value of the time

const uint8_t HKX_MAX_VOLTAGE = 0xFE

Maximum possible value of the maximum voltage allowed to run the servo

const uint8_t HKX_NUMBER_CONNECT_TRIALS = 2

Number of trials to connect to a servo.

const uint8_t HKX_NUMBER_SEND_TRIALS = 5

Number of trials to send a request.

const uint8_t HKX_SERIAL_BUFFER = 64

Size (bytes) of the serial buffer.

Warning
Do not modify unless you changed the serial buffer size (specific procedure)
const uint8_t HKX_WAIT_TIME = 10

Maximum time (in millisecond per byte to read) to wait before stopping the reading.