HerkuleXLib  1.2
Arduino library to drive HerkuleX DRS-0101 and DRS-0201
Public Member Functions | Private Attributes | List of all members
HkxGroupContRotation Class Reference

Class to drive a group of servos in continuous rotation mode. More...

#include <HkxGroupContRotation.h>

Public Member Functions

 HkxGroupContRotation (uint8_t length, HkxContRotation *arrayServos[], HkxPrint &print)
 Constructor. More...
 
HkxContRotationgetServo (uint8_t number)
 Get the nth servo. More...
 
uint8_t getNbServos ()
 Get number of servos. More...
 
uint8_t setAllTorqueLEDControl (HkxMaybe< hkxTorqueControl > newTorqueControl, HkxMaybe< hkxLEDControl > newLEDControl)
 Set torque actuation and LED colour. More...
 
uint8_t moveAllRotation (int16_t pwm[], HkxMaybe< uint16_t > playTime, HkxMaybe< hkxLEDControl > LEDControl[])
 Move servos in continuous rotation. More...
 
void rebootAll ()
 Reboot. More...
 

Private Attributes

HkxContRotation ** _servos
 
const uint8_t _length
 
HkxCommunication_herkXCom
 
HkxPrint_print
 

Detailed Description

Class to drive a group of servos in continuous rotation mode.

This class allows to drive a group of servos in continuous rotation mode.

Constructor & Destructor Documentation

HkxGroupContRotation::HkxGroupContRotation ( uint8_t  length,
HkxContRotation arrayServos[],
HkxPrint print 
)

Constructor.

The constructor of HkxGroupContRotation.

Warning
HkxCommunication shall be the same for all the servos of the group. If not, an error will be returned and the instance will be corrupted.
Parameters
[in]length: Number of servos in the table _servos.
Warning
It shall not exceed 53 servos, otherwise it cannot execute moveAllRotation().
Parameters
[in]arrayServos[]: Array of pointers to the servos.
[in]print: Communication to print messages.

Member Function Documentation

uint8_t HkxGroupContRotation::getNbServos ( )
inline

Get number of servos.

Get the number of servos manage by the instance.

Returns
Return the number of servos.
HkxContRotation& HkxGroupContRotation::getServo ( uint8_t  number)
inline

Get the nth servo.

Get the nth servo.

Parameters
[in]number: number of servo to get (from the table _servos).
Warning
number < _ref _length otherwise return void.
Returns
Return a reference to the nth servo.
uint8_t HkxGroupContRotation::moveAllRotation ( int16_t  pwm[],
HkxMaybe< uint16_t >  playTime,
HkxMaybe< hkxLEDControl LEDControl[] 
)

Move servos in continuous rotation.

Perform a move of all the servos in continuous rotation mode.

Parameters
[in]pwm[]: Array of torque power to apply. Its value shall be set in PWM within the range [-1023 ; 1023].
[in]playTime: Time of the action. Its value shall be set in milliseconds. This parameter is optional, either set a uint16_t (or unsigned int) variable, or set HKX_NO_VALUE to ignore it.
[in]LEDControl[]: Array of LED control to apply. This parameter is optional, either set a hkxLEDControl variable, the value (list below), or set HKX_NO_VALUE to ignore it.
  • HKX_LED_OFF,
  • HKX_LED_GREEN,
  • HKX_LED_BLUE,
  • HKX_LED_RED,
  • HKX_LED_CYAN,
  • HKX_LED_YELLOW,
  • HKX_LED_PINK,
  • HKX_LED_WHITE,
Returns
0 = OK
1 = Input not correct
2 = Servo not connected
void HkxGroupContRotation::rebootAll ( )
inline

Reboot.

Reboot all the servos.

uint8_t HkxGroupContRotation::setAllTorqueLEDControl ( HkxMaybe< hkxTorqueControl newTorqueControl,
HkxMaybe< hkxLEDControl newLEDControl 
)

Set torque actuation and LED colour.

Set the same torque actuation (hkxTorqueControl for more details) and the LED colour (hkxLEDControl for more details) to all the servos.

Parameters
[in]newTorqueControl: Torque control to apply. This parameter is optional, either set a hkxTorqueControl variable, the value (list below), or set HKX_NO_VALUE to ignore it.
  • 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)
[in]newLEDControl: LED control to apply. This parameter is optional, either set a hkxLEDControl variable, the value (list below), or set HKX_NO_VALUE to ignore it.
  • HKX_LED_OFF,
  • HKX_LED_GREEN,
  • HKX_LED_BLUE,
  • HKX_LED_RED,
  • HKX_LED_CYAN,
  • HKX_LED_YELLOW,
  • HKX_LED_PINK,
  • HKX_LED_WHITE,
Returns
0 = OK
1 = Input not correct
2 = Servo not connected

Member Data Documentation

HkxCommunication& HkxGroupContRotation::_herkXCom
private

Communication with servos

const uint8_t HkxGroupContRotation::_length
private

Number of servos in the table _servos

HkxPrint& HkxGroupContRotation::_print
private

Communication to print messages

HkxContRotation** HkxGroupContRotation::_servos
private

Array of pointers to HkxContRotation instances


The documentation for this class was generated from the following files: