Aria
2.8.0
|
Interface to Directed Perception pan/tilt unit, imprementing the ArPTZ interface. More...
#include <ArDPPTU.h>
Public Types | |
enum | { DELIM = 0x20, INIT = 0x40, ACCEL = 0x61, BASE = 0x62, CONTROL = 0x63, DISABLE = 0x64, ENABLE = 0x65, FACTORY = 0x66, HALT = 0x68, IMMED = 0x69, LIMIT = 0x6C, MONITOR = 0x6D, OFFSET = 0x6F, PAN = 0x70, RESET = 0x72, SPEED = 0x73, TILT = 0x74, UPPER = 0x75, VELOCITY = 0x76 } |
Interface to Directed Perception pan/tilt unit, imprementing the ArPTZ interface.
Functions such as pan(), tilt(), etc. send requests to the PTU. By default, a new motion command will interrupt the previous command, but the awaitExec() function sends a command instructing the PTU to wait for the previous motion to finish.
Incoming data sent from the PTU is read every ArRobot task cycle (10hz). If this data contains a message giving the current measured position of the pan and tilt axes, then this is stored as the current pan and tilt positions, and a request for the next positions is sent. (This means that the pan and tilt positions are received as fast as the PTU can send them, but no faster than the robot task cycle.) If no pan and tilt positions have been received, then ArDPPTU defaults to providing as pan and tilt position whatever the last requested positions are (from the last use of pan(), tilt() or panTilt()). (This is the standard behavior specified by the ArPTZ interface, and lets you deal with different kinds of PTUs, some of which cannot measure their own position.) You can also always check the last pan or tilt request with getLastPanRequest() and getLastTiltRequest().
To use ArDPPTU you must set the appropriate device connection (usually an ArSerialConnection), open this connection, then call the init() method on the ArDPPTU object. Then, you can use resetCalib() to have the unit perform a self calibration routine, configure power modes, set speeds, etc.
The ArDPPTU constructor will switch on power to the PTU when on a Seekur or Seekur Jr. robot. The shutdown() method (and destructor) will switch off power.
If a specific DPPTU type was given in the constructor, then some internal conversion factors are set according to that type. If left as the PANTILT_DEFAULT type, then the conversion factors are automatically determined by querying the DPPTU device. PANTILT_DEFAULT is recommended.
The DPPTU performs a startup self-calibration routine when first powered on. You can recalibrate by calling resetCalib().
By default the DPPTU is configured to use low power when in motion, and no power on the motors when holding a position. This is OK for most cameras. However, the DPPTU has a very high payload (especially PTU47 for outdoor use) and you may want to enable higher power modes if the PTU slips when carrying heavy payloads using setMovePower() and setHoldPower().
The DPPTU can be connected to a computer serial port (typically COM4) or through a Pioneer microcontroller auxilliary serial port. If the DPPTU is connected to the microcontroller, make sure that the baud rate of the microcontroller-DPPTU connection is at least as fast, if not faster than the connection of the computer to the microcontroller. If it's slower then the commands sent to the DPPTU may get backed up in the AUX port buffer and cause the DPPTU to behave erratically. So, if the computer-microcontroller connection is autobauding up to 38400bps, then make sure that the microcontroller aux port is set to 38400bps, as well, and consult the DPPTU manual for directions on changing its baud rate.
anonymous enum |