maneuvers.h
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
27 #ifndef _MANEUVERS_H_
28 #define _MANEUVERS_H_
29 
35 #include <ros/ros.h>
36 #include <atlascar_base/Gamepad.h>
37 #include <atlascar_base/ManagerCommand.h>
38 #include <atlascar_base/ManagerStatus.h>
39 #include <fstream>
40 
41 using namespace std;
42 
43 namespace atlascar_base
44 {
45 class Maneuvers
46 {
47  public:
48  Maneuvers(const ros::NodeHandle& nh_):
49  nh(nh_)
50  {
51 // command_msgs.header
52 
53  command_msg.priority = 1;
54  command_msg.lifetime = std::numeric_limits<double>::infinity();
55 
56  command_msg.velocity = 0;
57 
58  command_msg.auto_ignition = 1;
59  command_msg.auto_brake = 1;
60  command_msg.auto_direction = 1;
61  command_msg.auto_clutch = 1;
62  command_msg.auto_throttle = 1;
63 
64  command_msg.direct_control = 2;
65  }
66 
72  void init();
73 
79  void setupMessaging();
80 
86  void stateManager();
87 
93  void loop();
94 
100  typedef enum
101  {
104 
111  } CarState;
112 
113  typedef enum
114  {
124  TENTH
125  } sequentialState;
126 
132  int maneuver;
133 
134  protected:
135 
136  double map(double value,double min_value,double max_value,double min_required,double max_required);
137 
138  void saveData(string report_name);
144  void positive_velocity(int value);
145 
151  void neutral_velocity(int value);
152 
158  void neutral_velocity_parking(int value);
164  void negative_velocity(int value);
165 
171  void parallel_parking(int value);
172 
178  void reversing(int value);
179 
185  void statusCallback(const atlascar_base::ManagerStatusPtr& status);
186 
192  void parallel();
193 
199  void reverse();
200 
207  CarState current_state;
209 
212 
215 
217  ros::NodeHandle nh;
218 
220  ros::Publisher command_pub;
221 
223  ros::Subscriber command_sub_;
224 
226  ros::Subscriber status_sub;
227 
229  atlascar_base::ManagerCommand command_msg;
230 
232  atlascar_base::ManagerStatus status_msg;
233 
235  atlascar_base::ManagerStatus status_memory;
236 
239 
243 };
244 
245 }
246 #endif
CarState
Car state machine status.
Definition: maneuvers.h:100
ros::Publisher command_pub
Ros command publisher.
Definition: maneuvers.h:220
sequentialState pparking
Moving to stopped state.
Definition: maneuvers.h:211
atlascar_base::ManagerStatus status_msg
Status message.
Definition: maneuvers.h:232
Gamepad gamepad
Gamepad communication class.
Definition: maneuvers.h:238
Maneuvers(const ros::NodeHandle &nh_)
Definition: maneuvers.h:48
Gamepad class.
Definition: Gamepad.h:117
ros::NodeHandle nh
Ros node handler.
Definition: maneuvers.h:217
sequentialState rreverse
Moving to stopped state.
Definition: maneuvers.h:214
Generic gamepad operation class.
ros::Subscriber status_sub
Ros status subscriber.
Definition: maneuvers.h:226
atlascar_base::ManagerStatus status_memory
Status message memory.
Definition: maneuvers.h:235
atlascar_base::ManagerCommand command_msg
Command message.
Definition: maneuvers.h:229
int maneuver
Parking status.
Definition: maneuvers.h:132
ros::Subscriber command_sub_
Ros command subscriber.
Definition: maneuvers.h:223


atlascar_base
Author(s): Jorge Almeida, Sérgio Pinho, Miguel Oliveira, Pedro Salvado, Andre Oliveira and Pedro Pinheiro
autogenerated on Mon Mar 2 2015 01:31:23