Khepera Class Reference

List of all members.

Public Member Functions

 Khepera (ConfigFile *cf, int section)
virtual void Main ()
 Main method for driver thread.
virtual int Subscribe (player_devaddr_t addr)
 Subscribe to this driver.
virtual int Unsubscribe (player_devaddr_t addr)
 Unsubscribe from this driver.
virtual int Setup ()
 Initialize the driver.
virtual int Shutdown ()
 Finalize the driver.
int ResetOdometry ()
void SetIRState (int)
void UpdateData (void)
void UpdateIRData (player_ir_data_t *)
void UpdatePosData (player_position2d_data_t *)
unsigned short ReadAD (int)
int ReadAllIR (player_ir_data_t *)
int SetSpeed (int, int)
int ReadSpeed (int *, int *)
int SetPos (int, int)
int SetPosCounter (int, int)
int ReadPos (int *, int *)
int ProcessMessage (MessageQueue *resp_queue, player_msghdr *hdr, void *data)
 Message handler.

Member Function Documentation

void Khepera::Main (  )  [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.

References Driver::ProcessMessages().

int Khepera::ProcessMessage ( MessageQueue 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.

References Message::MatchMessage(), player_pose::pa, PLAYER_IR_POSE, PLAYER_MSGTYPE_CMD, PLAYER_MSGTYPE_REQ, PLAYER_MSGTYPE_RESP_ACK, PLAYER_MSGTYPE_RESP_NACK, PLAYER_POSITION2D_CMD_VEL, PLAYER_POSITION2D_REQ_GET_GEOM, PLAYER_POSITION2D_REQ_MOTOR_POWER, PLAYER_POSITION2D_REQ_RESET_ODOM, PLAYER_POSITION2D_REQ_SET_ODOM, PLAYER_POSITION2D_REQ_VELOCITY_MODE, Driver::Publish(), player_pose::px, player_position2d_geom::size, player_msghdr::subtype, player_bbox::sw, and player_position2d_cmd_vel::vel.

int Khepera::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.

int Khepera::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.

References Driver::StopThread().

int Khepera::Subscribe ( player_devaddr_t  addr  )  [virtual]

Subscribe to this driver.

The Subscribe() and Unsubscribe() methods are used to control subscriptions to the driver; a driver MAY override them, but usually won't.

Parameters:
addr Address of the device to subscribe to (the driver may have more than one interface).
Returns:
Returns 0 on success.

Reimplemented from Driver.

References player_devaddr::interf, PLAYER_IR_CODE, PLAYER_POSITION2D_CODE, and Driver::Subscribe().

int Khepera::Unsubscribe ( player_devaddr_t  addr  )  [virtual]

Unsubscribe from this driver.

The Subscribe() and Unsubscribe() methods are used to control subscriptions to the driver; a driver MAY override them, but usually won't.

Parameters:
addr Address of the device to unsubscribe from (the driver may have more than one interface).
Returns:
Returns 0 on success.

Reimplemented from Driver.

References player_devaddr::interf, PLAYER_IR_CODE, PLAYER_POSITION2D_CODE, and Driver::Unsubscribe().


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

Last updated 12 September 2005 21:38:45