SegwayRMP Class Reference

Inheritance diagram for SegwayRMP:

Inheritance graph
[legend]
Collaboration diagram for SegwayRMP:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 31 of file segwayrmp.h.


Public Member Functions

 SegwayRMP (ConfigFile *cf, int section)
 ~SegwayRMP ()
virtual int Setup ()
 Initialize the driver.
virtual int Shutdown ()
 Finalize the driver.
virtual int ProcessMessage (QueuePointer &resp_queue, player_msghdr *hdr, void *data)
 Message handler.

Protected Attributes

player_devaddr_t position_id
player_position2d_data_t position_data
player_devaddr_t position3d_id
player_position3d_data_t position3d_data
player_devaddr_t power_id
player_power_data_t power_data

Private Member Functions

int HandlePositionConfig (QueuePointer &resp_queue, uint32_t subtype, void *data, size_t len)
int HandlePosition3DConfig (QueuePointer &resp_queue, uint32_t subtype, void *data, size_t len)
int Read ()
int Diff (uint32_t from, uint32_t to, bool first)
int Write (CanPacket &pkt)
virtual void Main ()
 Main method for driver thread.
void MakeStatusCommand (CanPacket *pkt, uint16_t cmd, uint16_t val)
void MakeVelocityCommand (CanPacket *pkt, int32_t xspeed, int32_t yawspeed)
void MakeShutdownCommand (CanPacket *pkt)
void UpdateData (rmp_frame_t *)

Private Attributes

const char * portname
const char * caniotype
int timeout_counter
float max_xspeed
float max_yawspeed
bool firstread
DualCANIOcanio
float curr_xspeed
float curr_yawspeed
bool motor_allow_enable
bool motor_enabled
uint32_t last_raw_yaw
uint32_t last_raw_left
uint32_t last_raw_right
uint32_t last_raw_foreaft
double odom_x
double odom_y
double odom_yaw

Member Function Documentation

int SegwayRMP::Setup (  )  [virtual]

Initialize the driver.

This function is called with the first client subscribes; it MUST be implemented by the driver.

Returns:
Returns 0 on success.

Implements Driver.

Definition at line 231 of file segwayrmp.cc.

References curr_xspeed, curr_yawspeed, firstread, motor_allow_enable, motor_enabled, odom_x, odom_y, odom_yaw, PLAYER_ERROR, PLAYER_ERROR1, PLAYER_MSG0, and timeout_counter.

int SegwayRMP::Shutdown (  )  [virtual]

Finalize the driver.

This function is called with the last client unsubscribes; it MUST be implemented by the driver.

Returns:
Returns 0 on success.

Implements Driver.

Definition at line 273 of file segwayrmp.cc.

References canio, MakeVelocityCommand(), PLAYER_MSG0, DualCANIO::Shutdown(), Driver::StopThread(), and Write().

Here is the call graph for this function:

int SegwayRMP::ProcessMessage ( QueuePointer resp_queue,
player_msghdr hdr,
void *  data 
) [virtual]

Message handler.

This function is called once for each message in the incoming queue. Reimplement it to provide message handling. Return 0 if you handled the message and -1 otherwise

Parameters:
resp_queue The queue to which any response should go.
hdr The message header
data The message body

Reimplemented from Driver.

Definition at line 445 of file segwayrmp.cc.

References curr_xspeed, curr_yawspeed, HandlePosition3DConfig(), HandlePositionConfig(), player_devaddr::index, player_devaddr::interf, Message::MatchMessage(), motor_allow_enable, motor_enabled, player_pose2d::pa, PLAYER_MSGTYPE_CMD, PLAYER_MSGTYPE_REQ, PLAYER_POSITION2D_CMD_VEL, PLAYER_POSITION3D_CMD_SET_VEL, position3d_id, position_id, player_pose3d::px, player_pose2d::px, player_pose3d::pyaw, player_position3d_cmd_vel::state, player_position2d_cmd_vel::state, timeout_counter, player_position3d_cmd_vel::vel, and player_position2d_cmd_vel::vel.

Here is the call graph for this function:

void SegwayRMP::Main (  )  [private, virtual]

Main method for driver thread.

drivers have their own thread of execution, created using StartThread(); this is the entry point for the driver thread, and must be overloaded by all threaded drivers.

Reimplemented from Driver.

Definition at line 304 of file segwayrmp.cc.

References curr_xspeed, curr_yawspeed, MakeVelocityCommand(), motor_enabled, PLAYER_ERROR, PLAYER_MSG0, PLAYER_MSGTYPE_DATA, PLAYER_POSITION2D_DATA_STATE, PLAYER_POSITION3D_DATA_STATE, PLAYER_POWER_DATA_STATE, PLAYER_WARN, Driver::ProcessMessages(), Driver::Publish(), Read(), timeout_counter, and Write().

Here is the call graph for this function:

void SegwayRMP::UpdateData ( rmp_frame_t  )  [private]


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

Last updated 12 September 2005 21:38:45