# cDriverServotogo Class Reference
[Devices]

cDriverServotogo offers an interface to the Servo2Go boards. More...

`#include <CDriverServotogo.h>`

Inheritance diagram for cDriverServotogo:

[legend]

List of all members.

## Public Member Functions
| cDriverServotogo ()
| Constructor of cDriverServotogo.
| ~cDriverServotogo ()
| Destructor of cDriverServotogo.
virtual int | open ()
| Open connection to Sensoray626 board.
virtual int | close ()
| Close connection to Sensoray626 board.
virtual int | initialize (const bool a_resetEncoders=false)
| Initialize Sensoray626 board.
virtual int | command (int a_command, void *a_data)

## Detailed Description

cDriverServotogo offers an interface to the Servo2Go boards.

## Member Function Documentation

int cDriverServotogo::close | ( |  | ) | `[virtual]`

Close connection to Sensoray626 board.

Sets all DACs to zero

Returns:
  Return 0 is operation succeeds, -1 if an error occurs.

Reimplemented from cGenericDevice.

int cDriverServotogo::command | ( | int | a_command,
|  | void * | a_data |
| ) |  |  | `[virtual]`

Send a command to the Servo2Go board. Possible commands are:
CHAI_CMD_GET_DEVICE_STATE: returns an int (1 board is ready, 0 board is NOT ready).
CHAI_CMD_GET_ENCODER_0: reads encoder 0, returns counts value in a long.
CHAI_CMD_GET_ENCODER_1: reads encoder 1, returns counts value in a long.
CHAI_CMD_GET_ENCODER_2: reads encoder 2, returns counts value in a long.
CHAI_CMD_GET_ENCODER_3: reads encoder 3, returns counts value in a long.
CHAI_CMD_GET_ENCODER_4: reads encoder 4, returns counts value in a long, and a value of 0 if the encoder does not exist.
CHAI_CMD_GET_ENCODER_5: reads encoder 5, returns counts value in a long, and a value of 0 if the encoder does not exist.
CHAI_CMD_GET_ENCODER_6: reads encoder 6, returns counts value in a long, and a value of 0 if the encoder does not exist.
CHAI_CMD_GET_ENCODER_7: reads encoder 7, returns counts value in a long, and a value of 0 if the encoder does not exist.

CHAI_CMD_SET_DAC_0: writes a voltage to DAC 0 a value between +10 and -10 volts, which is a double.
CHAI_CMD_SET_DAC_1: writes a voltage to DAC 1 a value between +10 and -10 volts, which is a double.
CHAI_CMD_SET_DAC_2: writes a voltage to DAC 2 a value between +10 and -10 volts, which is a double.
CHAI_CMD_SET_DAC_3: writes a voltage to DAC 3 a value between +10 and -10 volts, which is a double.
CHAI_CMD_SET_DAC_4: writes a voltage to DAC 4 a value between +10 and -10 volts, which is a double. If this axis is not supported no action is taken.
CHAI_CMD_SET_DAC_5: writes a voltage to DAC 5 a value between +10 and -10 volts, which is a double. If this axis is not supported no action is taken.
CHAI_CMD_SET_DAC_6: writes a voltage to DAC 6 a value between +10 and -10 volts, which is a double. If this axis is not supported no action is taken.
CHAI_CMD_SET_DAC_7: writes a voltage to DAC 7 a value between +10 and -10 volts, which is a double. If this axis is not supported no action is taken.

Set command to the Servotogo board.

Parameters:

  | a_command | Selected command.
  | a_data | Pointer to the corresponding data structure.

Returns:
  Return status of command.

Reimplemented from cGenericDevice.

int cDriverServotogo::initialize | ( | const bool | a_resetEncoders = `false` | ) | `[virtual]`

Initialize Sensoray626 board.

Initializes board. In this implementation there's really nothing to do that hasn't been done in the opening phase.

Returns:
  Return 0 is operation succeeds, -1 if an error occurs.

Reimplemented from cGenericDevice.

int cDriverServotogo::open | ( |  | ) | `[virtual]`

Open connection to Sensoray626 board.

Open board.

Returns:
  Return 0 is operation succeeds, -1 if an error occurs.

Reimplemented from cGenericDevice.

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

- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/devices/CDriverServotogo.h
- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/devices/CDriverServotogo.cpp

CHAI3D 2.0.0 documentation
Please address any questions to support@chai3d.org
(C) 2003-2009 - CHAI 3D
All Rights Reserved.