Activ
Media Robotics
11
Generic Servo Positioning Mode Commands
You may use the Pioneer 2 Arm’s generic Servo Positioning command to position a joint.
The command consists of three bytes: the header (0xFF), a servo-selector byte, and the
position value byte. The servo-selector byte’s most significant bit (b7) always is off (0) to
distinguish servo-positioning commands from control-mode commands. Its remaining bits
(b
0-6
) select the servo number, for a total of up to seven joints. Only joints one—the base
swivel—through six—the gripper—are active with the Pioneer 2 Arm.
The servo-positioning byte allows up to 255 different servo positions, although in practice,
the range of positions for any individual joint and depending on the individual Arm varies
to roughly 200 positions around values 25-235. Our P2OS-based servers let you set realistic
position boundaries (min and max) and center offsets, so that your client-side code is
portable from Arm to Arm. See following sections for details.
For example, using the generic command to turn the Pioneer 2 Arm fully clockwise
around its base (servo number 1), you may send the generic command byte sequence:
0xFF, 0x1, 0xFF
P2OS HOST to AUX Serial Port Communications
To send generic control and servo-positioning commands from your client software to the
Pioneer 2 Arm controller, you need to use the P2OS TTY2 command number 42 with an
integer (two-byte) or string argument. This is necessary since all generic commands from
your software to the Pioneer 2 Arm pass through your Pioneer 2’s HOST serial port and
through P2OS to the Arm-attached AUX serial port on the robot’s microcontroller.
Similarly, to retrieve responses from the Arm controller using generic commands, use the
P2OS
GETAUX
command number 43 and corresponding
SERAUXpac
server information
packet. Command and packet details are in the
Pioneer 2 Operations Manual
. The
various client-development environments for Pioneer 2 support these functions, including
Saphira and ARIA.
For example, to raise the Arm up (joint servo number 2) to roughly its center position, you
may use the Saphira client sequence:
unsigned char pos_servo[3] = {0xFF, 0x00, 0x00};
pos_servo[1] = 0x02; /* Select servo number 2 */
pos_servo[2] = 0x7F; /* Center position */
sfRobotComStrn(42,pos_servo,3); /* Saphira creates command packet and sends it;
P2OS transfers string out through AUX port to Arm */
You see easily how quickly Pioneer 2 Arm control through its generic command set
becomes tedious. We leave the details for retrieving generic command responses, such
as for the Arm version number, to the astute reader; we don’t recommend using the
generic Arm controls, and don’t want to belabor the point…
P2OS Arm Servers
P2OS version 1_H introduces advanced control functions for safe and convenient
operation of the Pioneer 2 Arm. These include commands to enable and disable power
to the Arm’s servos, to move the Arm to a new position—joint-by-joint and each at a
controllable speed—and to query for current arm position and status. The servers also
include safety watchdogs that monitor Arm status and functions, and which act to
minimize power consumption as well as help protect your Pioneer 2 Arm and
surroundings from damage.