RIG InMoov Project
Macros | Enumerations | Functions | Variables
servo_rhand.h File Reference

Go to the source code of this file.

Macros

#define SERVOS   6
 
#define BUFSIZE   32
 

Enumerations

enum  {
  VERBOSE = 0, BOARD_ID = 181, DEBUG_RX_PIN = 1, DEBUG_TX_PIN = 0,
  CMD_RX_PIN = 1, CMD_TX_PIN = 0, SERIAL_BAUDRATE = 9600
}
 

Functions

int getServoIndexFromID (uint8_t servo_id)
 
int getServoIDFromIndex (uint8_t servo_index)
 
int getServoPinFromIndex (uint8_t servo_index)
 

Variables

uint8_t limit [SERVOS][2]
 
uint8_t default_pos [SERVOS] = { 0, 0, 0, 0, 0, 0 }
 
uint8_t reverse [SERVOS] = { 1, 1, 1, 1, 1, 1 }
 
uint8_t pin_offset = 2
 

Detailed Description

This is an example settings.h for servo.ino.

Every Arduino board on the bot is to be a simple servo controller that accepts commands from serial input, and so they are all to share the code located in servo.ino. Each board needs its own header like this one to define custom information about the board and each servo on the board. This is such a settings file and will be documented as an example.

Definition in file servo_rhand.h.

Macro Definition Documentation

#define BUFSIZE   32

Size of the print buffer (must be large enough to hold DUMP_RESPONSE_LEN).

Definition at line 18 of file servo_rhand.h.

#define SERVOS   6

Number of servos to assign.

Definition at line 14 of file servo_rhand.h.

Enumeration Type Documentation

anonymous enum
Enumerator
VERBOSE 

Whether to print debug output to the serial port.

BOARD_ID 

The unique identification for this board.

Definition at line 54 of file servo_rhand.h.

Function Documentation

int getServoIDFromIndex ( uint8_t  servo_index)

This function gets servo ID using its array index. If the servo index is out of bounds, it returns -1. This must correspond with getServoIndexFromID().

Definition at line 87 of file servo_rhand.h.

int getServoIndexFromID ( uint8_t  servo_id)

This function gets array index of a servo using its ID. If the servo does not belong to this board, it returns -1. It is recommended that boards with complex ID assignments use a switch statement or a similar solution to save resources. This function must correspond with getServoIDFromIndex().

See also
Values

Definition at line 74 of file servo_rhand.h.

int getServoPinFromIndex ( uint8_t  servo_index)

This function returns the desired pin of a servo given its index number, allows complex pin assignment. If the servo idex is not valid, returns -1.

Definition at line 100 of file servo_rhand.h.

Variable Documentation

uint8_t default_pos[SERVOS] = { 0, 0, 0, 0, 0, 0 }

The default position to set each servo to. Its index corresponds with servo.

Definition at line 42 of file servo_rhand.h.

uint8_t limit[SERVOS][2]
Initial value:
= {
{ 125, 160 }, { 50, 160 }, { 55, 155 },
{ 35, 155 }, { 45, 145 }, { 55, 145 },
}

This is the callibration for each servo- its minimum then maximum angle (for positional servos) or its minimum then maximum speed (for continuous rotation servos). Its index corresponds with servo.

Definition at line 34 of file servo_rhand.h.

uint8_t pin_offset = 2

Pin value to begin assigning pins at. Unique to this settings file.

See also
getServoPinFromIndex()

Definition at line 52 of file servo_rhand.h.

uint8_t reverse[SERVOS] = { 1, 1, 1, 1, 1, 1 }

Indicates whether to reverse the angles for each servo, for servos that turn the wrong way. Its index corresponds with servo.

Definition at line 47 of file servo_rhand.h.