next up previous contents
Next: 6.20 position3d Up: 6. Device Interfaces Previous: 6.18 mcom   Contents

Subsections


6.19 position

Synopsis

The position interface is used to control a planar mobile robot base.

Constants

#define PLAYER_POSITION_GET_GEOM_REQ ((uint8_t)1)
#define PLAYER_POSITION_MOTOR_POWER_REQ ((uint8_t)2)
#define PLAYER_POSITION_VELOCITY_MODE_REQ ((uint8_t)3)
#define PLAYER_POSITION_RESET_ODOM_REQ ((uint8_t)4)
#define PLAYER_POSITION_POSITION_MODE_REQ ((uint8_t)5)
#define PLAYER_POSITION_SPEED_PID_REQ ((uint8_t)6)
#define PLAYER_POSITION_POSITION_PID_REQ ((uint8_t)7)
#define PLAYER_POSITION_SPEED_PROF_REQ ((uint8_t)8)
#define PLAYER_POSITION_SET_ODOM_REQ ((uint8_t)9)

The various configuration request types.

#define PLAYER_POSITION_RMP_VELOCITY_SCALE ((uint8_t)51)
#define PLAYER_POSITION_RMP_ACCEL_SCALE ((uint8_t)52)
#define PLAYER_POSITION_RMP_TURN_SCALE ((uint8_t)53)
#define PLAYER_POSITION_RMP_GAIN_SCHEDULE ((uint8_t)54)
#define PLAYER_POSITION_RMP_CURRENT_LIMIT ((uint8_t)55)
#define PLAYER_POSITION_RMP_RST_INTEGRATORS ((uint8_t)56)
#define PLAYER_POSITION_RMP_SHUTDOWN ((uint8_t)57)

These are possible Segway RMP config commands; see the status command in the RMP manual

#define PLAYER_POSITION_RMP_RST_INT_RIGHT 0x01
#define PLAYER_POSITION_RMP_RST_INT_LEFT 0x02
#define PLAYER_POSITION_RMP_RST_INT_YAW 0x04
#define PLAYER_POSITION_RMP_RST_INT_FOREAFT 0x08
These are used for resetting the Segway RMP's integrators.

Data



struct player_position_data : The position interface returns data regarding the odometric pose and velocity of the robot, as well as motor stall information; the format is:

int32_t xpos, ypos;
X and Y position, in mm

int32_t yaw;
Yaw, in degrees

int32_t xspeed, yspeed;
X and Y translational velocities, in mm/sec

int32_t yawspeed;
Angular velocity, in degrees/sec

uint8_t stall;
Are the motors stalled?

Commands



struct player_position_cmd : The position interface accepts new positions and/or velocities for the robot's motors (drivers may support position control, speed control, or both); the format is

int32_t xpos, ypos;
X and Y position, in mm

int32_t yaw;
Yaw, in degrees

int32_t xspeed, yspeed;
X and Y translational velocities, in mm/sec

int32_t yawspeed;
Angular velocity, in degrees/sec

uint8_t state;
Motor state (zero is either off or locked, depending on the driver).

uint8_t type;
Command type; 0 = velocity, 1 = position.

Configuration: Query geometry



struct player_position_geom : To request robot geometry, set the subtype to PLAYER_POSITION_GET_GEOM_REQ and leave the other fields empty. The server will reply with the pose and size fields filled in.

uint8_t subtype;
Packet subtype. Must be PLAYER_POSITION_GET_GEOM_REQ.

uint16_t pose[3];
Pose of the robot base, in the robot cs (mm, mm, degrees).

uint16_t size[2];
Dimensions of the base (mm, mm).

Configuration: Motor power



struct player_position_power_config : On some robots, the motor power can be turned on and off from software. To do so, send a request with the format given below, and with the appropriate state (zero for motors off and non-zero for motors on). The server will reply with a zero-length acknowledgement.

Be VERY careful with this command! You are very likely to start the robot running across the room at high speed with the battery charger still attached.

uint8_t request;
subtype; must be PLAYER_POSITION_MOTOR_POWER_REQ

uint8_t value;
0 for off, 1 for on

Configuration: Change velocity control



struct player_position_velocitymode_config : Some robots offer different velocity control modes. It can be changed by sending a request with the format given below, including the appropriate mode. No matter which mode is used, the external client interface to the position device remains the same. The server will reply with a zero-length acknowledgement

uint8_t request;
subtype; must be PLAYER_POSITION_VELOCITY_MODE_REQ

uint8_t value;
driver-specific

The p2os_position driver offers two modes of velocity control: separate translational and rotational control and direct wheel control. When in the separate mode, the robot's microcontroller internally computes left and right wheel velocities based on the currently commanded translational and rotational velocities and then attenuates these values to match a nice predefined acceleration profile. When in the direct mode, the microcontroller simply passes on the current left and right wheel velocities. Essentially, the separate mode offers smoother but slower (lower acceleration) control, and the direct mode offers faster but jerkier (higher acceleration) control. Player's default is to use the direct mode. Set mode to zero for direct control and non-zero for separate control.

For the reb_position driver, 0 is direct velocity control, 1 is for velocity-based heading PD controller.

Configuration: Reset odometry



struct player_position_resetodom_config : To reset the robot's odometry to (x, y,$ \theta$) = (0, 0, 0), use the following request. The server will reply with a zero-length acknowledgement.

uint8_t request;
subtype; must be PLAYER_POSITION_RESET_ODOM_REQ

Configuration: Change position control



struct player_position_position_mode_req :

uint8_t subtype;
subtype; must be PLAYER_POSITION_POSITION_MODE_REQ

uint8_t state;
0 for velocity mode, 1 for position mode

Configuration: Set odometry



struct player_position_set_odom_req : To set the robot's odometry to a particular state, use this request:

uint8_t subtype;
subtype; must be PLAYER_POSITION_SET_ODOM_REQ

int32_t x, y;
X and Y (in mm?)

int32_t theta;
Heading (in degrees)

Configuration: Set velocity PID parameters



struct player_position_speed_pid_req :

uint8_t subtype;
subtype; must be PLAYER_POSITION_SPEED_PID_REQ

int32_t kp, ki, kd;
PID parameters

Configuration: Set position PID parameters



struct player_position_position_pid_req :

uint8_t subtype;
subtype; must be PLAYER_POSITION_POSITION_PID_REQ

int32_t kp, ki, kd;
PID parameters

Configuration: Set speed profile parameters



struct player_position_speed_prof_req :

uint8_t subtype;
subtype; must be PLAYER_POSITION_SPEED_PROF_REQ

int16_t speed;
max speed

int16_t acc;
max acceleration

Configuration: Segway RMP-specific configuration



struct player_rmp_config :

uint8_t subtype;
subtype: must be of PLAYER_RMP_*

uint16_t value;
holds various values depending on the type of config. See the "Status" command in the Segway manual.


next up previous contents
Next: 6.20 position3d Up: 6. Device Interfaces Previous: 6.18 mcom   Contents
2004-06-02