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{
43public:
44
45 EpuckDriver(ConfigFile* cf, int section);
46
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
62private:
63
64 const unsigned EXPECTED_EPUCK_SIDE_VERSION;
65
66 virtual void Main();
67
68 player_devaddr_t position2dAddr;
69 player_position2d_data_t posData;
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
81 player_blinkenlight_data_t ringLEDsData[EpuckLEDs::RING_LEDS_NUM];
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:197
Base class for all drivers.
Definition driver.h:109
Plug-in driver for the e-puck robot, in conformity with Player version 2.1.
Definition epuckDriver.hpp:42
virtual int Subscribe(player_devaddr_t addr)
Subscribe to this driver.
Definition epuckDriver.cpp:263
virtual void Main()
Main method for driver thread.
Definition epuckDriver.cpp:456
virtual int MainSetup()
Sets up the resources needed by the driver thread.
Definition epuckDriver.cpp:222
virtual int Unsubscribe(player_devaddr_t addr)
Unsubscribe from this driver.
Definition epuckDriver.cpp:274
virtual void MainQuit()
Cleanup method for driver thread (called when main exits)
Definition epuckDriver.cpp:257
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
An autopointer for the message queue.
Definition message.h:74
Send and receive messages from e-puck.
Definition serialPort.hpp:41
Base class for drivers which oeprate with a thread.
Definition driver.h:553
Header file where are the EpuckCamera class, and the exception classes camera_version_error,...
Header file of EpuckIR class and struct EpuckIR::IRData.
Header file where are the EpuckLEDs class and the EpuckLEDs::LEDstate struct.
Header file of the EpuckPosition2d class, and the EpuckPosition2d::BodyGeometry and EpuckPosition2d::...
Header file of SerialPort class.
A device address.
Definition player.h:146
Generic message header.
Definition player.h:162