

Public Member Functions | |
| mbasedriver (ConfigFile *cf, int section) | |
| virtual int | Subscribe (player_devaddr_t id) |
| Subscribe. | |
| virtual int | Unsubscribe (player_devaddr_t id) |
| Unsubscribe. | |
| virtual void | Main () |
| Main. | |
| virtual int | Setup () |
| Setup. | |
| virtual int | Shutdown () |
| Shutdown. | |
| virtual int | ProcessMessage (QueuePointer &resp_queue, player_msghdr *hdr, void *data) |
| ProcessMessage. | |
Private Member Functions | |
| int | Connect () |
| Connect. | |
| int | Disconnect () |
| Disconnect. | |
| void | ResetRawPositions () |
| ResetRawPositions. | |
| void | ToggleMotorPower (unsigned char val) |
| ToggleMotorPower. | |
| void | ToggleAIn (unsigned char val) |
| ToggleAIn. | |
| void | ToggleSonar (unsigned char val) |
| ToggleSonar. | |
| int | HandleConfig (QueuePointer &resp_queue, player_msghdr *hdr, void *data) |
| HandleConfig. | |
| int | HandleCommand (player_msghdr *hdr, void *data) |
| HandleCommand. | |
| void | HandlePositionCommand (player_position2d_cmd_vel_t position_cmd) |
| HandlePositionCommand. | |
| void | PublishAllData () |
| PublishAllData. | |
| void | PublishPosition2D () |
| PublishPosition2D. | |
| void | PublishPower () |
| PublishPower. | |
| void | PublishAIn () |
| PublishAIn. | |
| void | PublishIR () |
| PublishIR. | |
| void | PublishSonar () |
| PublishSonar. | |
| void | StartThreads () |
| StrarThreads. | |
| void | StopThreads () |
| StopThreads. | |
| void | Send (mbasedriverPacket *packet) |
| Send. | |
| void | SendThread () |
| SendThread. | |
| void | ReceiveThread () |
| ReceiveThread. | |
| int | getms () |
| getms | |
Static Private Member Functions | |
| static void * | SendThreadDummy (void *driver) |
| SedThreadDummy. | |
| static void * | ReceiveThreadDummy (void *driver) |
| ReceiveThreadDummy. | |
Private Attributes | |
| int | mcount |
| player_mbasedriver_data_t | mbasedriver_data |
| player_devaddr_t | position_id |
| player_devaddr_t | power_id |
| player_devaddr_t | aio_id |
| player_devaddr_t | ir_id |
| player_devaddr_t | sonar_id |
| int | position_subscriptions |
| int | aio_ir_subscriptions |
| int | sonar_subscriptions |
| mbasedriverMotorPacket * | motor_packet |
| pthread_mutex_t | motor_packet_mutex |
| int | read_fd |
| int | write_fd |
| const char * | psos_serial_port |
| player_position2d_cmd_vel_t | last_position_cmd |
| player_position2d_cmd_car_t | last_car_cmd |
| std::queue< mbasedriverPacket * > | send_queue |
| pthread_mutex_t | send_queue_mutex |
| pthread_cond_t | send_queue_cond |
| pthread_t | send_thread |
| pthread_t | receive_thread |
| bool | print_all_packets |
| int | param_idx |
| int | motor_max_speed |
| int | motor_max_turnspeed |
| int | motor_trans_acel |
| int | motor_rot_acel |
| int | trans_ant |
| int | rot_ant |
| int16_t | pid_p |
| int16_t | pid_v |
| int16_t | pid_i |
| int16_t | driffactor |
| int16_t | dist_ejes |
| int16_t | diametro |
| bool | debug_usuario |
| bool | ir_analog |
Constructor & Destructor Documentation
| mbasedriver::mbasedriver | ( | ConfigFile * | cf, |
| int | section | ||
| ) |
- Constructor of the driver from configuration entry
Leyendo los datos del fichero cfg y asignando valores a los parámetros correspondientes.
References Driver::AddInterface(), Connect(), ConfigFile::ReadAngle(), ConfigFile::ReadDeviceAddr(), ConfigFile::ReadInt(), ConfigFile::ReadLength(), ConfigFile::ReadString(), and Driver::SetError().

Member Function Documentation
| int mbasedriver::Connect | ( | ) | [private] |
Connect.
- Establishes connection and starts threads
Envío mensajes de configuración a la placa de control IOM
- OPEN_CONTROLLER
- STOP
- SET_TRANS_ACEL, si no se envía al menos una vez la plataforma no se moverá
- SET_ROT_ACEL -> No se envia porque el IOM no lo reconoce
if(this->motor_rot_acel > 0) { accel_packet = new mbasedriverPacket(); accel_command[0] = (command_e)set_rot_acel; accel_command[1] = (argtype_e)argint; accel_command[2] = this->motor_rot_acel & 0x00FF; accel_command[3] = (this->motor_rot_acel & 0xFF00) >> 8; if(debug_send) printf("__ build SET_ROT_ACEL\n"); accel_packet->Build(accel_command, 4); this->Send(accel_packet); }
- SET_DRIFFACTOR
- SET_ROBOT_WIDTH
- SET_ROBOT_WHEEL
- SET_PID_P
- SET_PID_I
- SET_PID_D
References mbasedriverPacket::Build(), mbasedriverPacket::Receive(), Send(), and mbasedriverPacket::Send().
Referenced by mbasedriver().

| int mbasedriver::Disconnect | ( | ) | [private] |
Disconnect.
- Is theoretically able to disconnect, but we don't do that
References mbasedriverPacket::Build(), mbasedriverPacket::Send(), and StopThreads().

| int mbasedriver::getms | ( | ) | [private] |
| int mbasedriver::HandleCommand | ( | player_msghdr * | hdr, |
| void * | data | ||
| ) | [private] |
HandleCommand.
- Switchboard for robot commands, called from ProcessMessage
- Note that these don't perform a response...
References HandlePositionCommand(), Message::MatchMessage(), PLAYER_MSGTYPE_CMD, and PLAYER_POSITION2D_CMD_VEL.
Referenced by ProcessMessage().

| int mbasedriver::HandleConfig | ( | QueuePointer & | resp_queue, |
| player_msghdr * | hdr, | ||
| void * | data | ||
| ) | [private] |
HandleConfig.
- Handles one Player command with a configuration request
References mbasedriverPacket::Build(), Message::MatchMessage(), player_pose2d::pa, PLAYER_IR_REQ_POSE, PLAYER_MSGTYPE_REQ, PLAYER_MSGTYPE_RESP_ACK, PLAYER_POSITION2D_REQ_GET_GEOM, PLAYER_POSITION2D_REQ_MOTOR_POWER, PLAYER_POSITION2D_REQ_RESET_ODOM, PLAYER_POSITION2D_REQ_SET_ODOM, PLAYER_SONAR_DATA_GEOM, PLAYER_SONAR_REQ_GET_GEOM, PLAYER_WARN, player_position2d_geom::pose, player_position2d_set_odom_req::pose, player_sonar_geom::poses, player_ir_pose::poses, player_sonar_geom::poses_count, player_ir_pose::poses_count, Driver::Publish(), player_pose3d::px, player_pose2d::px, player_pose3d::py, player_pose2d::py, player_pose3d::pyaw, Send(), player_position2d_geom::size, player_msghdr::size, player_bbox3d::sl, player_position2d_power_config::state, player_bbox3d::sw, and ToggleMotorPower().
Referenced by ProcessMessage().

| void mbasedriver::HandlePositionCommand | ( | player_position2d_cmd_vel_t | position_cmd | ) | [private] |
HandlePositionCommand.
- Handles one Player command detailing a velocity
References mbasedriverPacket::Build(), getms(), player_pose2d::pa, player_pose2d::px, Send(), and player_position2d_cmd_vel::vel.
Referenced by HandleCommand().

| void mbasedriver::Main | ( | void | ) | [virtual] |
Main.
- Main entry point for the worker thread
if(!last_position_subscrcount && this->position_subscriptions) { this->ToggleMotorPower(0); this->ResetRawPositions(); } else if(last_position_subscrcount && !(this->position_subscriptions)) { enable motor power this->ToggleMotorPower(1); }
if(!last_aio_ir_subscriptions && this->aio_ir_subscriptions) this->ToggleAIn(1); else if(last_aio_ir_subscriptions && !(this->aio_ir_subscriptions)) this->ToggleAIn(0);
if(!last_sonar_subscriptions && this->sonar_subscriptions) this->ToggleSonar(1); else if(last_sonar_subscriptions && !(this->sonar_subscriptions)) this->ToggleSonar(0);
References Driver::InQueue, and Driver::ProcessMessages().

| int mbasedriver::ProcessMessage | ( | QueuePointer & | resp_queue, |
| player_msghdr * | hdr, | ||
| void * | data | ||
| ) | [virtual] |
ProcessMessage.
- Gets called from ProcessMessages to handle one message
Reimplemented from Driver.
References HandleCommand(), HandleConfig(), PLAYER_MSGTYPE_CMD, PLAYER_MSGTYPE_REQ, and player_msghdr::type.

| void mbasedriver::ReceiveThread | ( | ) | [private] |
ReceiveThread.
- Listens to the robot
References mbasedriverMotorPacket::Fill(), mbasedriverMotorPacket::Parse(), mbasedriverPacket::Print(), mbasedriverPacket::PrintHex(), PublishAIn(), PublishIR(), PublishPosition2D(), PublishPower(), PublishSonar(), and mbasedriverPacket::Receive().

| void mbasedriver::ResetRawPositions | ( | ) | [private] |
ResetRawPositions.
- Tells the robot to reset the odometry center
References mbasedriverPacket::Build(), and Send().

| void mbasedriver::Send | ( | mbasedriverPacket * | packet | ) | [private] |
Send.
- Queues for sending
Referenced by Connect(), HandleConfig(), HandlePositionCommand(), ResetRawPositions(), ToggleAIn(), ToggleMotorPower(), and ToggleSonar().
| int mbasedriver::Setup | ( | void | ) | [virtual] |
| int mbasedriver::Shutdown | ( | void | ) | [virtual] |
| void mbasedriver::StartThreads | ( | ) | [private] |
StrarThreads.
- These call the supplied Driver::StartThread() method, but adds additional threads
References ReceiveThreadDummy(), and SendThreadDummy().

| int mbasedriver::Subscribe | ( | player_devaddr_t | id | ) | [virtual] |
Subscribe.
- Subscription is overridden to add a subscription count of our own
Reimplemented from Driver.
References Device::MatchDeviceAddress(), Driver::Subscribe(), ToggleAIn(), ToggleMotorPower(), and ToggleSonar().

| void mbasedriver::ToggleAIn | ( | unsigned char | val | ) | [private] |
ToggleAIn.
- Enable or disable analog input reporting
References mbasedriverPacket::Build(), and Send().
Referenced by Subscribe(), and Unsubscribe().

| void mbasedriver::ToggleMotorPower | ( | unsigned char | val | ) | [private] |
ToggleMotorPower.
- Enable or disable motors
References mbasedriverPacket::Build(), and Send().
Referenced by HandleConfig(), Subscribe(), and Unsubscribe().

| void mbasedriver::ToggleSonar | ( | unsigned char | val | ) | [private] |
ToggleSonar.
- Enable or disable sonar reporting
References mbasedriverPacket::Build(), and Send().
Referenced by Subscribe(), and Unsubscribe().

The documentation for this class was generated from the following files:
- mbasedriver.h
- mbasedriver.cc

