PlayerCc::Position2dProxy Class Reference

The Position2dProxy class is used to control a position2d device. More...

#include <playerc++.h>

Inheritance diagram for PlayerCc::Position2dProxy:
Inheritance graph
Collaboration diagram for PlayerCc::Position2dProxy:
Collaboration graph

Detailed Description

The Position2dProxy class is used to control a position2d device.

The latest position data is contained in the attributes xpos, ypos, etc.

Public Member Functions

 Position2dProxy (PlayerClient *aPc, uint32_t aIndex=0)
 Constructor.
 
 ~Position2dProxy ()
 Destructor.
 
void SetSpeed (double aXSpeed, double aYSpeed, double aYawSpeed)
 Send a motor command for velocity control mode. More...
 
void SetSpeed (double aXSpeed, double aYawSpeed)
 Same as the previous SetSpeed(), but doesn't take the yspeed speed (so use this one for non-holonomic robots). More...
 
void SetSpeed (player_pose2d_t vel)
 Overloaded SetSpeed that takes player_pose2d_t as an argument.
 
void SetVelHead (double aXSpeed, double aYSpeed, double aYawHead)
 Send a motor command for velocity/heading control mode. More...
 
void SetVelHead (double aXSpeed, double aYawHead)
 Same as the previous SetVelHead(), but doesn't take the yspeed speed (so use this one for non-holonomic robots). More...
 
void GoTo (player_pose2d_t pos, player_pose2d_t vel)
 Send a motor command for position control mode. More...
 
void GoTo (player_pose2d_t pos)
 Same as the previous GoTo(), but doesn't take speed.
 
void GoTo (double aX, double aY, double aYaw)
 Same as the previous GoTo(), but only takes position arguments, no motion speed setting.
 
void SetCarlike (double aXSpeed, double aDriveAngle)
 Sets command for carlike robot.
 
void RequestGeom ()
 Get the device's geometry; it is read into the relevant class attributes. More...
 
player_pose3d_t GetOffset ()
 Accessor for the robot's pose with respect to its.
 
player_bbox3d_t GetSize ()
 Accessor for the size (fill it in by calling RequestGeom)
 
void SetMotorEnable (bool enable)
 Enable/disable the motors. More...
 
void ResetOdometry ()
 Reset odometry to (0,0,0).
 
void SetOdometry (double aX, double aY, double aYaw)
 Sets the odometry to the pose (x, y, yaw). More...
 
double GetXPos () const
 Get the device's X position.
 
double GetYPos () const
 Get the device's Y position.
 
double GetYaw () const
 Get the device's Yaw position (angle)
 
double GetXSpeed () const
 Get the device's X speed.
 
double GetYSpeed () const
 Get the device's Y speed.
 
double GetYawSpeed () const
 Get the device's angular (yaw) speed.
 
bool GetStall () const
 Is the device stalled?
 
- Public Member Functions inherited from PlayerCc::ClientProxy
bool IsValid () const
 Proxy has any information. More...
 
bool IsFresh () const
 Check for fresh data. More...
 
void NotFresh ()
 Reset Fresh flag. More...
 
std::string GetDriverName () const
 Get the underlying driver's name. More...
 
double GetDataTime () const
 Returns the received timestamp of the last data sample [s].
 
double GetElapsedTime () const
 Returns the time between the current data time and the time of the last data sample [s].
 
PlayerClientGetPlayerClient () const
 Get a pointer to the Player Client. More...
 
uint32_t GetIndex () const
 Get device index. More...
 
uint32_t GetInterface () const
 Get Interface Code. More...
 
std::string GetInterfaceStr () const
 Get Interface Name. More...
 
void SetReplaceRule (bool aReplace, int aType=-1, int aSubtype=-1)
 Set a replace rule for this proxy on the server. More...
 
int HasCapability (uint32_t aType, uint32_t aSubtype)
 Request capabilities of device. More...
 
int GetBoolProp (char *aProperty, bool *aValue)
 Request a boolean property. More...
 
int SetBoolProp (char *aProperty, bool aValue)
 Set a boolean property. More...
 
int GetIntProp (char *aProperty, int32_t *aValue)
 Request an integer property. More...
 
int SetIntProp (char *aProperty, int32_t aValue)
 Set an integer property. More...
 
int GetDblProp (char *aProperty, double *aValue)
 Request a double property. More...
 
int SetDblProp (char *aProperty, double aValue)
 Set a double property. More...
 
int GetStrProp (char *aProperty, char **aValue)
 Request a string property. More...
 
int SetStrProp (char *aProperty, char *aValue)
 Set a string property. More...
 
template<typename T >
connection_t ConnectReadSignal (T aSubscriber)
 Connect a read signal to this proxy. More...
 
void DisconnectReadSignal (connection_t aSubscriber)
 Disconnect a signal from this proxy. More...
 

Private Member Functions

void Subscribe (uint32_t aIndex)
 
void Unsubscribe ()
 

Private Attributes

playerc_position2d_tmDevice
 

Additional Inherited Members

- Public Types inherited from PlayerCc::ClientProxy
typedef int connection_t
 
typedef boost::mutex::scoped_lock scoped_lock_t
 
typedef int read_signal_t
 
- Protected Member Functions inherited from PlayerCc::ClientProxy
 ClientProxy (PlayerClient *aPc, uint32_t aIndex)
 
template<typename T >
GetVar (const T &aV) const
 
template<typename T >
void GetVarByRef (const T aBegin, const T aEnd, T aDest) const
 
- Protected Attributes inherited from PlayerCc::ClientProxy
PlayerClientmPc
 
playerc_client_tmClient
 
playerc_device_tmInfo
 
bool mFresh
 

Member Function Documentation

◆ GoTo()

void PlayerCc::Position2dProxy::GoTo ( player_pose2d_t  pos,
player_pose2d_t  vel 
)

Send a motor command for position control mode.

Specify the desired pose of the robot as a player_pose_t. desired motion speed as a player_pose_t.

◆ RequestGeom()

void PlayerCc::Position2dProxy::RequestGeom ( )

Get the device's geometry; it is read into the relevant class attributes.

Call GetOffset() to access this data.

◆ SetMotorEnable()

void PlayerCc::Position2dProxy::SetMotorEnable ( bool  enable)

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.

◆ SetOdometry()

void PlayerCc::Position2dProxy::SetOdometry ( double  aX,
double  aY,
double  aYaw 
)

Sets the odometry to the pose (x, y, yaw).

Note that x and y are in m and yaw is in radians.

◆ SetSpeed() [1/2]

void PlayerCc::Position2dProxy::SetSpeed ( double  aXSpeed,
double  aYSpeed,
double  aYawSpeed 
)

Send a motor command for velocity control mode.

Specify the forward, sideways, and angular speeds in m/sec, m/sec, and radians/sec, respectively.

◆ SetSpeed() [2/2]

void PlayerCc::Position2dProxy::SetSpeed ( double  aXSpeed,
double  aYawSpeed 
)
inline

Same as the previous SetSpeed(), but doesn't take the yspeed speed (so use this one for non-holonomic robots).

◆ SetVelHead() [1/2]

void PlayerCc::Position2dProxy::SetVelHead ( double  aXSpeed,
double  aYSpeed,
double  aYawHead 
)

Send a motor command for velocity/heading control mode.

Specify the forward and sideways velocity (m/sec), and angular heading (rads).

◆ SetVelHead() [2/2]

void PlayerCc::Position2dProxy::SetVelHead ( double  aXSpeed,
double  aYawHead 
)
inline

Same as the previous SetVelHead(), but doesn't take the yspeed speed (so use this one for non-holonomic robots).


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