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 {
49  ros::Time stamp;
50  float brake_joy;
51  float throttle_joy;
52  float steering_joy;
53  bool steering_mult;
54  int gear_cmd;
55  int turn_signal_cmd;
56  int door_select;
57  int door_action;
58  bool joy_throttle_valid;
59  bool joy_brake_valid;
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 
JoystickDemo::strq_
bool strq_
Definition: JoystickDemo.h:94
JoystickDemo::BTN_STEER_MULT_2
@ BTN_STEER_MULT_2
Definition: JoystickDemo.h:112
JoystickDemo::AXIS_TURN_SIG
@ AXIS_TURN_SIG
Definition: JoystickDemo.h:121
JoystickDemo::BTN_STEER_MULT_1
@ BTN_STEER_MULT_1
Definition: JoystickDemo.h:111
JoystickDemo::throttle_gain_
float throttle_gain_
Definition: JoystickDemo.h:88
JoystickDataStruct
Definition: JoystickDemo.h:48
msg
msg
ros::Publisher
JoystickDemo::pub_gear_
ros::Publisher pub_gear_
Definition: JoystickDemo.h:74
JoystickDemo::steer_
bool steer_
Definition: JoystickDemo.h:82
JoystickDemo::BTN_COUNT_X
@ BTN_COUNT_X
Definition: JoystickDemo.h:115
JoystickDemo::pub_disable_
ros::Publisher pub_disable_
Definition: JoystickDemo.h:77
ros.h
JoystickDemo::AXIS_STEER_2
@ AXIS_STEER_2
Definition: JoystickDemo.h:120
JoystickDemo::BTN_COUNT_D
@ BTN_COUNT_D
Definition: JoystickDemo.h:116
JoystickDemo::pub_turn_signal_
ros::Publisher pub_turn_signal_
Definition: JoystickDemo.h:75
JoystickDemo::pub_brake_
ros::Publisher pub_brake_
Definition: JoystickDemo.h:71
JoystickDemo::throttle_
bool throttle_
Definition: JoystickDemo.h:81
JoystickDemo::BTN_REVERSE
@ BTN_REVERSE
Definition: JoystickDemo.h:106
JoystickDemo::BTN_ENABLE
@ BTN_ENABLE
Definition: JoystickDemo.h:109
JoystickDemo::ignore_
bool ignore_
Definition: JoystickDemo.h:91
JoystickDemo::AXIS_DOOR_SELECT
@ AXIS_DOOR_SELECT
Definition: JoystickDemo.h:122
JoystickDemo::BTN_NEUTRAL
@ BTN_NEUTRAL
Definition: JoystickDemo.h:107
JoystickDemo::joy_
sensor_msgs::Joy joy_
Definition: JoystickDemo.h:100
JoystickDemo::counter_
uint8_t counter_
Definition: JoystickDemo.h:101
JoystickDemo::signal_
bool signal_
Definition: JoystickDemo.h:84
JoystickDemo::pub_steering_
ros::Publisher pub_steering_
Definition: JoystickDemo.h:73
JoystickDemo::sub_joy_
ros::Subscriber sub_joy_
Definition: JoystickDemo.h:70
JoystickDemo::enable_
bool enable_
Definition: JoystickDemo.h:92
JoystickDemo::BTN_TRUNK_OPEN
@ BTN_TRUNK_OPEN
Definition: JoystickDemo.h:113
JoystickDemo::recvJoy
void recvJoy(const sensor_msgs::Joy::ConstPtr &msg)
Definition: JoystickDemo.cpp:193
JoystickDemo::AXIS_STEER_1
@ AXIS_STEER_1
Definition: JoystickDemo.h:119
JoystickDemo::brake_
bool brake_
Definition: JoystickDemo.h:80
ros::TimerEvent
JoystickDemo::svel_
float svel_
Definition: JoystickDemo.h:95
JoystickDemo
Definition: JoystickDemo.h:62
JoystickDemo::BTN_TRUNK_CLOSE
@ BTN_TRUNK_CLOSE
Definition: JoystickDemo.h:114
ros::Time
JoystickDemo::timer_
ros::Timer timer_
Definition: JoystickDemo.h:98
JoystickDemo::brake_gain_
float brake_gain_
Definition: JoystickDemo.h:87
JoystickDemo::AXIS_THROTTLE
@ AXIS_THROTTLE
Definition: JoystickDemo.h:117
JoystickDemo::pub_enable_
ros::Publisher pub_enable_
Definition: JoystickDemo.h:76
JoystickDemo::AXIS_DOOR_ACTION
@ AXIS_DOOR_ACTION
Definition: JoystickDemo.h:123
JoystickDemo::BTN_DRIVE
@ BTN_DRIVE
Definition: JoystickDemo.h:108
JoystickDemo::data_
JoystickDataStruct data_
Definition: JoystickDemo.h:99
JoystickDemo::last_steering_filt_output_
float last_steering_filt_output_
Definition: JoystickDemo.h:102
TurnSignalCmd.h
JoystickDemo::AXIS_COUNT_D
@ AXIS_COUNT_D
Definition: JoystickDemo.h:124
JoystickDemo::BTN_DISABLE
@ BTN_DISABLE
Definition: JoystickDemo.h:110
JoystickDemo::pub_throttle_
ros::Publisher pub_throttle_
Definition: JoystickDemo.h:72
JoystickDemo::count_
bool count_
Definition: JoystickDemo.h:93
JoystickDemo::BTN_PARK
@ BTN_PARK
Definition: JoystickDemo.h:105
JoystickDemo::cmdCallback
void cmdCallback(const ros::TimerEvent &event)
Definition: JoystickDemo.cpp:108
JoystickDemo::AXIS_COUNT_X
@ AXIS_COUNT_X
Definition: JoystickDemo.h:125
ros::Timer
node
node
JoystickDemo::AXIS_BRAKE
@ AXIS_BRAKE
Definition: JoystickDemo.h:118
ros::NodeHandle
ros::Subscriber
JoystickDemo::shift_
bool shift_
Definition: JoystickDemo.h:83
JoystickDemo::JoystickDemo
JoystickDemo(ros::NodeHandle &node, ros::NodeHandle &priv_nh)
Definition: JoystickDemo.cpp:37


dbw_fca_joystick_demo
Author(s): Micho Radovnikovich
autogenerated on Fri Jan 5 2024 03:53:42