epuckDriver.hpp
Go to the documentation of this file.
1 /* Copyright 2008 Renato Florentino Garcia <fgar.renato@gmail.com>
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2, as
5  * published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program. If not, see <http://www.gnu.org/licenses/>.
14  */
15 
16 #ifndef EPUCK_DRIVER2_1_HPP
17 #define EPUCK_DRIVER2_1_HPP
18 
19 #include <libplayercore/playercore.h>
20 #include <string>
21 #include <memory>
22 #include "serialPort.hpp"
23 #include "epuckPosition2d.hpp"
24 #include "epuckIR.hpp"
25 #include "epuckCamera.hpp"
26 #include "epuckLEDs.hpp"
27 
42 {
43 public:
44 
45  EpuckDriver(ConfigFile* cf, int section);
46 
47  ~EpuckDriver();
48 
49  virtual int MainSetup();
50 
51  virtual void MainQuit();
52 
53  virtual int ProcessMessage(QueuePointer &resp_queue,
54  player_msghdr* hdr, void* data);
55 
56  virtual int Subscribe(player_devaddr_t addr);
57 
58  virtual int Unsubscribe(player_devaddr_t addr);
59 
60  static Driver* EpuckDriver_Init(ConfigFile* cf, int section);
61 
62 private:
63 
64  const unsigned EXPECTED_EPUCK_SIDE_VERSION;
65 
66  virtual void Main();
67 
68  player_devaddr_t position2dAddr;
70  std::auto_ptr<EpuckPosition2d> epuckPosition2d;
71 
72  player_devaddr_t irAddr;
73  player_ir_data_t irData;
74  std::auto_ptr<EpuckIR> epuckIR;
75 
76  player_devaddr_t cameraAddr;
77  player_camera_data_t cameraData;
78  std::auto_ptr<EpuckCamera> epuckCamera;
79 
82  player_devaddr_t frontLEDAddr;
83  player_blinkenlight_data_t frontLEDData;
84  player_devaddr_t bodyLEDAddr;
85  player_blinkenlight_data_t bodyLEDData;
86  std::auto_ptr<EpuckLEDs> epuckLEDs;
87 
88  SerialPort* serialPort;
89 };
90 
91 #endif
Class for loading configuration file information.
Definition: configfile.h:196
Generic message header.
Definition: player.h:161
virtual int MainSetup()
Sets up the resources needed by the driver thread.
Definition: epuckDriver.cpp:222
Header file where are the EpuckCamera class, and the exception classes camera_version_error, window_out_of_range and window_length_error.
A device address.
Definition: player.h:145
Header file of the EpuckPosition2d class, and the EpuckPosition2d::BodyGeometry and EpuckPosition2d::...
Base class for drivers which oeprate with a thread.
Definition: driver.h:552
Header file of SerialPort class.
An autopointer for the message queue.
Definition: message.h:73
Data: ranges (PLAYER_IR_DATA_RANGES)
Definition: player_interfaces.h:2115
Data: state (PLAYER_BLINKENLIGHT_DATA_STATE) The blinkenlight data provides the current state of the ...
Definition: player_interfaces.h:2826
virtual void Main()
Main method for driver thread.
Definition: epuckDriver.cpp:456
Header file where are the EpuckLEDs class and the EpuckLEDs::LEDstate struct.
Plug-in driver for the e-puck robot, in conformity with Player version 2.1.
Definition: epuckDriver.hpp:41
Base class for all drivers.
Definition: driver.h:108
Data: state (PLAYER_CAMERA_DATA_STATE)
Definition: player_interfaces.h:2950
virtual int Unsubscribe(player_devaddr_t addr)
Unsubscribe from this driver.
Definition: epuckDriver.cpp:274
position2d data
Definition: player_interfaces.h:606
virtual void MainQuit()
Cleanup method for driver thread (called when main exits)
Definition: epuckDriver.cpp:257
Header file of EpuckIR class and struct EpuckIR::IRData.
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
Definition: epuckDriver.cpp:290
static const unsigned RING_LEDS_NUM
The quantity of LEDs in e-puck ring LEDs.
Definition: epuckLEDs.hpp:36
virtual int Subscribe(player_devaddr_t addr)
Subscribe to this driver.
Definition: epuckDriver.cpp:263
Send and receive messages from e-puck.
Definition: serialPort.hpp:40