JoystickDemo.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2018-2019, Dataspeed Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Dataspeed Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 #ifndef JOYSTICKDEMO_H_
36 #define JOYSTICKDEMO_H_
37 
38 #include <ros/ros.h>
39 #include <sensor_msgs/Joy.h>
40 #include <std_msgs/Empty.h>
41 
42 #include <dbw_fca_msgs/ThrottleCmd.h>
43 #include <dbw_fca_msgs/BrakeCmd.h>
44 #include <dbw_fca_msgs/SteeringCmd.h>
45 #include <dbw_fca_msgs/GearCmd.h>
47 
48 typedef struct {
50  float brake_joy;
51  float throttle_joy;
52  float steering_joy;
54  int gear_cmd;
61 
62 class JoystickDemo {
63 public:
65 private:
66  void recvJoy(const sensor_msgs::Joy::ConstPtr& msg);
67  void cmdCallback(const ros::TimerEvent& event);
68 
69  // Topics
78 
79  // Parameters
80  bool brake_; // Send brake commands
81  bool throttle_; // Send throttle commands
82  bool steer_; // Send steering commands
83  bool shift_; // Send shift commands
84  bool signal_; // Send turn signal commands
85 
86  // Parameters
87  float brake_gain_; // Adjust brake value
88  float throttle_gain_; // Adjust throttle value
89 
90  // Parameters
91  bool ignore_; // Ignore driver overrides
92  bool enable_; // Use enable and disable buttons
93  bool count_; // Increment counter to enable watchdog
94  bool strq_; // Steering torque command (otherwise angle)
95  float svel_; // Steering command speed
96 
97  // Variables
100  sensor_msgs::Joy joy_;
101  uint8_t counter_;
103 
104  enum {
105  BTN_PARK = 3,
126  };
127 };
128 
129 #endif /* JOYSTICKDEMO_H_ */
130 
msg
ros::Publisher pub_steering_
Definition: JoystickDemo.h:73
ros::Publisher pub_gear_
Definition: JoystickDemo.h:74
sensor_msgs::Joy joy_
Definition: JoystickDemo.h:100
ros::Publisher pub_brake_
Definition: JoystickDemo.h:71
JoystickDataStruct data_
Definition: JoystickDemo.h:99
ros::Timer timer_
Definition: JoystickDemo.h:98
JoystickDemo(ros::NodeHandle &node, ros::NodeHandle &priv_nh)
ros::Publisher pub_enable_
Definition: JoystickDemo.h:76
ros::Publisher pub_disable_
Definition: JoystickDemo.h:77
ros::Subscriber sub_joy_
Definition: JoystickDemo.h:70
void recvJoy(const sensor_msgs::Joy::ConstPtr &msg)
uint8_t counter_
Definition: JoystickDemo.h:101
ros::Publisher pub_throttle_
Definition: JoystickDemo.h:72
void cmdCallback(const ros::TimerEvent &event)
ros::Publisher pub_turn_signal_
Definition: JoystickDemo.h:75
float last_steering_filt_output_
Definition: JoystickDemo.h:102
float throttle_gain_
Definition: JoystickDemo.h:88
float brake_gain_
Definition: JoystickDemo.h:87
node


dbw_fca_joystick_demo
Author(s): Micho Radovnikovich
autogenerated on Wed May 12 2021 02:14:09