class_xbox_teleop.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 ***************************************************************************************************/
32 #include <ros/ros.h>
33 #include <string>
34 #include <iostream>
35 #include <vector>
36 #include <sensor_msgs/Joy.h>
37 #include <sensor_msgs/JointState.h>
38 // #include <atlascar_base/AtlascarCommand.h>
39 
40 
41 
42 #ifndef _ATLASCAR_XBOX_TELEOP_
43 #define _ATLASCAR_XBOX_TELEOP_
44 
45 
46 
47 
48 using namespace std;
49 using namespace ros;
50 
51 
56 {
57  public:
64  XboxTeleopAtlascar(int num_but, int num_axis);
69 
71  struct TYPE_analog{
72  int toggled;
73  float val;
74 
75  friend ostream& operator<<(ostream &o, const TYPE_analog& i)
76  {
77  o<<"toogle:"<<i.toggled<<"\nval:"<<i.val<<endl;
78  return o;
79  }
80  };
81 
83  enum{MAN_AUTO_STEER=0, MAN_AUTO_BRAKE=1, MAN_AUTO_THROTTLE=2, MAN_AUTO_CLUTCH=3, _B4=4, MAN_AUTO_IGNITION=5,\
84  START=6, E_STOP=7, _B8=8, _B9=9, HIGH_LIGHTS=10, WARNING_LIGHTS=11, MEDIUM_LIGHTS=12,\
85  _B13=13, STOP=14};
87  enum{STEERING=0, _A1=1, BRAKE=2, _A3=3, CLUTCH=4, THROTTLE=5};
88 
89 
90  private:
92  void XboxCallback(const sensor_msgs::Joy::ConstPtr& joy);
93 
94  ros::NodeHandle nh_teleop;
96  vector<int> button;
98  vector<TYPE_analog> analog;
99 
101  double steering_max,steering_min;
103  double brake_min,brake_max;
105  double clutch_min,clutch_max;
107  double throttle_min,throttle_max;
108 
109 
111  double steering_left_ang, steering_right_ang;
113  double m_left_ang, b_left_ang, m_right_ang, b_right_ang;
114 
116  double speed_min, speed_max;
118  double m_speed, b_speed;
120  double m_brake, b_brake;
122  int num_buttons, num_axes;
123 
125 // atlascar_base::AtlascarCommand command;
126  ros::Publisher atlascar_cmd_;
127  ros::Subscriber joy_sub_;
128  ros::Publisher ptu_pub;
129 };
130 
131 
132 #endif
ros::Publisher ptu_pub
double m_speed
values to create the linear interpolation
double throttle_min
minimum & maximum throttle values
double speed_min
values to create the linear interpolation
friend ostream & operator<<(ostream &o, const TYPE_analog &i)
double brake_min
minimum & maximum brake values
struct to define a analog button
double m_brake
values to create the linear interpolation
double clutch_min
minimum & maximum clutch values
This class simplifies the implementation of a interface between xbox and PTU.


atlascar_teleop
Author(s): David Gameiro
autogenerated on Mon Mar 2 2015 01:31:27