Next: 2.14 Position3DProxy
Up: 2. Class Reference
Previous: 2.12 MComProxy
Contents
Subsections
The PositionProxy class is used to control a position device. The latest position data is contained in the attributes xpos, ypos, etc.
double xpos,ypos,theta;
Robot pose (according to odometry) in m, m, radians.
double speed, sidespeed, turnrate;
Robot speeds in m/sec, m/sec, radians/sec.
unsigned char stall;
Stall flag: 1 if the robot is stalled and 0 otherwise.
PositionProxy(PlayerClient* pc, unsigned short index,
unsigned char access ='c')
Constructor. Leave the access field empty to start unconnected.
int SetSpeed(double speed, double sidespeed, double turnrate)
Send a motor command for velocity control mode. Specify the forward, sideways, and angular speeds in m/sec, m/sec, and radians/sec, respectively. Returns: 0 if everything's ok, -1 otherwise.
int SetSpeed(double speed, double turnrate)
Same as the previous SetSpeed(), but doesn't take the sideways speed (so use this one for non-holonomic robots).
int GoTo(double x, double y, double t)
Send a motor command for position control mode. Specify the desired pose of the robot in m, m, radians. Returns: 0 if everything's ok, -1 otherwise.
int SetMotorState(unsigned char state)
Enable/disable the motors. Set state to 0 to disable or 1 to enable. Be VERY careful with this method! Your robot is likely to run across the room with the charger still attached. Returns: 0 if everything's ok, -1 otherwise.
int SelectVelocityControl(unsigned char mode)
Select velocity control mode. For the the p2os_position driver, set mode to 0 for direct wheel velocity control (default), or 1 for separate translational and rotational control.
For the reb_position driver: 0 is direct velocity control, 1 is for velocity-based heading PD controller (uses DoDesiredHeading()).
Returns: 0 if everything's ok, -1 otherwise.
int ResetOdometry()
Reset odometry to (0,0,0). Returns: 0 if everything's ok, -1 otherwise.
int SelectPositionMode(unsigned char mode)
Select position mode on the reb_position driver. Set mode for 0 for velocity mode, 1 for position mode. Returns: 0 if OK, -1 else
int SetOdometry(double x, double y, double t)
Sets the odometry to the pose (x, y, theta). Note that x and y are in m and theta is in radians. Returns: 0 if OK, -1 else
int SetSpeedPID(int kp, int ki, int kd)
Only supported by the reb_position driver.
int SetPositionPID(short kp, short ki, short kd)
Only supported by the reb_position driver.
int SetPositionSpeedProfile(short spd, short acc)
Only supported by the reb_position driver.
int DoStraightLine(int mm)
Only supported by the reb_position driver.
int DoRotation(int deg)
Only supported by the reb_position driver.
int DoDesiredHeading(int theta, int xspeed, int yawspeed)
Only supported by the reb_position driver.
int SetStatus(uint8_t cmd, uint16_t value)
Only supported by the segwayrmp driver
int PlatformShutdown()
Only supported by the segwayrmp driver
double Xpos ()
Accessor method
double Ypos ()
Accessor method
double Theta ()
Accessor method
double Speed ()
Accessor method
double SideSpeed ()
Accessor method
double TurnRate ()
Accessor method
unsigned char Stall ()
Accessor method
void Print()
Print current position device state.
Next: 2.14 Position3DProxy
Up: 2. Class Reference
Previous: 2.12 MComProxy
Contents
2004-05-31