DbwNode.cpp
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 #include "DbwNode.h"
36 #include <dbw_fca_can/dispatch.h>
37 #include <dbw_fca_can/pedal_lut.h>
38 
39 // Log once per unique identifier, similar to ROS_LOG_ONCE()
40 #define ROS_LOG_ONCE_ID(id, level, name, ...) \
41  do \
42  { \
43  ROSCONSOLE_DEFINE_LOCATION(true, level, name); \
44  static std::map<int, bool> map; \
45  bool &hit = map[id]; \
46  if (ROS_UNLIKELY(__rosconsole_define_location__enabled) && ROS_UNLIKELY(!hit)) \
47  { \
48  hit = true; \
49  ROSCONSOLE_PRINT_AT_LOCATION(__VA_ARGS__); \
50  } \
51  } while(false)
52 #define ROS_DEBUG_ONCE_ID(id, ...) ROS_LOG_ONCE_ID(id, ::ros::console::levels::Debug, ROSCONSOLE_DEFAULT_NAME, __VA_ARGS__)
53 #define ROS_INFO_ONCE_ID(id, ...) ROS_LOG_ONCE_ID(id, ::ros::console::levels::Info, ROSCONSOLE_DEFAULT_NAME, __VA_ARGS__)
54 #define ROS_WARN_ONCE_ID(id, ...) ROS_LOG_ONCE_ID(id, ::ros::console::levels::Warn, ROSCONSOLE_DEFAULT_NAME, __VA_ARGS__)
55 #define ROS_ERROR_ONCE_ID(id, ...) ROS_LOG_ONCE_ID(id, ::ros::console::levels::Error, ROSCONSOLE_DEFAULT_NAME, __VA_ARGS__)
56 #define ROS_FATAL_ONCE_ID(id, ...) ROS_LOG_ONCE_ID(id, ::ros::console::levels::Fatal, ROSCONSOLE_DEFAULT_NAME, __VA_ARGS__)
57 
58 namespace dbw_fca_can
59 {
60 
61 // Latest firmware versions
62 PlatformMap FIRMWARE_LATEST({
63  {PlatformVersion(P_FCA_RU, M_BPEC, ModuleVersion(1,6,2))},
64  {PlatformVersion(P_FCA_RU, M_TPEC, ModuleVersion(1,6,2))},
65  {PlatformVersion(P_FCA_RU, M_STEER, ModuleVersion(1,6,2))},
66  {PlatformVersion(P_FCA_RU, M_SHIFT, ModuleVersion(1,6,2))},
67  {PlatformVersion(P_FCA_WK2, M_TPEC, ModuleVersion(1,4,2))},
68  {PlatformVersion(P_FCA_WK2, M_STEER, ModuleVersion(1,4,2))},
69  {PlatformVersion(P_FCA_WK2, M_SHIFT, ModuleVersion(1,4,2))},
70  {PlatformVersion(P_FCA_WK2, M_ABS, ModuleVersion(1,4,2))},
71 });
72 
73 // Minimum firmware versions required for using the new SVEL resolution of 4 deg/s
74 PlatformMap FIRMWARE_HIGH_RATE_LIMIT({
75  {PlatformVersion(P_FCA_RU, M_STEER, ModuleVersion(1,1,0))},
76  {PlatformVersion(P_FCA_WK2, M_STEER, ModuleVersion(0,2,0))},
77 });
78 
80 : sync_imu_(10, boost::bind(&DbwNode::recvCanImu, this, _1), ID_REPORT_ACCEL, ID_REPORT_GYRO)
81 , sync_gps_(10, boost::bind(&DbwNode::recvCanGps, this, _1), ID_REPORT_GPS1, ID_REPORT_GPS2, ID_REPORT_GPS3)
82 {
83  // Reduce synchronization delay
84  sync_imu_.setInterMessageLowerBound(ros::Duration(0.006)); // 20ms period
86 
87  // Initialize enable state machine
88  prev_enable_ = true;
89  enable_ = false;
90  override_brake_ = false;
91  override_throttle_ = false;
92  override_steering_ = false;
93  override_gear_ = false;
94  fault_brakes_ = false;
95  fault_throttle_ = false;
96  fault_steering_ = false;
97  fault_steering_cal_ = false;
98  fault_watchdog_ = false;
100  fault_watchdog_warned_ = false;
101  timeout_brakes_ = false;
102  timeout_throttle_ = false;
103  timeout_steering_ = false;
104  enabled_brakes_ = false;
105  enabled_throttle_ = false;
106  enabled_steering_ = false;
107  gear_warned_ = false;
108 
109  // Frame ID
110  frame_id_ = "base_footprint";
111  priv_nh.getParam("frame_id", frame_id_);
112 
113  // Warn on received commands
114  warn_cmds_ = true;
115  priv_nh.getParam("warn_cmds", warn_cmds_);
116 
117  // Buttons (enable/disable)
118  buttons_ = true;
119  priv_nh.getParam("buttons", buttons_);
120 
121  // Pedal LUTs (local/embedded)
122  pedal_luts_ = false;
123  priv_nh.getParam("pedal_luts", pedal_luts_);
124 
125  // Ackermann steering parameters
126  acker_wheelbase_ = 3.08864; // 121.6 inches
127  acker_track_ = 1.73228; // 68.2 inches
128  steering_ratio_ = 16.2;
129  wheel_radius_ = 0.365;
130  priv_nh.getParam("ackermann_wheelbase", acker_wheelbase_);
131  priv_nh.getParam("ackermann_track", acker_track_);
132  priv_nh.getParam("steering_ratio", steering_ratio_);
133 
134  // Initialize joint states
135  joint_state_.position.resize(JOINT_COUNT);
136  joint_state_.velocity.resize(JOINT_COUNT);
137  joint_state_.effort.resize(JOINT_COUNT);
138  joint_state_.name.resize(JOINT_COUNT);
139  joint_state_.name[JOINT_FL] = "wheel_fl_joint"; // Front Left
140  joint_state_.name[JOINT_FR] = "wheel_fr_joint"; // Front Right
141  joint_state_.name[JOINT_RL] = "wheel_rl_joint"; // Rear Left
142  joint_state_.name[JOINT_RR] = "wheel_rr_joint"; // Rear Right
143  joint_state_.name[JOINT_SL] = "steer_fl_joint";
144  joint_state_.name[JOINT_SR] = "steer_fr_joint";
145 
146  // Setup Publishers
147  pub_can_ = node.advertise<can_msgs::Frame>("can_tx", 10);
148  pub_brake_ = node.advertise<dbw_fca_msgs::BrakeReport>("brake_report", 2);
149  pub_throttle_ = node.advertise<dbw_fca_msgs::ThrottleReport>("throttle_report", 2);
150  pub_steering_ = node.advertise<dbw_fca_msgs::SteeringReport>("steering_report", 2);
151  pub_gear_ = node.advertise<dbw_fca_msgs::GearReport>("gear_report", 2);
152  pub_misc_1_ = node.advertise<dbw_fca_msgs::Misc1Report>("misc_1_report", 2);
153  pub_misc_2_ = node.advertise<dbw_fca_msgs::Misc2Report>("misc_2_report", 2);
154  pub_wheel_speeds_ = node.advertise<dbw_fca_msgs::WheelSpeedReport>("wheel_speed_report", 2);
155  pub_wheel_positions_ = node.advertise<dbw_fca_msgs::WheelPositionReport>("wheel_position_report", 2);
156  pub_tire_pressure_ = node.advertise<dbw_fca_msgs::TirePressureReport>("tire_pressure_report", 2);
157  pub_fuel_level_ = node.advertise<dbw_fca_msgs::FuelLevelReport>("fuel_level_report", 2);
158  pub_brake_info_ = node.advertise<dbw_fca_msgs::BrakeInfoReport>("brake_info_report", 2);
159  pub_throttle_info_ = node.advertise<dbw_fca_msgs::ThrottleInfoReport>("throttle_info_report", 2);
160  pub_imu_ = node.advertise<sensor_msgs::Imu>("imu/data_raw", 10);
161  pub_gps_fix_ = node.advertise<sensor_msgs::NavSatFix>("gps/fix", 10);
162  pub_gps_time_ = node.advertise<sensor_msgs::TimeReference>("gps/time", 10);
163  pub_gps_fix_dr = node.advertise<sensor_msgs::NavSatFix>("gps_dr/fix", 10);
164  pub_twist_ = node.advertise<geometry_msgs::TwistStamped>("twist", 10);
165  pub_vin_ = node.advertise<std_msgs::String>("vin", 1, true);
166  pub_sys_enable_ = node.advertise<std_msgs::Bool>("dbw_enabled", 1, true);
168 
169  // Publish joint states if enabled
170  priv_nh.param("joint_states", enable_joint_states_, true);
171  if (enable_joint_states_) {
172  pub_joint_states_ = node.advertise<sensor_msgs::JointState>("joint_states", 10);
173  }
174 
175  // Setup Subscribers
177  sub_enable_ = node.subscribe("enable", 10, &DbwNode::recvEnable, this, NODELAY);
178  sub_disable_ = node.subscribe("disable", 10, &DbwNode::recvDisable, this, NODELAY);
179  sub_can_ = node.subscribe("can_rx", 100, &DbwNode::recvCAN, this, NODELAY);
180  sub_brake_ = node.subscribe("brake_cmd", 1, &DbwNode::recvBrakeCmd, this, NODELAY);
181  sub_throttle_ = node.subscribe("throttle_cmd", 1, &DbwNode::recvThrottleCmd, this, NODELAY);
182  sub_steering_ = node.subscribe("steering_cmd", 1, &DbwNode::recvSteeringCmd, this, NODELAY);
183  sub_gear_ = node.subscribe("gear_cmd", 1, &DbwNode::recvGearCmd, this, NODELAY);
184  sub_turn_signal_ = node.subscribe("turn_signal_cmd", 1, &DbwNode::recvMiscCmd, this, NODELAY); // Backwards compatiblity
185  sub_misc_ = node.subscribe("misc_cmd", 1, &DbwNode::recvMiscCmd, this, NODELAY);
186 
187  // Setup Timer
188  timer_ = node.createTimer(ros::Duration(1 / 20.0), &DbwNode::timerCallback, this);
189 }
190 
192 {
193 }
194 
195 void DbwNode::recvEnable(const std_msgs::Empty::ConstPtr& msg)
196 {
197  enableSystem();
198 }
199 
200 void DbwNode::recvDisable(const std_msgs::Empty::ConstPtr& msg)
201 {
202  disableSystem();
203 }
204 
205 void DbwNode::recvCAN(const can_msgs::Frame::ConstPtr& msg)
206 {
207  sync_imu_.processMsg(msg);
208  sync_gps_.processMsg(msg);
209  if (!msg->is_rtr && !msg->is_error && !msg->is_extended) {
210  switch (msg->id) {
211  case ID_BRAKE_REPORT:
212  if (msg->dlc >= sizeof(MsgBrakeReport)) {
213  const MsgBrakeReport *ptr = (const MsgBrakeReport*)msg->data.elems;
214  faultBrakes(ptr->FLT1 || ptr->FLT2);
215  faultWatchdog(ptr->FLTWDC, ptr->WDCSRC, ptr->WDCBRK);
216  overrideBrake(ptr->OVERRIDE, ptr->TMOUT);
217  timeoutBrake(ptr->TMOUT, ptr->ENABLED);
218  dbw_fca_msgs::BrakeReport out;
219  out.header.stamp = msg->header.stamp;
220  if (ptr->BTYPE == 0) {
221  // Brake pedal emulator for hybrid electric vehicles
222  out.pedal_input = (float)ptr->PI / UINT16_MAX;
223  out.pedal_cmd = (float)ptr->PC / UINT16_MAX;
224  out.pedal_output = (float)ptr->PO / UINT16_MAX;
225  out.torque_input = brakeTorqueFromPedal(out.pedal_input);
226  out.torque_cmd = brakeTorqueFromPedal(out.pedal_cmd);
227  out.torque_output = brakeTorqueFromPedal(out.pedal_output);
228  } else if (ptr->BTYPE == 1) {
229  // ACC/AEB braking for non-hybrid vehicles
230  out.torque_input = ptr->PI;
231  out.decel_cmd = ptr->PC * 1e-3f;
232  out.decel_output = ptr->PO * 1e-3f;
233  } else {
234  ROS_WARN_THROTTLE(5.0, "Unsupported brake report type: %u", ptr->BTYPE);
235  }
236  out.enabled = ptr->ENABLED ? true : false;
237  out.override = ptr->OVERRIDE ? true : false;
238  out.driver = ptr->DRIVER ? true : false;
239  out.watchdog_counter.source = ptr->WDCSRC;
240  out.watchdog_braking = ptr->WDCBRK ? true : false;
241  out.fault_wdc = ptr->FLTWDC ? true : false;
242  out.fault_ch1 = ptr->FLT1 ? true : false;
243  out.fault_ch2 = ptr->FLT2 ? true : false;
244  out.fault_power = ptr->FLTPWR ? true : false;
245  out.timeout = ptr->TMOUT ? true : false;
246  pub_brake_.publish(out);
247  if (ptr->FLT1 || ptr->FLT2 || ptr->FLTPWR) {
248  ROS_WARN_THROTTLE(5.0, "Brake fault. FLT1: %s FLT2: %s FLTPWR: %s",
249  ptr->FLT1 ? "true, " : "false,",
250  ptr->FLT2 ? "true, " : "false,",
251  ptr->FLTPWR ? "true" : "false");
252  }
253  }
254  break;
255 
256  case ID_THROTTLE_REPORT:
257  if (msg->dlc >= sizeof(MsgThrottleReport)) {
258  const MsgThrottleReport *ptr = (const MsgThrottleReport*)msg->data.elems;
259  faultThrottle(ptr->FLT1 || ptr->FLT2);
260  faultWatchdog(ptr->FLTWDC, ptr->WDCSRC);
261  overrideThrottle(ptr->OVERRIDE, ptr->TMOUT);
262  timeoutThrottle(ptr->TMOUT, ptr->ENABLED);
263  dbw_fca_msgs::ThrottleReport out;
264  out.header.stamp = msg->header.stamp;
265  out.pedal_input = (float)ptr->PI / UINT16_MAX;
266  out.pedal_cmd = (float)ptr->PC / UINT16_MAX;
267  out.pedal_output = (float)ptr->PO / UINT16_MAX;
268  out.enabled = ptr->ENABLED ? true : false;
269  out.override = ptr->OVERRIDE ? true : false;
270  out.driver = ptr->DRIVER ? true : false;
271  out.watchdog_counter.source = ptr->WDCSRC;
272  out.fault_wdc = ptr->FLTWDC ? true : false;
273  out.fault_ch1 = ptr->FLT1 ? true : false;
274  out.fault_ch2 = ptr->FLT2 ? true : false;
275  out.fault_power = ptr->FLTPWR ? true : false;
276  out.timeout = ptr->TMOUT ? true : false;
277  pub_throttle_.publish(out);
278  if (ptr->FLT1 || ptr->FLT2 || ptr->FLTPWR) {
279  ROS_WARN_THROTTLE(5.0, "Throttle fault. FLT1: %s FLT2: %s FLTPWR: %s",
280  ptr->FLT1 ? "true, " : "false,",
281  ptr->FLT2 ? "true, " : "false,",
282  ptr->FLTPWR ? "true" : "false");
283  }
284  }
285  break;
286 
287  case ID_STEERING_REPORT:
288  if (msg->dlc >= sizeof(MsgSteeringReport)) {
289  const MsgSteeringReport *ptr = (const MsgSteeringReport*)msg->data.elems;
290  faultSteering(ptr->FLTBUS1 || ptr->FLTBUS2);
291  faultSteeringCal(ptr->FLTCAL);
292  faultWatchdog(ptr->FLTWDC);
293  overrideSteering(ptr->OVERRIDE, ptr->TMOUT);
294  timeoutSteering(ptr->TMOUT, ptr->ENABLED);
295  dbw_fca_msgs::SteeringReport out;
296  out.header.stamp = msg->header.stamp;
297  if ((uint16_t)ptr->ANGLE == 0x8000) {
298  out.steering_wheel_angle = NAN;
299  } else {
300  out.steering_wheel_angle = (float)ptr->ANGLE * (float)(0.1 * M_PI / 180);
301  }
302  out.steering_wheel_cmd_type = ptr->TMODE ? dbw_fca_msgs::SteeringReport::CMD_TORQUE : dbw_fca_msgs::SteeringReport::CMD_ANGLE;
303  if ((uint16_t)ptr->CMD == 0xC000) {
304  out.steering_wheel_cmd = NAN;
305  } else if (out.steering_wheel_cmd_type == dbw_fca_msgs::SteeringReport::CMD_ANGLE) {
306  out.steering_wheel_cmd = (float)ptr->CMD * (float)(0.1 * M_PI / 180);
307  } else {
308  out.steering_wheel_cmd = (float)ptr->CMD / 128.0f;
309  }
310  if ((uint8_t)ptr->TORQUE == 0x80) {
311  out.steering_wheel_torque = NAN;
312  } else {
313  out.steering_wheel_torque = (float)ptr->TORQUE * (float)0.0625;
314  }
315  if ((uint16_t)ptr->VEH_VEL == 0x8000) {
316  out.speed = NAN;
317  } else {
318  out.speed = (float)ptr->VEH_VEL * (float)(0.01 / 3.6);
319  }
320  out.enabled = ptr->ENABLED ? true : false;
321  out.override = ptr->OVERRIDE ? true : false;
322  out.fault_wdc = ptr->FLTWDC ? true : false;
323  out.fault_bus1 = ptr->FLTBUS1 ? true : false;
324  out.fault_bus2 = ptr->FLTBUS2 ? true : false;
325  out.fault_calibration = ptr->FLTCAL ? true : false;
326  out.fault_power = ptr->FLTPWR ? true : false;
327  out.timeout = ptr->TMOUT ? true : false;
328  pub_steering_.publish(out);
329  geometry_msgs::TwistStamped twist;
330  twist.header.stamp = out.header.stamp;
331  twist.header.frame_id = frame_id_;
332  twist.twist.linear.x = out.speed;
333  twist.twist.angular.z = out.speed * tan(out.steering_wheel_angle / steering_ratio_) / acker_wheelbase_;
334  pub_twist_.publish(twist);
335  if (enable_joint_states_) {
336  publishJointStates(msg->header.stamp, &out);
337  }
338  if (ptr->FLTBUS1 || ptr->FLTBUS2 || ptr->FLTPWR) {
339  ROS_WARN_THROTTLE(5.0, "Steering fault. FLT1: %s FLT2: %s FLTPWR: %s",
340  ptr->FLTBUS1 ? "true, " : "false,",
341  ptr->FLTBUS2 ? "true, " : "false,",
342  ptr->FLTPWR ? "true" : "false");
343  } else if (ptr->FLTCAL) {
344  ROS_WARN_THROTTLE(5.0, "Steering calibration fault. Drive at least 25 mph for at least 10 seconds in a straight line.");
345  }
346  }
347  break;
348 
349  case ID_GEAR_REPORT:
350  if (msg->dlc >= 1) {
351  const MsgGearReport *ptr = (const MsgGearReport*)msg->data.elems;
352  overrideGear(ptr->OVERRIDE);
353  dbw_fca_msgs::GearReport out;
354  out.header.stamp = msg->header.stamp;
355  out.state.gear = ptr->STATE;
356  out.cmd.gear = ptr->CMD;
357  out.ready = ptr->READY ? true : false;
358  out.override = ptr->OVERRIDE ? true : false;
359  out.fault_bus = ptr->FLTBUS ? true : false;
360  if (msg->dlc >= sizeof(MsgGearReport)) {
361  out.reject.value = ptr->REJECT;
362  if (out.reject.value == dbw_fca_msgs::GearReject::NONE) {
363  gear_warned_ = false;
364  } else if (!gear_warned_) {
365  gear_warned_ = true;
366  switch (out.reject.value) {
367  case dbw_fca_msgs::GearReject::SHIFT_IN_PROGRESS:
368  ROS_WARN("Gear shift rejected: Shift in progress");
369  break;
370  case dbw_fca_msgs::GearReject::OVERRIDE:
371  ROS_WARN("Gear shift rejected: Override on brake, throttle, or steering");
372  break;
373  case dbw_fca_msgs::GearReject::VEHICLE:
374  ROS_WARN("Gear shift rejected: Rejected by vehicle, try pressing the brakes");
375  break;
376  case dbw_fca_msgs::GearReject::UNSUPPORTED:
377  ROS_WARN("Gear shift rejected: Unsupported gear command");
378  break;
379  case dbw_fca_msgs::GearReject::FAULT:
380  ROS_WARN("Gear shift rejected: System in fault state");
381  break;
382  }
383  }
384  }
385  pub_gear_.publish(out);
386  }
387  break;
388 
389  case ID_MISC_REPORT:
390  if (msg->dlc >= sizeof(MsgMiscReport)) {
391  const MsgMiscReport *ptr = (const MsgMiscReport*)msg->data.elems;
392  if (buttons_) {
393  if (0) {
394  buttonCancel();
395  } else if ((ptr->btn_ld_left && ptr->btn_ld_down)) {
396  enableSystem();
397  }
398  }
399  dbw_fca_msgs::Misc1Report out;
400  out.header.stamp = msg->header.stamp;
401  out.turn_signal.value = ptr->turn_signal;
402  out.high_beam.value = ptr->head_light_hi;
403  out.wiper.status = ptr->wiper_front;
404  out.btn_cc_on_off = ptr->btn_cc_on_off ? true : false;
405  out.btn_cc_res = ptr->btn_cc_res ? true : false;
406  out.btn_cc_cncl = ptr->btn_cc_cncl ? true : false;
407  out.btn_cc_set_inc = ptr->btn_cc_set_inc ? true : false;
408  out.btn_cc_set_dec = ptr->btn_cc_set_dec ? true : false;
409  out.btn_cc_gap_inc = ptr->btn_cc_gap_inc ? true : false;
410  out.btn_cc_gap_dec = ptr->btn_cc_gap_dec ? true : false;
411  out.btn_cc_mode = ptr->btn_cc_mode ? true : false;
412  out.btn_ld_ok = ptr->btn_ld_ok ? true : false;
413  out.btn_ld_up = ptr->btn_ld_up ? true : false;
414  out.btn_ld_down = ptr->btn_ld_down ? true : false;
415  out.btn_ld_left = ptr->btn_ld_left ? true : false;
416  out.btn_ld_right = ptr->btn_ld_right ? true : false;
417  out.fault_bus = ptr->FLTBUS ? true : false;
418  out.door_rear_left = ptr->door_rear_left ? true : false;
419  out.door_rear_right = ptr->door_rear_right ? true : false;
420  out.door_trunk = ptr->door_trunk ? true : false;
421  pub_misc_1_.publish(out);
422  }
423  break;
424 
425  case ID_MISC2_REPORT:
426  if (msg->dlc >= sizeof(MsgMisc2Report)) {
427  const MsgMisc2Report *ptr = (const MsgMisc2Report*)msg->data.elems;
428  dbw_fca_msgs::Misc2Report out;
429  out.header.stamp = msg->header.stamp;
430  out.ft_drv_temp.value = ptr->ft_drv_temp_stat;
431  out.ft_psg_temp.value = ptr->ft_psg_temp_stat;
432  out.ft_fan_speed.value = ptr->ft_fn_sp_stat;
433  out.max_ac = ptr->max_ac ? true : false;
434  out.ac = ptr->ac ? true : false;
435  out.ft_hvac = ptr->ft_hvac ? true : false;
436  out.auto_md = ptr->auto_md ? true : false;
437  out.recirc = ptr->recirc ? true : false;
438  out.sync = ptr->sync ? true : false;
439  out.r_defr = ptr->r_defr ? true : false;
440  out.f_defr = ptr->f_defr ? true : false;
441  out.vent_mode.value = ptr->vent_md_stat;
442  out.heated_steering_wheel = ptr->hsw_stat ? true : false;
443  out.fl_heated_seat.value = ptr->fl_hs_stat;
444  out.fl_vented_seat.value = ptr->fl_vs_stat;
445  out.fr_heated_seat.value = ptr->fr_hs_stat;
446  out.fr_vented_seat.value = ptr->fr_vs_stat;
447  pub_misc_2_.publish(out);
448  }
449  break;
450 
452  if (msg->dlc >= sizeof(MsgReportWheelSpeed)) {
453  const MsgReportWheelSpeed *ptr = (const MsgReportWheelSpeed*)msg->data.elems;
454  dbw_fca_msgs::WheelSpeedReport out;
455  out.header.stamp = msg->header.stamp;
456  if ((uint16_t)ptr->front_left == 0x8000) {
457  out.front_left = NAN;
458  } else {
459  out.front_left = (float)ptr->front_left * 0.01f;
460  }
461  if ((uint16_t)ptr->front_right == 0x8000) {
462  out.front_right = NAN;
463  } else {
464  out.front_right = (float)ptr->front_right * 0.01f;
465  }
466  if ((uint16_t)ptr->rear_left == 0x8000) {
467  out.rear_left = NAN;
468  } else {
469  out.rear_left = (float)ptr->rear_left * 0.01f;
470  }
471  if ((uint16_t)ptr->rear_right == 0x8000) {
472  out.rear_right = NAN;
473  } else {
474  out.rear_right = (float)ptr->rear_right * 0.01f;
475  }
477  }
478  break;
479 
481  if (msg->dlc >= sizeof(MsgReportWheelPosition)) {
482  const MsgReportWheelPosition *ptr = (const MsgReportWheelPosition*)msg->data.elems;
483  dbw_fca_msgs::WheelPositionReport out;
484  out.header.stamp = msg->header.stamp;
485  out.front_left = ptr->front_left;
486  out.front_right = ptr->front_right;
487  out.rear_left = ptr->rear_left;
488  out.rear_right = ptr->rear_right;
490  }
491  break;
492 
494  if (msg->dlc >= sizeof(MsgReportTirePressure)) {
495  const MsgReportTirePressure *ptr = (const MsgReportTirePressure*)msg->data.elems;
496  dbw_fca_msgs::TirePressureReport out;
497  out.header.stamp = msg->header.stamp;
498  if (ptr->front_left == 0xFFFF) {
499  out.front_left = NAN;
500  } else {
501  out.front_left = (float)ptr->front_left;
502  }
503  if (ptr->front_right == 0xFFFF) {
504  out.front_right = NAN;
505  } else {
506  out.front_right = (float)ptr->front_right;
507  }
508  if (ptr->rear_left == 0xFFFF) {
509  out.rear_left = NAN;
510  } else {
511  out.rear_left = (float)ptr->rear_left;
512  }
513  if (ptr->rear_right == 0xFFFF) {
514  out.rear_right = NAN;
515  } else {
516  out.rear_right = (float)ptr->rear_right;
517  }
519  }
520  break;
521 
522 
524  if (msg->dlc >= 2) {
525  const MsgReportFuelLevel *ptr = (const MsgReportFuelLevel*)msg->data.elems;
526  dbw_fca_msgs::FuelLevelReport out;
527  out.header.stamp = msg->header.stamp;
528  out.fuel_level = (float)ptr->fuel_level * 0.108696f;
529  if (msg->dlc >= sizeof(MsgReportFuelLevel)) {
530  out.battery_12v = (float)ptr->battery_12v * 0.0625f;
531  out.odometer = (float)ptr->odometer * 0.1f;
532  }
534  }
535  break;
536 
538  if (msg->dlc >= sizeof(MsgReportBrakeInfo)) {
539  const MsgReportBrakeInfo *ptr = (const MsgReportBrakeInfo*)msg->data.elems;
540  dbw_fca_msgs::BrakeInfoReport out;
541  out.header.stamp = msg->header.stamp;
542  if (ptr->brake_pc == 0xFF) {
543  out.brake_pc = NAN;
544  } else {
545  out.brake_pc = (float)ptr->brake_pc * 0.4f;
546  }
547  if (ptr->brake_torque_request == 0xFFF) {
548  out.brake_torque_request = NAN;
549  } else {
550  out.brake_torque_request = (float)ptr->brake_torque_request * 3.0f;
551  }
552  if (ptr->brake_torque_actual == 0xFFF) {
553  out.brake_torque_actual = NAN;
554  } else {
555  out.brake_torque_actual = (float)ptr->brake_torque_actual * 3.0f;
556  }
557  if (ptr->brake_pressure == 0x7FF) {
558  out.brake_pressure = NAN;
559  } else {
560  out.brake_pressure = (float)ptr->brake_pressure * 0.1f;
561  }
562  out.stationary = ptr->stationary;
564  }
565  break;
566 
568  if (msg->dlc >= sizeof(MsgReportThrottleInfo)) {
569  const MsgReportThrottleInfo *ptr = (const MsgReportThrottleInfo*)msg->data.elems;
570  dbw_fca_msgs::ThrottleInfoReport out;
571  out.header.stamp = msg->header.stamp;
572  if (ptr->throttle_pc == 0xFF) {
573  out.throttle_pc = NAN;
574  } else {
575  out.throttle_pc = (float)ptr->throttle_pc * 0.4f;
576  }
577  if ((uint16_t)ptr->axle_torque == 0xC000) {
578  out.axle_torque = NAN;
579  } else {
580  out.axle_torque = (float)ptr->axle_torque * 1.5625f;
581  }
582  out.gear_num.num = ptr->gear_num;
583  out.ignition.value = ptr->ign_stat;
585  }
586  break;
587 
588  case ID_LICENSE:
589  if (msg->dlc >= sizeof(MsgLicense)) {
590  const MsgLicense *ptr = (const MsgLicense*)msg->data.elems;
591  const Module module = ptr->module ? (Module)ptr->module : M_STEER; // Legacy steering firmware reports zero for module
592  const char * str_m = moduleToString(module);
593  ROS_DEBUG("LICENSE(%x,%02X,%s)", ptr->module, ptr->mux, str_m);
594  if (ptr->ready) {
595  ROS_INFO_ONCE_ID(module, "Licensing: %s ready", str_m);
596  if (ptr->trial) {
597  ROS_WARN_ONCE_ID(module, "Licensing: %s one or more features licensed as a counted trial. Visit https://www.dataspeedinc.com/products/maintenance-subscription/ to request a full license.", str_m);
598  }
599  if (ptr->expired) {
600  ROS_WARN_ONCE_ID(module, "Licensing: %s one or more feature licenses expired due to the firmware build date", str_m);
601  }
602  } else if (module == M_STEER) {
603  ROS_INFO_THROTTLE(10.0, "Licensing: Waiting for VIN...");
604  } else {
605  ROS_INFO_THROTTLE(10.0, "Licensing: Waiting for required info...");
606  }
607  if (ptr->mux == LIC_MUX_LDATE0) {
608  if (ldate_.size() == 0) {
609  ldate_.push_back(ptr->ldate0.ldate0);
610  ldate_.push_back(ptr->ldate0.ldate1);
611  ldate_.push_back(ptr->ldate0.ldate2);
612  ldate_.push_back(ptr->ldate0.ldate3);
613  ldate_.push_back(ptr->ldate0.ldate4);
614  ldate_.push_back(ptr->ldate0.ldate5);
615  }
616  } else if (ptr->mux == LIC_MUX_LDATE1) {
617  if (ldate_.size() == 6) {
618  ldate_.push_back(ptr->ldate1.ldate6);
619  ldate_.push_back(ptr->ldate1.ldate7);
620  ldate_.push_back(ptr->ldate1.ldate8);
621  ldate_.push_back(ptr->ldate1.ldate9);
622  ROS_INFO("Licensing: %s license string date: %s", str_m, ldate_.c_str());
623  }
624  } else if (ptr->mux == LIC_MUX_MAC) {
625  ROS_INFO_ONCE("Licensing: %s MAC: %02X:%02X:%02X:%02X:%02X:%02X", str_m,
626  ptr->mac.addr0, ptr->mac.addr1,
627  ptr->mac.addr2, ptr->mac.addr3,
628  ptr->mac.addr4, ptr->mac.addr5);
629  } else if (ptr->mux == LIC_MUX_BDATE0) {
630  std::string &bdate = bdate_[module];
631  if (bdate.size() == 0) {
632  bdate.push_back(ptr->bdate0.date0);
633  bdate.push_back(ptr->bdate0.date1);
634  bdate.push_back(ptr->bdate0.date2);
635  bdate.push_back(ptr->bdate0.date3);
636  bdate.push_back(ptr->bdate0.date4);
637  bdate.push_back(ptr->bdate0.date5);
638  }
639  } else if (ptr->mux == LIC_MUX_BDATE1) {
640  std::string &bdate = bdate_[module];
641  if (bdate.size() == 6) {
642  bdate.push_back(ptr->bdate1.date6);
643  bdate.push_back(ptr->bdate1.date7);
644  bdate.push_back(ptr->bdate1.date8);
645  bdate.push_back(ptr->bdate1.date9);
646  ROS_INFO("Licensing: %s firmware build date: %s", str_m, bdate.c_str());
647  }
648  } else if (ptr->mux == LIC_MUX_VIN0) {
649  if (vin_.size() == 0) {
650  vin_.push_back(ptr->vin0.vin00);
651  vin_.push_back(ptr->vin0.vin01);
652  vin_.push_back(ptr->vin0.vin02);
653  vin_.push_back(ptr->vin0.vin03);
654  vin_.push_back(ptr->vin0.vin04);
655  vin_.push_back(ptr->vin0.vin05);
656  }
657  } else if (ptr->mux == LIC_MUX_VIN1) {
658  if (vin_.size() == 6) {
659  vin_.push_back(ptr->vin1.vin06);
660  vin_.push_back(ptr->vin1.vin07);
661  vin_.push_back(ptr->vin1.vin08);
662  vin_.push_back(ptr->vin1.vin09);
663  vin_.push_back(ptr->vin1.vin10);
664  vin_.push_back(ptr->vin1.vin11);
665  }
666  } else if (ptr->mux == LIC_MUX_VIN2) {
667  if (vin_.size() == 12) {
668  vin_.push_back(ptr->vin2.vin12);
669  vin_.push_back(ptr->vin2.vin13);
670  vin_.push_back(ptr->vin2.vin14);
671  vin_.push_back(ptr->vin2.vin15);
672  vin_.push_back(ptr->vin2.vin16);
673  std_msgs::String msg; msg.data = vin_;
674  pub_vin_.publish(msg);
675  ROS_INFO("Licensing: VIN: %s", vin_.c_str());
676  }
677  } else if ((LIC_MUX_F0 <= ptr->mux) && (ptr->mux <= LIC_MUX_F7)) {
678  constexpr std::array<const char*, 8> NAME = {"BASE","CONTROL","SENSORS","","","","",""};
679  constexpr std::array<bool, 8> WARN = {true, true, true, false, true, true, true, true};
680  const size_t i = ptr->mux - LIC_MUX_F0;
681  const int id = module * NAME.size() + i;
682  const std::string name = strcmp(NAME[i], "") ? NAME[i] : std::string(1, '0' + i);
683  if (ptr->license.enabled) {
684  ROS_INFO_ONCE_ID(id, "Licensing: %s feature '%s' enabled%s", str_m, name.c_str(), ptr->license.trial ? " as a counted trial" : "");
685  } else if (ptr->ready && !WARN[i]) {
686  ROS_INFO_ONCE_ID(id, "Licensing: %s feature '%s' not licensed.", str_m, name.c_str());
687  } else if (ptr->ready) {
688  ROS_WARN_ONCE_ID(id, "Licensing: %s feature '%s' not licensed. Visit https://www.dataspeedinc.com/products/maintenance-subscription/ to request a license.", str_m, name.c_str());
689  }
690  if (ptr->ready && (module == M_STEER) && (ptr->license.trial || (!ptr->license.enabled && WARN[i]))) {
691  ROS_INFO_ONCE("Licensing: Feature '%s' trials used: %u, remaining: %u", name.c_str(),
692  ptr->license.trials_used, ptr->license.trials_left);
693  }
694  }
695  }
696  break;
697 
698  case ID_VERSION:
699  if (msg->dlc >= sizeof(MsgVersion)) {
700  const MsgVersion *ptr = (const MsgVersion*)msg->data.elems;
701  const PlatformVersion version((Platform)ptr->platform, (Module)ptr->module, ptr->major, ptr->minor, ptr->build);
702  const ModuleVersion latest = FIRMWARE_LATEST.findModule(version);
703  const char * str_p = platformToString(version.p);
704  const char * str_m = moduleToString(version.m);
705  if (firmware_.findModule(version) != version.v) {
706  firmware_.insert(version);
707  if (latest.valid()) {
708  ROS_INFO("Detected %s %s firmware version %u.%u.%u", str_p, str_m, ptr->major, ptr->minor, ptr->build);
709  } else {
710  ROS_WARN("Detected %s %s firmware version %u.%u.%u, which is unsupported. Platform: 0x%02X, Module: %u", str_p, str_m,
711  ptr->major, ptr->minor, ptr->build, ptr->platform, ptr->module);
712  }
713  if (version < latest) {
714  ROS_WARN("Firmware %s %s has old version %u.%u.%u, updating to %u.%u.%u is suggested.", str_p, str_m,
715  version.v.major(), version.v.minor(), version.v.build(),
716  latest.major(), latest.minor(), latest.build());
717  }
718  }
719  }
720  break;
721 
722  case ID_BRAKE_CMD:
723  ROS_WARN_COND(warn_cmds_ && !((const MsgBrakeCmd*)msg->data.elems)->RES1 && !((const MsgBrakeCmd*)msg->data.elems)->RES2,
724  "DBW system: Another node on the CAN bus is commanding the vehicle!!! Subsystem: Brake. Id: 0x%03X", ID_BRAKE_CMD);
725  break;
726  case ID_THROTTLE_CMD:
727  ROS_WARN_COND(warn_cmds_ && !((const MsgThrottleCmd*)msg->data.elems)->RES1 && !((const MsgThrottleCmd*)msg->data.elems)->RES2,
728  "DBW system: Another node on the CAN bus is commanding the vehicle!!! Subsystem: Throttle. Id: 0x%03X", ID_THROTTLE_CMD);
729  break;
730  case ID_STEERING_CMD:
731  ROS_WARN_COND(warn_cmds_ && !((const MsgSteeringCmd*)msg->data.elems)->RES1 && !((const MsgSteeringCmd*)msg->data.elems)->RES2,
732  "DBW system: Another node on the CAN bus is commanding the vehicle!!! Subsystem: Steering. Id: 0x%03X", ID_STEERING_CMD);
733  break;
734  case ID_GEAR_CMD:
735  ROS_WARN_COND(warn_cmds_ && !((const MsgGearCmd*)msg->data.elems)->RES1 && !((const MsgGearCmd*)msg->data.elems)->RES2,
736  "DBW system: Another node on the CAN bus is commanding the vehicle!!! Subsystem: Shifting. Id: 0x%03X", ID_GEAR_CMD);
737  break;
738  case ID_MISC_CMD:
739  ROS_WARN_COND(warn_cmds_, "DBW system: Another node on the CAN bus is commanding the vehicle!!! Subsystem: Turn Signals. Id: 0x%03X", ID_MISC_CMD);
740  break;
741 
742  case 0x100 ... 0x103: // DBW2 steer/brake/throttle/gear report
743  case 0x6C0 ... 0x6C5: // DBW2 ECU info for each module
744  ROS_WARN_ONCE_ID(msg->id, "Received unsupported CAN ID %03X from next-generation drive-by-wire system (DBW2)"
745  "\nUse the ROS2 ds_dbw_can package instead", msg->id);
746  break;
747  }
748  }
749 #if 0
750  ROS_INFO("ena: %s, clr: %s, brake: %s, throttle: %s, steering: %s, gear: %s",
751  enabled() ? "true " : "false",
752  clear() ? "true " : "false",
753  override_brake_ ? "true " : "false",
754  override_throttle_ ? "true " : "false",
755  override_steering_ ? "true " : "false",
756  override_gear_ ? "true " : "false"
757  );
758 #endif
759 }
760 
761 void DbwNode::recvCanImu(const std::vector<can_msgs::Frame::ConstPtr> &msgs) {
762  ROS_ASSERT(msgs.size() == 2);
763  ROS_ASSERT(msgs[0]->id == ID_REPORT_ACCEL);
764  ROS_ASSERT(msgs[1]->id == ID_REPORT_GYRO);
765  if ((msgs[0]->dlc >= sizeof(MsgReportAccel)) && (msgs[1]->dlc >= sizeof(MsgReportGyro))) {
766  const MsgReportAccel *ptr_accel = (const MsgReportAccel*)msgs[0]->data.elems;
767  const MsgReportGyro *ptr_gyro = (const MsgReportGyro*)msgs[1]->data.elems;
768  sensor_msgs::Imu out;
769  out.header.stamp = msgs[0]->header.stamp;
770  out.header.frame_id = frame_id_;
771  out.orientation_covariance[0] = -1; // Orientation not present
772  if ((uint16_t)ptr_accel->accel_long == 0x8000) {
773  out.linear_acceleration.x = NAN;
774  } else {
775  out.linear_acceleration.x = (double)ptr_accel->accel_long * 0.01;
776  }
777  if ((uint16_t)ptr_accel->accel_lat == 0x8000) {
778  out.linear_acceleration.y = NAN;
779  } else {
780  out.linear_acceleration.y = (double)ptr_accel->accel_lat * -0.01;
781  }
782  if ((uint16_t)ptr_gyro->gyro_yaw == 0x8000) {
783  out.angular_velocity.z = NAN;
784  } else {
785  out.angular_velocity.z = (double)ptr_gyro->gyro_yaw * 0.0002;
786  }
787  pub_imu_.publish(out);
788  }
789 #if 0
790  ROS_INFO("Time: %u.%u, %u.%u, delta: %fms",
791  msgs[0]->header.stamp.sec, msgs[0]->header.stamp.nsec,
792  msgs[1]->header.stamp.sec, msgs[1]->header.stamp.nsec,
793  labs((msgs[1]->header.stamp - msgs[0]->header.stamp).toNSec()) / 1000000.0);
794 #endif
795 }
796 
797 void DbwNode::recvCanGps(const std::vector<can_msgs::Frame::ConstPtr> &msgs) {
798  ROS_ASSERT(msgs.size() == 3);
799  ROS_ASSERT(msgs[0]->id == ID_REPORT_GPS1);
800  ROS_ASSERT(msgs[1]->id == ID_REPORT_GPS2);
801  ROS_ASSERT(msgs[2]->id == ID_REPORT_GPS3);
802  if ((msgs[0]->dlc >= sizeof(MsgReportGps1)) && (msgs[1]->dlc >= sizeof(MsgReportGps2)) && (msgs[2]->dlc >= sizeof(MsgReportGps3))) {
803  const MsgReportGps1 *ptr1 = (const MsgReportGps1*)msgs[0]->data.elems;
804  const MsgReportGps2 *ptr2 = (const MsgReportGps2*)msgs[1]->data.elems;
805  const MsgReportGps3 *ptr3 = (const MsgReportGps3*)msgs[2]->data.elems;
806 
807  sensor_msgs::NavSatFix msg_fix;
808  msg_fix.header.stamp = msgs[0]->header.stamp;
809  msg_fix.latitude = (double)ptr1->latitude / 3e6;
810  msg_fix.longitude = (double)ptr1->longitude / 3e6;
811  msg_fix.altitude = 0.0;
812  msg_fix.position_covariance_type = sensor_msgs::NavSatFix::COVARIANCE_TYPE_UNKNOWN;
813  msg_fix.status.service = sensor_msgs::NavSatStatus::SERVICE_GPS;
814  msg_fix.status.status = sensor_msgs::NavSatStatus::STATUS_NO_FIX;
815  pub_gps_fix_.publish(msg_fix);
816 
817  sensor_msgs::TimeReference msg_time;
818  struct tm unix_time;
819  unix_time.tm_year = ptr2->utc_year + 100; // [1900] <-- [2000]
820  unix_time.tm_mon = ptr2->utc_month - 1; // [0-11] <-- [1-12]
821  unix_time.tm_mday = ptr2->utc_day; // [1-31] <-- [1-31]
822  unix_time.tm_hour = ptr2->utc_hours; // [0-23] <-- [0-23]
823  unix_time.tm_min = ptr2->utc_minutes; // [0-59] <-- [0-59]
824  unix_time.tm_sec = ptr2->utc_seconds; // [0-59] <-- [0-59]
825  msg_time.header.stamp = msgs[0]->header.stamp;
826  msg_time.time_ref.sec = timegm(&unix_time);
827  msg_time.time_ref.nsec = 0;
828  pub_gps_time_.publish(msg_time);
829 
830  sensor_msgs::NavSatFix msg_fix_dr;
831  msg_fix_dr.header.stamp = msgs[2]->header.stamp;
832  msg_fix_dr.latitude = (double)ptr3->dr_latitude / 3e6;
833  msg_fix_dr.longitude = (double)ptr3->dr_longitude / 3e6;
834  msg_fix_dr.altitude = 0.0;
835  msg_fix_dr.position_covariance_type = sensor_msgs::NavSatFix::COVARIANCE_TYPE_UNKNOWN;
836  msg_fix_dr.status.service = sensor_msgs::NavSatStatus::SERVICE_GPS;
837  pub_gps_fix_dr.publish(msg_fix_dr);
838 
839 #if 0
840  ROS_INFO("UTC Time: %04d-%02d-%02d %02d:%02d:%02d",
841  2000 + ptr2->utc_year, ptr2->utc_month, ptr2->utc_day,
842  ptr2->utc_hours, ptr2->utc_minutes, ptr2->utc_seconds);
843 #endif
844  }
845 #if 0
846  ROS_INFO("Time: %u.%u, %u.%u, %u.%u, delta: %fms",
847  msgs[0]->header.stamp.sec, msgs[0]->header.stamp.nsec,
848  msgs[1]->header.stamp.sec, msgs[1]->header.stamp.nsec,
849  msgs[2]->header.stamp.sec, msgs[2]->header.stamp.nsec,
850  std::max(std::max(
851  labs((msgs[1]->header.stamp - msgs[0]->header.stamp).toNSec()),
852  labs((msgs[2]->header.stamp - msgs[1]->header.stamp).toNSec())),
853  labs((msgs[0]->header.stamp - msgs[2]->header.stamp).toNSec())) / 1000000.0);
854 #endif
855 }
856 void DbwNode::recvBrakeCmd(const dbw_fca_msgs::BrakeCmd::ConstPtr& msg)
857 {
858  can_msgs::Frame out;
859  out.id = ID_BRAKE_CMD;
860  out.is_extended = false;
861  out.dlc = sizeof(MsgBrakeCmd);
862  MsgBrakeCmd *ptr = (MsgBrakeCmd*)out.data.elems;
863  memset(ptr, 0x00, sizeof(*ptr));
864  bool fwd_abs = firmware_.findModule(M_ABS).valid(); // Does the ABS braking module exist?
865  bool fwd = !pedal_luts_; // Forward command type, or apply pedal LUTs locally
866  fwd |= fwd_abs; // The local pedal LUTs are for the BPEC module, the ABS module requires forwarding
867  switch (msg->pedal_cmd_type) {
868  case dbw_fca_msgs::BrakeCmd::CMD_NONE:
869  break;
870  case dbw_fca_msgs::BrakeCmd::CMD_PEDAL:
871  ptr->CMD_TYPE = dbw_fca_msgs::BrakeCmd::CMD_PEDAL;
872  ptr->PCMD = std::clamp<float>(msg->pedal_cmd * UINT16_MAX, 0, UINT16_MAX);
874  ROS_WARN_THROTTLE(1.0, "Module ABS does not support brake command type PEDAL");
875  }
876  break;
877  case dbw_fca_msgs::BrakeCmd::CMD_PERCENT:
878  if (fwd) {
879  ptr->CMD_TYPE = dbw_fca_msgs::BrakeCmd::CMD_PERCENT;
880  ptr->PCMD = std::clamp<float>(msg->pedal_cmd * UINT16_MAX, 0, UINT16_MAX);
881  } else {
882  ptr->CMD_TYPE = dbw_fca_msgs::BrakeCmd::CMD_PEDAL;
883  ptr->PCMD = std::clamp<float>(brakePedalFromPercent(msg->pedal_cmd) * UINT16_MAX, 0, UINT16_MAX);
884  }
885  break;
886  case dbw_fca_msgs::BrakeCmd::CMD_TORQUE:
887  if (fwd) {
888  ptr->CMD_TYPE = dbw_fca_msgs::BrakeCmd::CMD_TORQUE;
889  ptr->PCMD = std::clamp<float>(msg->pedal_cmd, 0, UINT16_MAX);
890  } else {
891  ptr->CMD_TYPE = dbw_fca_msgs::BrakeCmd::CMD_PEDAL;
892  ptr->PCMD = std::clamp<float>(brakePedalFromTorque(msg->pedal_cmd) * UINT16_MAX, 0, UINT16_MAX);
893  }
895  ROS_WARN_THROTTLE(1.0, "Module ABS does not support brake command type TORQUE");
896  }
897  break;
898  case dbw_fca_msgs::BrakeCmd::CMD_TORQUE_RQ:
899  // CMD_TORQUE_RQ must be forwarded, there is no local implementation
900  ptr->CMD_TYPE = dbw_fca_msgs::BrakeCmd::CMD_TORQUE_RQ;
901  ptr->PCMD = std::clamp<float>(msg->pedal_cmd, 0, UINT16_MAX);
903  ROS_WARN_THROTTLE(1.0, "Module ABS does not support brake command type TORQUE_RQ");
904  }
905  break;
906  case dbw_fca_msgs::BrakeCmd::CMD_DECEL:
907  // CMD_DECEL must be forwarded, there is no local implementation
908  ptr->CMD_TYPE = dbw_fca_msgs::BrakeCmd::CMD_DECEL;
909  ptr->PCMD = std::clamp<float>(msg->pedal_cmd * 1e3f, 0, 10e3);
911  ROS_WARN_THROTTLE(1.0, "Module BPEC does not support brake command type DECEL");
912  }
913  break;
914  default:
915  ROS_WARN("Unknown brake command type: %u", msg->pedal_cmd_type);
916  break;
917  }
918  if (enabled() && msg->enable) {
919  ptr->EN = 1;
920  }
921  if (clear() || msg->clear) {
922  ptr->CLEAR = 1;
923  }
924  if (msg->ignore) {
925  ptr->IGNORE = 1;
926  }
927  ptr->COUNT = msg->count;
928  pub_can_.publish(out);
929 }
930 
931 void DbwNode::recvThrottleCmd(const dbw_fca_msgs::ThrottleCmd::ConstPtr& msg)
932 {
933  can_msgs::Frame out;
934  out.id = ID_THROTTLE_CMD;
935  out.is_extended = false;
936  out.dlc = sizeof(MsgThrottleCmd);
937  MsgThrottleCmd *ptr = (MsgThrottleCmd*)out.data.elems;
938  memset(ptr, 0x00, sizeof(*ptr));
939  bool fwd = !pedal_luts_; // Forward command type, or apply pedal LUTs locally
940  float cmd = 0.0;
941  switch (msg->pedal_cmd_type) {
942  case dbw_fca_msgs::ThrottleCmd::CMD_NONE:
943  break;
944  case dbw_fca_msgs::ThrottleCmd::CMD_PEDAL:
945  ptr->CMD_TYPE = dbw_fca_msgs::ThrottleCmd::CMD_PEDAL;
946  cmd = msg->pedal_cmd;
947  break;
948  case dbw_fca_msgs::ThrottleCmd::CMD_PERCENT:
949  if (fwd) {
950  ptr->CMD_TYPE = dbw_fca_msgs::ThrottleCmd::CMD_PERCENT;
951  cmd = msg->pedal_cmd;
952  } else {
953  ptr->CMD_TYPE = dbw_fca_msgs::ThrottleCmd::CMD_PEDAL;
954  cmd = throttlePedalFromPercent(msg->pedal_cmd);
955  }
956  break;
957  default:
958  ROS_WARN("Unknown throttle command type: %u", msg->pedal_cmd_type);
959  break;
960  }
961  ptr->PCMD = std::clamp<float>(cmd * UINT16_MAX, 0, UINT16_MAX);
962  if (enabled() && msg->enable) {
963  ptr->EN = 1;
964  }
965  if (clear() || msg->clear) {
966  ptr->CLEAR = 1;
967  }
968  if (msg->ignore) {
969  ptr->IGNORE = 1;
970  }
971  ptr->COUNT = msg->count;
972  pub_can_.publish(out);
973 }
974 
975 void DbwNode::recvSteeringCmd(const dbw_fca_msgs::SteeringCmd::ConstPtr& msg)
976 {
977  can_msgs::Frame out;
978  out.id = ID_STEERING_CMD;
979  out.is_extended = false;
980  out.dlc = sizeof(MsgSteeringCmd);
981  MsgSteeringCmd *ptr = (MsgSteeringCmd*)out.data.elems;
982  memset(ptr, 0x00, sizeof(*ptr));
983  switch (msg->cmd_type) {
984  case dbw_fca_msgs::SteeringCmd::CMD_ANGLE:
985  ptr->SCMD = std::clamp<float>(msg->steering_wheel_angle_cmd * (float)(180 / M_PI * 10), -INT16_MAX, INT16_MAX);
986  if (fabsf(msg->steering_wheel_angle_velocity) > 0) {
988  ptr->SVEL = std::clamp<float>(roundf(fabsf(msg->steering_wheel_angle_velocity) * (float)(180 / M_PI / 4)), 1, 254);
989  } else {
990  ptr->SVEL = std::clamp<float>(roundf(fabsf(msg->steering_wheel_angle_velocity) * (float)(180 / M_PI / 2)), 1, 254);
991  }
992  }
993  ptr->CMD_TYPE = dbw_fca_msgs::SteeringCmd::CMD_ANGLE;
994  break;
995  case dbw_fca_msgs::SteeringCmd::CMD_TORQUE:
996  ptr->SCMD = std::clamp<float>(msg->steering_wheel_torque_cmd * 128, -INT16_MAX, INT16_MAX);
997  ptr->CMD_TYPE = dbw_fca_msgs::SteeringCmd::CMD_TORQUE;
998  break;
999  default:
1000  ROS_WARN("Unknown steering command type: %u", msg->cmd_type);
1001  break;
1002  }
1003  if (enabled() && msg->enable) {
1004  ptr->EN = 1;
1005  }
1006  if (clear() || msg->clear) {
1007  ptr->CLEAR = 1;
1008  }
1009  if (msg->ignore) {
1010  ptr->IGNORE = 1;
1011  }
1012  if (msg->quiet) {
1013  ptr->QUIET = 1;
1014  }
1015  if (msg->alert) {
1016  ptr->ALERT = 1;
1017  }
1018  ptr->COUNT = msg->count;
1019  pub_can_.publish(out);
1020 }
1021 
1022 void DbwNode::recvGearCmd(const dbw_fca_msgs::GearCmd::ConstPtr& msg)
1023 {
1024  can_msgs::Frame out;
1025  out.id = ID_GEAR_CMD;
1026  out.is_extended = false;
1027  out.dlc = sizeof(MsgGearCmd);
1028  MsgGearCmd *ptr = (MsgGearCmd*)out.data.elems;
1029  memset(ptr, 0x00, sizeof(*ptr));
1030  if (enabled()) {
1031  ptr->GCMD = msg->cmd.gear;
1032  }
1033  if (clear() || msg->clear) {
1034  ptr->CLEAR = 1;
1035  }
1036  pub_can_.publish(out);
1037 }
1038 
1039 void DbwNode::recvMiscCmd(const dbw_fca_msgs::MiscCmd::ConstPtr& msg)
1040 {
1041  can_msgs::Frame out;
1042  out.id = ID_MISC_CMD;
1043  out.is_extended = false;
1044  out.dlc = sizeof(MsgMiscCmd);
1045  MsgMiscCmd *ptr = (MsgMiscCmd*)out.data.elems;
1046  memset(ptr, 0x00, sizeof(*ptr));
1047  if (enabled()) {
1048  ptr->TRNCMD = msg->cmd.value;
1049  ptr->DOORSEL = msg->door.select;
1050  ptr->DOORCMD = msg->door.action;
1051  ptr->vent_md_cmd = msg->vent_mode.value;
1052  ptr->ft_drv_temp_cmd = msg->ft_drv_temp.value;
1053  ptr->ft_psg_temp_cmd = msg->ft_psg_temp.value;
1054  ptr->ft_fn_sp_cmd = msg->ft_fan_speed.value;
1055  ptr->sync = msg->sync.cmd;
1056  ptr->max_ac = msg->max_ac.cmd;
1057  ptr->ac = msg->ac.cmd;
1058  ptr->ft_hvac = msg->ft_hvac.cmd;
1059  ptr->auto_md = msg->auto_md.cmd;
1060  ptr->recirc = msg->recirc.cmd;
1061  ptr->sync = msg->sync.cmd;
1062  ptr->r_defr = msg->r_defr.cmd;
1063  ptr->f_defr = msg->f_defr.cmd;
1064  ptr->hsw_cmd = msg->heated_steering_wheel.cmd;
1065  ptr->fl_hs_cmd = msg->fl_heated_seat.value;
1066  ptr->fl_vs_cmd = msg->fl_vented_seat.value;
1067  ptr->fr_hs_cmd = msg->fr_heated_seat.value;
1068  ptr->fr_vs_cmd = msg->fr_vented_seat.value;
1069  }
1070  pub_can_.publish(out);
1071 }
1072 
1074 {
1075  bool en = enabled();
1076  bool change = prev_enable_ != en;
1077  if (change || force) {
1078  std_msgs::Bool msg;
1079  msg.data = en;
1080  pub_sys_enable_.publish(msg);
1081  }
1082  prev_enable_ = en;
1083  return change;
1084 }
1085 
1087 {
1088  // Publish status periodically, in addition to latched and on change
1089  if (publishDbwEnabled(true)) {
1090  ROS_WARN("DBW system enable status changed unexpectedly");
1091  }
1092 
1093  // Clear override statuses if necessary
1094  if (clear()) {
1095  can_msgs::Frame out;
1096  out.is_extended = false;
1097 
1098  if (override_brake_) {
1099  out.id = ID_BRAKE_CMD;
1100  out.dlc = 4; // Sending the full eight bytes will fault the watchdog counter (if enabled)
1101  memset(out.data.elems, 0x00, 8);
1102  ((MsgBrakeCmd*)out.data.elems)->CLEAR = 1;
1103  pub_can_.publish(out);
1104  }
1105 
1106  if (override_throttle_) {
1107  out.id = ID_THROTTLE_CMD;
1108  out.dlc = 4; // Sending the full eight bytes will fault the watchdog counter (if enabled)
1109  memset(out.data.elems, 0x00, 8);
1110  ((MsgThrottleCmd*)out.data.elems)->CLEAR = 1;
1111  pub_can_.publish(out);
1112  }
1113 
1114  if (override_steering_) {
1115  out.id = ID_STEERING_CMD;
1116  out.dlc = 4; // Sending the full eight bytes will fault the watchdog counter (if enabled)
1117  memset(out.data.elems, 0x00, 8);
1118  ((MsgSteeringCmd*)out.data.elems)->CLEAR = 1;
1119  pub_can_.publish(out);
1120  }
1121 
1122  if (override_gear_) {
1123  out.id = ID_GEAR_CMD;
1124  out.dlc = sizeof(MsgGearCmd);
1125  memset(out.data.elems, 0x00, 8);
1126  ((MsgGearCmd*)out.data.elems)->CLEAR = 1;
1127  pub_can_.publish(out);
1128  }
1129  }
1130 }
1131 
1133 {
1134  if (!enable_) {
1135  if (fault()) {
1136  if (fault_steering_cal_) {
1137  ROS_WARN("DBW system not enabled. Steering calibration fault.");
1138  }
1139  if (fault_brakes_) {
1140  ROS_WARN("DBW system not enabled. Braking fault.");
1141  }
1142  if (fault_throttle_) {
1143  ROS_WARN("DBW system not enabled. Throttle fault.");
1144  }
1145  if (fault_steering_) {
1146  ROS_WARN("DBW system not enabled. Steering fault.");
1147  }
1148  if (fault_watchdog_) {
1149  ROS_WARN("DBW system not enabled. Watchdog fault.");
1150  }
1151  } else {
1152  enable_ = true;
1153  if (publishDbwEnabled()) {
1154  ROS_INFO("DBW system enabled.");
1155  } else {
1156  ROS_INFO("DBW system enable requested. Waiting for ready.");
1157  }
1158  }
1159  }
1160 }
1161 
1163 {
1164  if (enable_) {
1165  enable_ = false;
1167  ROS_WARN("DBW system disabled.");
1168  }
1169 }
1170 
1172 {
1173  if (enable_) {
1174  enable_ = false;
1176  ROS_WARN("DBW system disabled. Cancel button pressed.");
1177  }
1178 }
1179 
1180 void DbwNode::overrideBrake(bool override, bool timeout)
1181 {
1182  bool en = enabled();
1183  if (en && timeout) {
1184  override = false;
1185  }
1186  if (en && override) {
1187  enable_ = false;
1188  }
1189  override_brake_ = override;
1190  if (publishDbwEnabled()) {
1191  if (en) {
1192  ROS_WARN("DBW system disabled. Driver override on brake/throttle pedal.");
1193  } else {
1194  ROS_INFO("DBW system enabled.");
1195  }
1196  }
1197 }
1198 
1199 void DbwNode::overrideThrottle(bool override, bool timeout)
1200 {
1201  bool en = enabled();
1202  if (en && timeout) {
1203  override = false;
1204  }
1205  if (en && override) {
1206  enable_ = false;
1207  }
1208  override_throttle_ = override;
1209  if (publishDbwEnabled()) {
1210  if (en) {
1211  ROS_WARN("DBW system disabled. Driver override on brake/throttle pedal.");
1212  } else {
1213  ROS_INFO("DBW system enabled.");
1214  }
1215  }
1216 }
1217 
1218 void DbwNode::overrideSteering(bool override, bool timeout)
1219 {
1220  bool en = enabled();
1221  if (en && timeout) {
1222  override = false;
1223  }
1224  if (en && override) {
1225  enable_ = false;
1226  }
1227  override_steering_ = override;
1228  if (publishDbwEnabled()) {
1229  if (en) {
1230  ROS_WARN("DBW system disabled. Driver override on steering wheel.");
1231  } else {
1232  ROS_INFO("DBW system enabled.");
1233  }
1234  }
1235 }
1236 
1237 void DbwNode::overrideGear(bool override)
1238 {
1239  bool en = enabled();
1240  if (en && override) {
1241  enable_ = false;
1242  }
1243  override_gear_ = override;
1244  if (publishDbwEnabled()) {
1245  if (en) {
1246  ROS_WARN("DBW system disabled. Driver override on shifter.");
1247  } else {
1248  ROS_INFO("DBW system enabled.");
1249  }
1250  }
1251 }
1252 
1253 void DbwNode::timeoutBrake(bool timeout, bool enabled)
1254 {
1255  if (!timeout_brakes_ && enabled_brakes_ && timeout && !enabled) {
1256  ROS_WARN("Brake subsystem disabled after 100ms command timeout");
1257  }
1258  timeout_brakes_ = timeout;
1260 }
1261 
1262 void DbwNode::timeoutThrottle(bool timeout, bool enabled)
1263 {
1264  if (!timeout_throttle_ && enabled_throttle_ && timeout && !enabled) {
1265  ROS_WARN("Throttle subsystem disabled after 100ms command timeout");
1266  }
1267  timeout_throttle_ = timeout;
1269 }
1270 
1271 void DbwNode::timeoutSteering(bool timeout, bool enabled)
1272 {
1273  if (!timeout_steering_ && enabled_steering_ && timeout && !enabled) {
1274  ROS_WARN("Steering subsystem disabled after 100ms command timeout");
1275  }
1276  timeout_steering_ = timeout;
1278 }
1279 
1280 void DbwNode::faultBrakes(bool fault)
1281 {
1282  bool en = enabled();
1283  if (fault && en) {
1284  enable_ = false;
1285  }
1286  fault_brakes_ = fault;
1287  if (publishDbwEnabled()) {
1288  if (en) {
1289  ROS_ERROR("DBW system disabled. Braking fault.");
1290  } else {
1291  ROS_INFO("DBW system enabled.");
1292  }
1293  }
1294 }
1295 
1296 void DbwNode::faultThrottle(bool fault)
1297 {
1298  bool en = enabled();
1299  if (fault && en) {
1300  enable_ = false;
1301  }
1303  if (publishDbwEnabled()) {
1304  if (en) {
1305  ROS_ERROR("DBW system disabled. Throttle fault.");
1306  } else {
1307  ROS_INFO("DBW system enabled.");
1308  }
1309  }
1310 }
1311 
1312 void DbwNode::faultSteering(bool fault)
1313 {
1314  bool en = enabled();
1315  if (fault && en) {
1316  enable_ = false;
1317  }
1319  if (publishDbwEnabled()) {
1320  if (en) {
1321  ROS_ERROR("DBW system disabled. Steering fault.");
1322  } else {
1323  ROS_INFO("DBW system enabled.");
1324  }
1325  }
1326 }
1327 
1329 {
1330  bool en = enabled();
1331  if (fault && en) {
1332  enable_ = false;
1333  }
1335  if (publishDbwEnabled()) {
1336  if (en) {
1337  ROS_ERROR("DBW system disabled. Steering calibration fault.");
1338  } else {
1339  ROS_INFO("DBW system enabled.");
1340  }
1341  }
1342 }
1343 
1344 void DbwNode::faultWatchdog(bool fault, uint8_t src, bool braking)
1345 {
1346  bool en = enabled();
1347  if (fault && en) {
1348  enable_ = false;
1349  }
1351  if (publishDbwEnabled()) {
1352  if (en) {
1353  ROS_ERROR("DBW system disabled. Watchdog fault.");
1354  } else {
1355  ROS_INFO("DBW system enabled.");
1356  }
1357  }
1358  if (braking && !fault_watchdog_using_brakes_) {
1359  ROS_WARN("Watchdog event: Alerting driver and applying brakes.");
1360  } else if (!braking && fault_watchdog_using_brakes_) {
1361  ROS_INFO("Watchdog event: Driver has successfully taken control.");
1362  }
1363  if (fault && src && !fault_watchdog_warned_) {
1364  switch (src) {
1365  case dbw_fca_msgs::WatchdogCounter::OTHER_BRAKE:
1366  ROS_WARN("Watchdog event: Fault determined by brake controller");
1367  break;
1368  case dbw_fca_msgs::WatchdogCounter::OTHER_THROTTLE:
1369  ROS_WARN("Watchdog event: Fault determined by throttle controller");
1370  break;
1371  case dbw_fca_msgs::WatchdogCounter::OTHER_STEERING:
1372  ROS_WARN("Watchdog event: Fault determined by steering controller");
1373  break;
1374  case dbw_fca_msgs::WatchdogCounter::BRAKE_COUNTER:
1375  ROS_WARN("Watchdog event: Brake command counter failed to increment");
1376  break;
1377  case dbw_fca_msgs::WatchdogCounter::BRAKE_DISABLED:
1378  ROS_WARN("Watchdog event: Brake transition to disabled while in gear or moving");
1379  break;
1380  case dbw_fca_msgs::WatchdogCounter::BRAKE_COMMAND:
1381  ROS_WARN("Watchdog event: Brake command timeout after 100ms");
1382  break;
1383  case dbw_fca_msgs::WatchdogCounter::BRAKE_REPORT:
1384  ROS_WARN("Watchdog event: Brake report timeout after 100ms");
1385  break;
1386  case dbw_fca_msgs::WatchdogCounter::THROTTLE_COUNTER:
1387  ROS_WARN("Watchdog event: Throttle command counter failed to increment");
1388  break;
1389  case dbw_fca_msgs::WatchdogCounter::THROTTLE_DISABLED:
1390  ROS_WARN("Watchdog event: Throttle transition to disabled while in gear or moving");
1391  break;
1392  case dbw_fca_msgs::WatchdogCounter::THROTTLE_COMMAND:
1393  ROS_WARN("Watchdog event: Throttle command timeout after 100ms");
1394  break;
1395  case dbw_fca_msgs::WatchdogCounter::THROTTLE_REPORT:
1396  ROS_WARN("Watchdog event: Throttle report timeout after 100ms");
1397  break;
1398  case dbw_fca_msgs::WatchdogCounter::STEERING_COUNTER:
1399  ROS_WARN("Watchdog event: Steering command counter failed to increment");
1400  break;
1401  case dbw_fca_msgs::WatchdogCounter::STEERING_DISABLED:
1402  ROS_WARN("Watchdog event: Steering transition to disabled while in gear or moving");
1403  break;
1404  case dbw_fca_msgs::WatchdogCounter::STEERING_COMMAND:
1405  ROS_WARN("Watchdog event: Steering command timeout after 100ms");
1406  break;
1407  case dbw_fca_msgs::WatchdogCounter::STEERING_REPORT:
1408  ROS_WARN("Watchdog event: Steering report timeout after 100ms");
1409  break;
1410  }
1411  fault_watchdog_warned_ = true;
1412  } else if (!fault) {
1413  fault_watchdog_warned_ = false;
1414  }
1415  fault_watchdog_using_brakes_ = braking;
1417  ROS_WARN_THROTTLE(2.0, "Watchdog event: Press left OK button on the steering wheel or cycle power to clear event.");
1418  }
1419 }
1420 
1421 void DbwNode::faultWatchdog(bool fault, uint8_t src) {
1422  faultWatchdog(fault, src, fault_watchdog_using_brakes_); // No change to 'using brakes' status
1423 }
1424 
1425 void DbwNode::publishJointStates(const ros::Time &stamp, const dbw_fca_msgs::SteeringReport *steering)
1426 {
1427  double dt = (stamp - joint_state_.header.stamp).toSec();
1428  if (steering) {
1429  if (std::isfinite(steering->steering_wheel_angle)) {
1430  const double L = acker_wheelbase_;
1431  const double W = acker_track_;
1432  const double r = L / tan(steering->steering_wheel_angle / steering_ratio_);
1433  joint_state_.position[JOINT_SL] = atan(L / (r - W/2));
1434  joint_state_.position[JOINT_SR] = atan(L / (r + W/2));
1435  }
1436  if (std::isfinite(steering->speed)) {
1437  joint_state_.velocity[JOINT_FL] = steering->speed / wheel_radius_;
1438  joint_state_.velocity[JOINT_FR] = steering->speed / wheel_radius_;
1439  joint_state_.velocity[JOINT_RL] = steering->speed / wheel_radius_;
1440  joint_state_.velocity[JOINT_RR] = steering->speed / wheel_radius_;
1441  }
1442  }
1443  if (dt < 0.5) {
1444  for (size_t i = JOINT_FL; i <= JOINT_RR; i++) {
1445  joint_state_.position[i] = fmod(joint_state_.position[i] + dt * joint_state_.velocity[i], 2*M_PI);
1446  }
1447  }
1448  joint_state_.header.stamp = stamp;
1450 }
1451 
1452 } // namespace dbw_fca_can
1453 
dbw_fca_can::MsgSteeringCmd::QUIET
uint8_t QUIET
Definition: dispatch.h:146
dbw_fca_can::DbwNode::JOINT_SL
@ JOINT_SL
Definition: DbwNode.h:206
dbw_fca_can::DbwNode::pub_tire_pressure_
ros::Publisher pub_tire_pressure_
Definition: DbwNode.h:268
dbw_fca_can::MsgMiscCmd::ac
uint8_t ac
Definition: dispatch.h:204
dbw_fca_can::DbwNode::recvDisable
void recvDisable(const std_msgs::Empty::ConstPtr &msg)
Definition: DbwNode.cpp:200
dbw_fca_can::DbwNode::recvBrakeCmd
void recvBrakeCmd(const dbw_fca_msgs::BrakeCmd::ConstPtr &msg)
Definition: DbwNode.cpp:856
NAME
string NAME
dbw_fca_can::MsgThrottleReport::FLT1
uint8_t FLT1
Definition: dispatch.h:134
dbw_fca_can::MsgReportTirePressure
Definition: dispatch.h:350
dbw_fca_can
Definition: dispatch.h:39
dbw_fca_can::DbwNode::ldate_
std::string ldate_
Definition: DbwNode.h:220
dbw_fca_can::MsgThrottleCmd::PCMD
uint16_t PCMD
Definition: dispatch.h:109
dbw_fca_can::DbwNode::warn_cmds_
bool warn_cmds_
Definition: DbwNode.h:230
dbw_fca_can::PlatformMap::findModule
ModuleVersion findModule(Module m) const
Definition: PlatformMap.h:129
dbw_fca_can::DbwNode::fault_steering_
bool fault_steering_
Definition: DbwNode.h:167
dbw_fca_can::MsgMiscReport::btn_ld_right
uint8_t btn_ld_right
Definition: dispatch.h:251
dbw_fca_can::DbwNode::buttons_
bool buttons_
Definition: DbwNode.h:233
dbw_fca_can::MsgGearCmd::GCMD
uint8_t GCMD
Definition: dispatch.h:175
dbw_fca_can::ID_STEERING_CMD
@ ID_STEERING_CMD
Definition: dispatch.h:523
dbw_fca_can::LIC_MUX_VIN1
@ LIC_MUX_VIN1
Definition: dispatch.h:395
dbw_fca_can::LIC_MUX_VIN0
@ LIC_MUX_VIN0
Definition: dispatch.h:394
dbw_fca_can::LIC_MUX_LDATE0
@ LIC_MUX_LDATE0
Definition: dispatch.h:389
dbw_fca_can::MsgBrakeCmd::CLEAR
uint8_t CLEAR
Definition: dispatch.h:111
dbw_fca_can::ID_BRAKE_REPORT
@ ID_BRAKE_REPORT
Definition: dispatch.h:520
dbw_fca_can::MsgLicense
Definition: dispatch.h:398
dbw_fca_can::MsgReportBrakeInfo::brake_torque_request
uint32_t brake_torque_request
Definition: dispatch.h:358
ROS_INFO_ONCE_ID
#define ROS_INFO_ONCE_ID(id,...)
Definition: DbwNode.cpp:53
dbw_fca_can::MsgSteeringCmd::COUNT
uint8_t COUNT
Definition: dispatch.h:155
dbw_fca_can::DbwNode::faultSteering
void faultSteering(bool fault)
Definition: DbwNode.cpp:1312
dbw_fca_can::MsgSteeringReport::ANGLE
int16_t ANGLE
Definition: dispatch.h:159
dbw_fca_can::MsgSteeringCmd::SCMD
int16_t SCMD
Definition: dispatch.h:141
dbw_fca_can::MsgGearReport
Definition: dispatch.h:182
dbw_fca_can::DbwNode::pub_wheel_positions_
ros::Publisher pub_wheel_positions_
Definition: DbwNode.h:267
dbw_fca_can::DbwNode::timeoutBrake
void timeoutBrake(bool timeout, bool enabled)
Definition: DbwNode.cpp:1253
dbw_fca_can::MsgMiscReport::FLTBUS
uint8_t FLTBUS
Definition: dispatch.h:237
dbw_fca_can::MsgBrakeReport
Definition: dispatch.h:90
dbw_fca_can::DbwNode::firmware_
PlatformMap firmware_
Definition: DbwNode.h:224
dbw_fca_can::DbwNode::recvThrottleCmd
void recvThrottleCmd(const dbw_fca_msgs::ThrottleCmd::ConstPtr &msg)
Definition: DbwNode.cpp:931
dbw_fca_can::ID_GEAR_REPORT
@ ID_GEAR_REPORT
Definition: dispatch.h:526
dbw_fca_can::DbwNode::recvCanGps
void recvCanGps(const std::vector< can_msgs::Frame::ConstPtr > &msgs)
Definition: DbwNode.cpp:797
ROS_WARN_ONCE_ID
#define ROS_WARN_ONCE_ID(id,...)
Definition: DbwNode.cpp:54
dbw_fca_can::DbwNode::sub_turn_signal_
ros::Subscriber sub_turn_signal_
Definition: DbwNode.h:255
dbw_fca_can::MsgSteeringReport::FLTBUS1
uint8_t FLTBUS1
Definition: dispatch.h:168
dbw_fca_can::FIRMWARE_LATEST
PlatformMap FIRMWARE_LATEST({ {PlatformVersion(P_FCA_RU, M_BPEC, ModuleVersion(1, 6, 2))}, {PlatformVersion(P_FCA_RU, M_TPEC, ModuleVersion(1, 6, 2))}, {PlatformVersion(P_FCA_RU, M_STEER, ModuleVersion(1, 6, 2))}, {PlatformVersion(P_FCA_RU, M_SHIFT, ModuleVersion(1, 6, 2))}, {PlatformVersion(P_FCA_WK2, M_TPEC, ModuleVersion(1, 4, 2))}, {PlatformVersion(P_FCA_WK2, M_STEER, ModuleVersion(1, 4, 2))}, {PlatformVersion(P_FCA_WK2, M_SHIFT, ModuleVersion(1, 4, 2))}, {PlatformVersion(P_FCA_WK2, M_ABS, ModuleVersion(1, 4, 2))}, })
dbw_fca_can::DbwNode::overrideSteering
void overrideSteering(bool override, bool timeout)
Definition: DbwNode.cpp:1218
ros::NodeHandle::getParam
bool getParam(const std::string &key, bool &b) const
dbw_fca_can::MsgSteeringReport::OVERRIDE
uint8_t OVERRIDE
Definition: dispatch.h:165
dbw_fca_can::DbwNode::timer_
ros::Timer timer_
Definition: DbwNode.h:158
dbw_fca_can::MsgVersion::build
uint16_t build
Definition: dispatch.h:486
dbw_fca_can::MsgReportAccel::accel_long
int16_t accel_long
Definition: dispatch.h:290
ROS_WARN_THROTTLE
#define ROS_WARN_THROTTLE(period,...)
dbw_fca_can::DbwNode::publishJointStates
void publishJointStates(const ros::Time &stamp, const dbw_fca_msgs::SteeringReport *steering)
Definition: DbwNode.cpp:1425
dbw_fca_can::PlatformMap::insert
void insert(Platform p, Module m, ModuleVersion v)
Definition: PlatformMap.h:123
dbw_fca_can::MsgVersion::minor
uint16_t minor
Definition: dispatch.h:485
dbw_fca_can::MsgMisc2Report::ft_hvac
uint8_t ft_hvac
Definition: dispatch.h:266
dbw_fca_can::DbwNode::faultSteeringCal
void faultSteeringCal(bool fault)
Definition: DbwNode.cpp:1328
dbw_fca_can::MsgGearReport::REJECT
uint8_t REJECT
Definition: dispatch.h:187
dbw_fca_can::DbwNode::JOINT_COUNT
@ JOINT_COUNT
Definition: DbwNode.h:208
dbw_fca_can::ID_REPORT_GPS2
@ ID_REPORT_GPS2
Definition: dispatch.h:533
dbw_fca_can::DbwNode::timeoutThrottle
void timeoutThrottle(bool timeout, bool enabled)
Definition: DbwNode.cpp:1262
dbw_fca_can::MsgBrakeReport::WDCBRK
uint8_t WDCBRK
Definition: dispatch.h:96
dbw_fca_can::DbwNode::acker_wheelbase_
double acker_wheelbase_
Definition: DbwNode.h:239
dbw_fca_can::MsgLicense::trial
uint8_t trial
Definition: dispatch.h:401
dbw_fca_can::MsgMisc2Report::sync
uint8_t sync
Definition: dispatch.h:269
dbw_fca_can::DbwNode::overrideThrottle
void overrideThrottle(bool override, bool timeout)
Definition: DbwNode.cpp:1199
dbw_fca_can::LIC_MUX_F7
@ LIC_MUX_F7
Definition: dispatch.h:388
dbw_fca_can::MsgBrakeReport::FLTWDC
uint8_t FLTWDC
Definition: dispatch.h:101
dbw_fca_can::DbwNode::timeoutSteering
void timeoutSteering(bool timeout, bool enabled)
Definition: DbwNode.cpp:1271
dbw_fca_can::MsgSteeringCmd::EN
uint8_t EN
Definition: dispatch.h:142
dbw_fca_can::MsgThrottleCmd::EN
uint8_t EN
Definition: dispatch.h:112
dbw_fca_can::DbwNode::pub_misc_1_
ros::Publisher pub_misc_1_
Definition: DbwNode.h:264
dbw_fca_can::MsgMiscCmd::r_defr
uint8_t r_defr
Definition: dispatch.h:209
dbw_fca_can::MsgMisc2Report::r_defr
uint8_t r_defr
Definition: dispatch.h:270
dbw_fca_can::MsgLicense::ldate0
uint8_t ldate0
Definition: dispatch.h:415
dbw_fca_can::MsgReportTirePressure::rear_left
uint16_t rear_left
Definition: dispatch.h:353
dbw_fca_can::platformToString
static const char * platformToString(Platform x)
Definition: PlatformVersion.h:103
dbw_fca_can::MsgReportGps3::dr_latitude
int32_t dr_latitude
Definition: dispatch.h:328
ROS_DEBUG
#define ROS_DEBUG(...)
ros::TransportHints
dbw_fca_can::MsgBrakeReport::OVERRIDE
uint8_t OVERRIDE
Definition: dispatch.h:99
dbw_fca_can::MsgBrakeReport::PI
uint16_t PI
Definition: dispatch.h:91
dbw_fca_can::DbwNode::pub_brake_info_
ros::Publisher pub_brake_info_
Definition: DbwNode.h:270
dbw_fca_can::DbwNode::pub_gps_time_
ros::Publisher pub_gps_time_
Definition: DbwNode.h:274
dbw_fca_can::MsgMiscCmd::fl_hs_cmd
uint8_t fl_hs_cmd
Definition: dispatch.h:214
dbw_fca_can::DbwNode::JOINT_SR
@ JOINT_SR
Definition: DbwNode.h:207
dbw_fca_can::DbwNode::gear_warned_
bool gear_warned_
Definition: DbwNode.h:178
dbw_fca_can::MsgGearReport::STATE
uint8_t STATE
Definition: dispatch.h:183
dbw_fca_can::DbwNode::bdate_
std::map< uint8_t, std::string > bdate_
Definition: DbwNode.h:221
dbw_fca_can::DbwNode::sub_disable_
ros::Subscriber sub_disable_
Definition: DbwNode.h:249
dbw_fca_can::ID_REPORT_THROTTLE_INFO
@ ID_REPORT_THROTTLE_INFO
Definition: dispatch.h:539
dbw_fca_can::DbwNode::fault
bool fault()
Definition: DbwNode.h:179
dbw_fca_can::MsgMisc2Report::f_defr
uint8_t f_defr
Definition: dispatch.h:271
dbw_fca_can::MsgReportBrakeInfo
Definition: dispatch.h:357
dbw_fca_can::MsgLicense::bdate1
struct dbw_fca_can::MsgLicense::@1::@8 bdate1
dbw_fca_can::MsgReportWheelPosition
Definition: dispatch.h:334
dbw_fca_can::DbwNode::sub_steering_
ros::Subscriber sub_steering_
Definition: DbwNode.h:253
dbw_fca_can::DbwNode::prev_enable_
bool prev_enable_
Definition: DbwNode.h:159
dbw_fca_can::DbwNode::enabled_brakes_
bool enabled_brakes_
Definition: DbwNode.h:175
boost
dbw_fca_can::MsgMiscReport::btn_cc_gap_dec
uint8_t btn_cc_gap_dec
Definition: dispatch.h:235
dbw_fca_can::ID_GEAR_CMD
@ ID_GEAR_CMD
Definition: dispatch.h:525
dbw_fca_can::DbwNode::pub_gear_
ros::Publisher pub_gear_
Definition: DbwNode.h:263
dbw_fca_can::MsgSteeringCmd::IGNORE
uint8_t IGNORE
Definition: dispatch.h:144
dbw_fca_can::MsgMisc2Report::recirc
uint8_t recirc
Definition: dispatch.h:268
dbw_fca_can::ID_THROTTLE_CMD
@ ID_THROTTLE_CMD
Definition: dispatch.h:521
dbw_fca_can::MsgMisc2Report::ft_fn_sp_stat
uint8_t ft_fn_sp_stat
Definition: dispatch.h:262
dbw_fca_can::DbwNode::pub_vin_
ros::Publisher pub_vin_
Definition: DbwNode.h:278
dbw_fca_can::MsgMiscReport::btn_cc_gap_inc
uint8_t btn_cc_gap_inc
Definition: dispatch.h:234
dbw_fca_can::MsgMiscCmd::max_ac
uint8_t max_ac
Definition: dispatch.h:203
dbw_fca_can::MsgReportGps1::longitude
int32_t longitude
Definition: dispatch.h:302
dbw_fca_can::DbwNode::override_steering_
bool override_steering_
Definition: DbwNode.h:163
dbw_fca_can::DbwNode::sync_gps_
dataspeed_can_msg_filters::ApproximateTime sync_gps_
Definition: DbwNode.h:283
dbw_fca_can::MsgThrottleCmd::COUNT
uint8_t COUNT
Definition: dispatch.h:121
dbw_fca_can::MsgSteeringReport::ENABLED
uint8_t ENABLED
Definition: dispatch.h:164
dbw_fca_can::DbwNode::sub_brake_
ros::Subscriber sub_brake_
Definition: DbwNode.h:251
dbw_fca_can::MsgMiscCmd::auto_md
uint8_t auto_md
Definition: dispatch.h:206
dbw_fca_can::MsgMiscCmd::vent_md_cmd
uint8_t vent_md_cmd
Definition: dispatch.h:211
dbw_fca_can::MsgReportWheelPosition::front_right
int16_t front_right
Definition: dispatch.h:336
ros::Publisher::publish
void publish(const boost::shared_ptr< M > &message) const
dbw_fca_can::MsgBrakeCmd::IGNORE
uint8_t IGNORE
Definition: dispatch.h:112
dbw_fca_can::MsgBrakeCmd
Definition: dispatch.h:74
dbw_fca_can::MsgThrottleReport::FLTWDC
uint8_t FLTWDC
Definition: dispatch.h:133
dbw_fca_can::Platform
Platform
Definition: PlatformVersion.h:77
dbw_fca_can::MsgLicense::expired
uint8_t expired
Definition: dispatch.h:402
ros::TransportHints::tcpNoDelay
TransportHints & tcpNoDelay(bool nodelay=true)
dbw_fca_can::MsgMisc2Report::ft_drv_temp_stat
uint8_t ft_drv_temp_stat
Definition: dispatch.h:258
dbw_fca_can::DbwNode::fault_steering_cal_
bool fault_steering_cal_
Definition: DbwNode.h:168
dbw_fca_can::MsgMiscCmd::sync
uint8_t sync
Definition: dispatch.h:208
dbw_fca_can::MsgSteeringReport::VEH_VEL
int16_t VEH_VEL
Definition: dispatch.h:162
f
f
dbw_fca_can::MsgMiscCmd::fr_hs_cmd
uint8_t fr_hs_cmd
Definition: dispatch.h:216
dbw_fca_can::DbwNode::clear
bool clear()
Definition: DbwNode.h:181
dbw_fca_can::DbwNode::timeout_brakes_
bool timeout_brakes_
Definition: DbwNode.h:172
ROS_WARN_COND
#define ROS_WARN_COND(cond,...)
dbw_fca_can::DbwNode::enabled_steering_
bool enabled_steering_
Definition: DbwNode.h:177
dbw_fca_can::MsgLicense::bdate0
struct dbw_fca_can::MsgLicense::@1::@7 bdate0
dbw_fca_can::MsgLicense::mux
uint8_t mux
Definition: dispatch.h:399
dbw_fca_can::MsgMiscReport::wiper_front
uint8_t wiper_front
Definition: dispatch.h:223
dbw_fca_can::DbwNode::vin_
std::string vin_
Definition: DbwNode.h:219
dbw_fca_can::moduleToString
static const char * moduleToString(Module x)
Definition: PlatformVersion.h:121
dbw_fca_can::ID_REPORT_WHEEL_SPEED
@ ID_REPORT_WHEEL_SPEED
Definition: dispatch.h:529
dispatch.h
dbw_fca_can::MsgMiscReport::btn_ld_down
uint8_t btn_ld_down
Definition: dispatch.h:249
dbw_fca_can::MsgMiscCmd::f_defr
uint8_t f_defr
Definition: dispatch.h:210
dbw_fca_can::MsgSteeringReport::FLTBUS2
uint8_t FLTBUS2
Definition: dispatch.h:169
dbw_fca_can::LIC_MUX_MAC
@ LIC_MUX_MAC
Definition: dispatch.h:391
dbw_fca_can::MsgMisc2Report::max_ac
uint8_t max_ac
Definition: dispatch.h:264
dbw_fca_can::FIRMWARE_HIGH_RATE_LIMIT
PlatformMap FIRMWARE_HIGH_RATE_LIMIT({ {PlatformVersion(P_FCA_RU, M_STEER, ModuleVersion(1, 1, 0))}, {PlatformVersion(P_FCA_WK2, M_STEER, ModuleVersion(0, 2, 0))}, })
dbw_fca_can::DbwNode::recvSteeringCmd
void recvSteeringCmd(const dbw_fca_msgs::SteeringCmd::ConstPtr &msg)
Definition: DbwNode.cpp:975
dbw_fca_can::ID_MISC_REPORT
@ ID_MISC_REPORT
Definition: dispatch.h:528
dbw_fca_can::MsgSteeringCmd::CLEAR
uint8_t CLEAR
Definition: dispatch.h:143
dbw_fca_can::DbwNode::acker_track_
double acker_track_
Definition: DbwNode.h:240
dbw_fca_can::MsgReportFuelLevel
Definition: dispatch.h:341
dbw_fca_can::MsgReportGps2
Definition: dispatch.h:306
dbw_fca_can::MsgBrakeReport::FLT2
uint8_t FLT2
Definition: dispatch.h:103
dbw_fca_can::LIC_MUX_VIN2
@ LIC_MUX_VIN2
Definition: dispatch.h:396
dbw_fca_can::MsgReportGps1::latitude
int32_t latitude
Definition: dispatch.h:300
dbw_fca_can::MsgReportThrottleInfo::axle_torque
int16_t axle_torque
Definition: dispatch.h:368
dbw_fca_can::MsgVersion::platform
uint8_t platform
Definition: dispatch.h:483
dbw_fca_can::MsgGearCmd::CLEAR
uint8_t CLEAR
Definition: dispatch.h:179
dbw_fca_can::MsgMiscCmd::DOORSEL
uint8_t DOORSEL
Definition: dispatch.h:195
dbw_fca_can::MsgSteeringReport::FLTWDC
uint8_t FLTWDC
Definition: dispatch.h:167
dbw_fca_can::DbwNode::recvMiscCmd
void recvMiscCmd(const dbw_fca_msgs::MiscCmd::ConstPtr &msg)
Definition: DbwNode.cpp:1039
dbw_fca_can::DbwNode::pub_twist_
ros::Publisher pub_twist_
Definition: DbwNode.h:277
dbw_fca_can::DbwNode::fault_throttle_
bool fault_throttle_
Definition: DbwNode.h:166
dbw_fca_can::MsgReportWheelPosition::rear_right
int16_t rear_right
Definition: dispatch.h:338
dbw_fca_can::MsgMiscCmd::ft_psg_temp_cmd
uint8_t ft_psg_temp_cmd
Definition: dispatch.h:199
dbw_fca_can::P_FCA_RU
@ P_FCA_RU
Definition: PlatformVersion.h:118
dbw_fca_can::DbwNode::overrideGear
void overrideGear(bool override)
Definition: DbwNode.cpp:1237
dbw_fca_can::MsgLicense::license
struct dbw_fca_can::MsgLicense::@1::@3 license
dbw_fca_can::MsgThrottleCmd::CMD_TYPE
uint8_t CMD_TYPE
Definition: dispatch.h:111
dbw_fca_can::MsgMiscCmd::ft_fn_sp_cmd
uint8_t ft_fn_sp_cmd
Definition: dispatch.h:201
dbw_fca_can::brakePedalFromPercent
static float brakePedalFromPercent(float percent)
Definition: pedal_lut.h:143
dbw_fca_can::PlatformMap::findPlatform
PlatformVersion findPlatform(Module m) const
Definition: PlatformMap.h:153
dbw_fca_can::ModuleVersion::valid
bool valid() const
Definition: ModuleVersion.h:125
dbw_fca_can::MsgThrottleCmd::CLEAR
uint8_t CLEAR
Definition: dispatch.h:113
dbw_fca_can::MsgVersion
Definition: dispatch.h:481
dbw_fca_can::MsgMisc2Report::fr_hs_stat
uint8_t fr_hs_stat
Definition: dispatch.h:277
dbw_fca_can::MsgReportTirePressure::front_left
uint16_t front_left
Definition: dispatch.h:351
dbw_fca_can::DbwNode::pub_steering_
ros::Publisher pub_steering_
Definition: DbwNode.h:262
dbw_fca_can::DbwNode::steering_ratio_
double steering_ratio_
Definition: DbwNode.h:241
dataspeed_can_msg_filters::ApproximateTime::setInterMessageLowerBound
void setInterMessageLowerBound(ros::Duration lower_bound)
dbw_fca_can::MsgMiscReport::btn_cc_mode
uint8_t btn_cc_mode
Definition: dispatch.h:253
dbw_fca_can::MsgThrottleReport::TMOUT
uint8_t TMOUT
Definition: dispatch.h:137
dbw_fca_can::DbwNode::buttonCancel
void buttonCancel()
Definition: DbwNode.cpp:1171
dbw_fca_can::MsgSteeringReport::FLTPWR
uint8_t FLTPWR
Definition: dispatch.h:166
dbw_fca_can::DbwNode::timerCallback
void timerCallback(const ros::TimerEvent &event)
Definition: DbwNode.cpp:1086
dbw_fca_can::MsgMiscReport::btn_cc_cncl
uint8_t btn_cc_cncl
Definition: dispatch.h:228
dbw_fca_can::MsgMiscCmd::TRNCMD
uint8_t TRNCMD
Definition: dispatch.h:193
dbw_fca_can::MsgMiscReport::turn_signal
uint8_t turn_signal
Definition: dispatch.h:221
dbw_fca_can::M_STEER
@ M_STEER
Definition: PlatformVersion.h:96
dbw_fca_can::brakeTorqueFromPedal
static float brakeTorqueFromPedal(float pedal)
Definition: pedal_lut.h:97
dbw_fca_can::MsgSteeringCmd::ALERT
uint8_t ALERT
Definition: dispatch.h:148
dbw_fca_can::DbwNode::pub_misc_2_
ros::Publisher pub_misc_2_
Definition: DbwNode.h:265
dbw_fca_can::DbwNode::override_gear_
bool override_gear_
Definition: DbwNode.h:164
dbw_fca_can::DbwNode
Definition: DbwNode.h:107
dbw_fca_can::MsgLicense::mac
struct dbw_fca_can::MsgLicense::@1::@6 mac
dbw_fca_can::DbwNode::sub_misc_
ros::Subscriber sub_misc_
Definition: DbwNode.h:256
dbw_fca_can::LIC_MUX_F0
@ LIC_MUX_F0
Definition: dispatch.h:381
ROS_INFO_ONCE
#define ROS_INFO_ONCE(...)
dbw_fca_can::DbwNode::joint_state_
sensor_msgs::JointState joint_state_
Definition: DbwNode.h:210
dbw_fca_can::MsgThrottleReport::FLT2
uint8_t FLT2
Definition: dispatch.h:135
dbw_fca_can::MsgReportThrottleInfo::throttle_pc
uint8_t throttle_pc
Definition: dispatch.h:370
dbw_fca_can::MsgMiscCmd::fr_vs_cmd
uint8_t fr_vs_cmd
Definition: dispatch.h:217
dbw_fca_can::DbwNode::pub_imu_
ros::Publisher pub_imu_
Definition: DbwNode.h:272
dbw_fca_can::DbwNode::fault_brakes_
bool fault_brakes_
Definition: DbwNode.h:165
ROS_ERROR
#define ROS_ERROR(...)
dbw_fca_can::MsgReportWheelSpeed::front_left
int16_t front_left
Definition: dispatch.h:282
dbw_fca_can::MsgReportWheelSpeed::rear_left
int16_t rear_left
Definition: dispatch.h:284
dbw_fca_can::MsgLicense::vin0
struct dbw_fca_can::MsgLicense::@1::@9 vin0
dbw_fca_can::MsgMisc2Report::hsw_stat
uint8_t hsw_stat
Definition: dispatch.h:274
dbw_fca_can::DbwNode::sub_gear_
ros::Subscriber sub_gear_
Definition: DbwNode.h:254
dbw_fca_can::MsgMisc2Report::vent_md_stat
uint8_t vent_md_stat
Definition: dispatch.h:272
dbw_fca_can::DbwNode::pub_joint_states_
ros::Publisher pub_joint_states_
Definition: DbwNode.h:276
dbw_fca_can::MsgLicense::vin1
struct dbw_fca_can::MsgLicense::@1::@10 vin1
dbw_fca_can::MsgMiscCmd::ft_drv_temp_cmd
uint8_t ft_drv_temp_cmd
Definition: dispatch.h:197
dbw_fca_can::MsgGearReport::CMD
uint8_t CMD
Definition: dispatch.h:185
dbw_fca_can::MsgMiscCmd::hsw_cmd
uint8_t hsw_cmd
Definition: dispatch.h:213
dbw_fca_can::DbwNode::publishDbwEnabled
bool publishDbwEnabled(bool force=false)
Definition: DbwNode.cpp:1073
pedal_lut.h
dbw_fca_can::MsgMiscReport::btn_cc_set_inc
uint8_t btn_cc_set_inc
Definition: dispatch.h:232
dbw_fca_can::DbwNode::pub_gps_fix_
ros::Publisher pub_gps_fix_
Definition: DbwNode.h:273
ROS_WARN
#define ROS_WARN(...)
dbw_fca_can::ID_MISC_CMD
@ ID_MISC_CMD
Definition: dispatch.h:527
dbw_fca_can::MsgGearReport::READY
uint8_t READY
Definition: dispatch.h:189
dbw_fca_can::DbwNode::overrideBrake
void overrideBrake(bool override, bool timeout)
Definition: DbwNode.cpp:1180
dbw_fca_can::MsgReportThrottleInfo
Definition: dispatch.h:367
dbw_fca_can::ID_LICENSE
@ ID_LICENSE
Definition: dispatch.h:541
dbw_fca_can::Module
Module
Definition: PlatformVersion.h:93
dbw_fca_can::ID_BRAKE_CMD
@ ID_BRAKE_CMD
Definition: dispatch.h:519
dbw_fca_can::MsgReportAccel::accel_lat
int16_t accel_lat
Definition: dispatch.h:289
dbw_fca_can::DbwNode::fault_watchdog_using_brakes_
bool fault_watchdog_using_brakes_
Definition: DbwNode.h:170
dbw_fca_can::M_ABS
@ M_ABS
Definition: PlatformVersion.h:98
dbw_fca_can::DbwNode::faultThrottle
void faultThrottle(bool fault)
Definition: DbwNode.cpp:1296
dbw_fca_can::MsgMiscCmd::ft_hvac
uint8_t ft_hvac
Definition: dispatch.h:205
dbw_fca_can::MsgMisc2Report::auto_md
uint8_t auto_md
Definition: dispatch.h:267
dbw_fca_can::MsgReportAccel
Definition: dispatch.h:288
dbw_fca_can::ID_REPORT_GPS1
@ ID_REPORT_GPS1
Definition: dispatch.h:532
dbw_fca_can::DbwNode::fault_watchdog_
bool fault_watchdog_
Definition: DbwNode.h:169
dbw_fca_can::MsgBrakeReport::TMOUT
uint8_t TMOUT
Definition: dispatch.h:105
dataspeed_can_msg_filters::ApproximateTime::processMsg
void processMsg(const Type &msg)
ros::TimerEvent
dbw_fca_can::MsgMisc2Report::fl_hs_stat
uint8_t fl_hs_stat
Definition: dispatch.h:275
dbw_fca_can::MsgBrakeReport::FLTPWR
uint8_t FLTPWR
Definition: dispatch.h:104
dbw_fca_can::MsgThrottleCmd
Definition: dispatch.h:108
dbw_fca_can::ModuleVersion
Definition: ModuleVersion.h:83
dbw_fca_can::DbwNode::recvGearCmd
void recvGearCmd(const dbw_fca_msgs::GearCmd::ConstPtr &msg)
Definition: DbwNode.cpp:1022
dbw_fca_can::MsgBrakeReport::DRIVER
uint8_t DRIVER
Definition: dispatch.h:100
dbw_fca_can::MsgMiscReport::btn_cc_set_dec
uint8_t btn_cc_set_dec
Definition: dispatch.h:233
dbw_fca_can::MsgReportGyro
Definition: dispatch.h:294
dbw_fca_can::MsgLicense::ready
uint8_t ready
Definition: dispatch.h:400
dbw_fca_can::DbwNode::sub_throttle_
ros::Subscriber sub_throttle_
Definition: DbwNode.h:252
dbw_fca_can::ID_MISC2_REPORT
@ ID_MISC2_REPORT
Definition: dispatch.h:540
dbw_fca_can::ModuleVersion::major
uint16_t major() const
Definition: ModuleVersion.h:126
dbw_fca_can::MsgBrakeReport::PO
uint16_t PO
Definition: dispatch.h:93
dbw_fca_can::MsgVersion::module
uint8_t module
Definition: dispatch.h:482
dbw_fca_can::DbwNode::override_brake_
bool override_brake_
Definition: DbwNode.h:161
dbw_fca_can::MsgLicense::vin2
struct dbw_fca_can::MsgLicense::@1::@11 vin2
dbw_fca_can::MsgReportGps1
Definition: dispatch.h:299
dbw_fca_can::MsgReportBrakeInfo::brake_pressure
uint32_t brake_pressure
Definition: dispatch.h:361
dbw_fca_can::DbwNode::pub_fuel_level_
ros::Publisher pub_fuel_level_
Definition: DbwNode.h:269
dbw_fca_can::ID_REPORT_WHEEL_POSITION
@ ID_REPORT_WHEEL_POSITION
Definition: dispatch.h:535
dbw_fca_can::MsgGearReport::FLTBUS
uint8_t FLTBUS
Definition: dispatch.h:186
dbw_fca_can::MsgReportTirePressure::front_right
uint16_t front_right
Definition: dispatch.h:352
dbw_fca_can::MsgBrakeCmd::COUNT
uint8_t COUNT
Definition: dispatch.h:119
dbw_fca_can::MsgMiscReport::door_trunk
uint8_t door_trunk
Definition: dispatch.h:243
dbw_fca_can::MsgReportGps3
Definition: dispatch.h:327
dbw_fca_can::MsgReportWheelSpeed::rear_right
int16_t rear_right
Definition: dispatch.h:285
dbw_fca_can::M_TPEC
@ M_TPEC
Definition: PlatformVersion.h:95
dbw_fca_can::ModuleVersion::minor
uint16_t minor() const
Definition: ModuleVersion.h:127
dbw_fca_can::DbwNode::JOINT_RL
@ JOINT_RL
Definition: DbwNode.h:204
dbw_fca_can::MsgThrottleReport::PO
uint16_t PO
Definition: dispatch.h:127
dbw_fca_can::MsgReportFuelLevel::battery_12v
uint8_t battery_12v
Definition: dispatch.h:345
dbw_fca_can::MsgReportBrakeInfo::brake_torque_actual
uint32_t brake_torque_actual
Definition: dispatch.h:359
dbw_fca_can::brakePedalFromTorque
static float brakePedalFromTorque(float torque)
Definition: pedal_lut.h:120
dbw_fca_can::ID_REPORT_FUEL_LEVEL
@ ID_REPORT_FUEL_LEVEL
Definition: dispatch.h:537
dbw_fca_can::P_FCA_WK2
@ P_FCA_WK2
Definition: PlatformVersion.h:119
dbw_fca_can::M_SHIFT
@ M_SHIFT
Definition: PlatformVersion.h:97
dbw_fca_can::M_BPEC
@ M_BPEC
Definition: PlatformVersion.h:94
dbw_fca_can::MsgBrakeReport::PC
uint16_t PC
Definition: dispatch.h:92
dbw_fca_can::DbwNode::pub_throttle_
ros::Publisher pub_throttle_
Definition: DbwNode.h:261
dbw_fca_can::DbwNode::JOINT_RR
@ JOINT_RR
Definition: DbwNode.h:205
dbw_fca_can::MsgThrottleReport::FLTPWR
uint8_t FLTPWR
Definition: dispatch.h:136
dbw_fca_can::MsgMiscReport::door_rear_right
uint8_t door_rear_right
Definition: dispatch.h:241
dbw_fca_can::DbwNode::sync_imu_
dataspeed_can_msg_filters::ApproximateTime sync_imu_
Definition: DbwNode.h:282
dbw_fca_can::MsgThrottleReport::OVERRIDE
uint8_t OVERRIDE
Definition: dispatch.h:131
dbw_fca_can::MsgReportBrakeInfo::stationary
uint32_t stationary
Definition: dispatch.h:362
dbw_fca_can::LIC_MUX_BDATE0
@ LIC_MUX_BDATE0
Definition: dispatch.h:392
dbw_fca_can::MsgSteeringCmd::SVEL
uint8_t SVEL
Definition: dispatch.h:150
dbw_fca_can::ModuleVersion::build
uint16_t build() const
Definition: ModuleVersion.h:128
dbw_fca_can::MsgReportWheelPosition::front_left
int16_t front_left
Definition: dispatch.h:335
dbw_fca_can::MsgLicense::module
uint8_t module
Definition: dispatch.h:404
dbw_fca_can::MsgMiscCmd::recirc
uint8_t recirc
Definition: dispatch.h:207
ros::Time
dbw_fca_can::DbwNode::JOINT_FR
@ JOINT_FR
Definition: DbwNode.h:203
dbw_fca_can::DbwNode::pub_wheel_speeds_
ros::Publisher pub_wheel_speeds_
Definition: DbwNode.h:266
dbw_fca_can::MsgReportThrottleInfo::gear_num
uint8_t gear_num
Definition: dispatch.h:371
dbw_fca_can::MsgReportFuelLevel::odometer
uint32_t odometer
Definition: dispatch.h:346
dbw_fca_can::MsgThrottleReport::ENABLED
uint8_t ENABLED
Definition: dispatch.h:130
dbw_fca_can::MsgMiscReport::head_light_hi
uint8_t head_light_hi
Definition: dispatch.h:222
dbw_fca_can::MsgThrottleReport::PC
uint16_t PC
Definition: dispatch.h:126
dbw_fca_can::DbwNode::faultWatchdog
void faultWatchdog(bool fault, uint8_t src, bool braking)
Definition: DbwNode.cpp:1344
dbw_fca_can::ID_REPORT_GYRO
@ ID_REPORT_GYRO
Definition: dispatch.h:531
dbw_fca_can::DbwNode::enabled
bool enabled()
Definition: DbwNode.h:182
dbw_fca_can::DbwNode::timeout_throttle_
bool timeout_throttle_
Definition: DbwNode.h:173
dbw_fca_can::PlatformVersion
Definition: PlatformVersion.h:134
dbw_fca_can::MsgReportTirePressure::rear_right
uint16_t rear_right
Definition: dispatch.h:354
dbw_fca_can::MsgMiscReport::btn_ld_ok
uint8_t btn_ld_ok
Definition: dispatch.h:247
dbw_fca_can::MsgSteeringReport::TORQUE
int8_t TORQUE
Definition: dispatch.h:163
DbwNode.h
dbw_fca_can::MsgMisc2Report::fl_vs_stat
uint8_t fl_vs_stat
Definition: dispatch.h:276
dbw_fca_can::DbwNode::pub_gps_fix_dr
ros::Publisher pub_gps_fix_dr
Definition: DbwNode.h:275
dbw_fca_can::MsgMiscReport::btn_ld_left
uint8_t btn_ld_left
Definition: dispatch.h:250
dbw_fca_can::DbwNode::recvCAN
void recvCAN(const can_msgs::Frame::ConstPtr &msg)
Definition: DbwNode.cpp:205
dbw_fca_can::DbwNode::JOINT_FL
@ JOINT_FL
Definition: DbwNode.h:202
dbw_fca_can::DbwNode::frame_id_
std::string frame_id_
Definition: DbwNode.h:227
dbw_fca_can::MsgThrottleReport::PI
uint16_t PI
Definition: dispatch.h:125
dbw_fca_can::MsgReportFuelLevel::fuel_level
int16_t fuel_level
Definition: dispatch.h:342
dbw_fca_can::MsgThrottleReport::DRIVER
uint8_t DRIVER
Definition: dispatch.h:132
dbw_fca_can::MsgMiscReport::door_rear_left
uint8_t door_rear_left
Definition: dispatch.h:240
dbw_fca_can::MsgMisc2Report::ft_psg_temp_stat
uint8_t ft_psg_temp_stat
Definition: dispatch.h:260
dbw_fca_can::MsgMiscCmd::DOORCMD
uint8_t DOORCMD
Definition: dispatch.h:196
dbw_fca_can::MsgMiscReport::btn_cc_on_off
uint8_t btn_cc_on_off
Definition: dispatch.h:230
ros::NodeHandle::param
T param(const std::string &param_name, const T &default_val) const
dbw_fca_can::MsgReportBrakeInfo::brake_pc
uint32_t brake_pc
Definition: dispatch.h:360
dbw_fca_can::DbwNode::disableSystem
void disableSystem()
Definition: DbwNode.cpp:1162
dbw_fca_can::MsgMisc2Report
Definition: dispatch.h:257
dbw_fca_can::ID_REPORT_BRAKE_INFO
@ ID_REPORT_BRAKE_INFO
Definition: dispatch.h:538
dbw_fca_can::ID_REPORT_GPS3
@ ID_REPORT_GPS3
Definition: dispatch.h:534
dbw_fca_can::DbwNode::enableSystem
void enableSystem()
Definition: DbwNode.cpp:1132
dbw_fca_can::MsgBrakeReport::BTYPE
uint8_t BTYPE
Definition: dispatch.h:94
dbw_fca_can::ID_REPORT_ACCEL
@ ID_REPORT_ACCEL
Definition: dispatch.h:530
dbw_fca_can::ID_REPORT_TIRE_PRESSURE
@ ID_REPORT_TIRE_PRESSURE
Definition: dispatch.h:536
dbw_fca_can::MsgBrakeCmd::CMD_TYPE
uint8_t CMD_TYPE
Definition: dispatch.h:109
dbw_fca_can::DbwNode::pub_brake_
ros::Publisher pub_brake_
Definition: DbwNode.h:260
dbw_fca_can::DbwNode::sub_enable_
ros::Subscriber sub_enable_
Definition: DbwNode.h:248
dbw_fca_can::MsgMiscReport::btn_cc_res
uint8_t btn_cc_res
Definition: dispatch.h:227
dbw_fca_can::MsgBrakeCmd::PCMD
uint16_t PCMD
Definition: dispatch.h:107
dbw_fca_can::MsgSteeringCmd
Definition: dispatch.h:140
dbw_fca_can::LIC_MUX_LDATE1
@ LIC_MUX_LDATE1
Definition: dispatch.h:390
dbw_fca_can::MsgReportGps3::dr_longitude
int32_t dr_longitude
Definition: dispatch.h:330
dbw_fca_can::MsgReportWheelPosition::rear_left
int16_t rear_left
Definition: dispatch.h:337
dbw_fca_can::MsgMiscReport::btn_ld_up
uint8_t btn_ld_up
Definition: dispatch.h:248
dbw_fca_can::DbwNode::timeout_steering_
bool timeout_steering_
Definition: DbwNode.h:174
dbw_fca_can::DbwNode::DbwNode
DbwNode(ros::NodeHandle &node, ros::NodeHandle &priv_nh)
Definition: DbwNode.cpp:79
dbw_fca_can::MsgBrakeReport::FLT1
uint8_t FLT1
Definition: dispatch.h:102
dbw_fca_can::DbwNode::faultBrakes
void faultBrakes(bool fault)
Definition: DbwNode.cpp:1280
dbw_fca_can::MsgSteeringReport
Definition: dispatch.h:158
dbw_fca_can::MsgMisc2Report::ac
uint8_t ac
Definition: dispatch.h:265
dbw_fca_can::DbwNode::pub_throttle_info_
ros::Publisher pub_throttle_info_
Definition: DbwNode.h:271
dbw_fca_can::DbwNode::pedal_luts_
bool pedal_luts_
Definition: DbwNode.h:236
dbw_fca_can::DbwNode::override_throttle_
bool override_throttle_
Definition: DbwNode.h:162
dbw_fca_can::MsgThrottleReport::WDCSRC
uint8_t WDCSRC
Definition: dispatch.h:129
dbw_fca_can::MsgBrakeReport::WDCSRC
uint8_t WDCSRC
Definition: dispatch.h:97
cmd
string cmd
dbw_fca_can::MsgMiscReport
Definition: dispatch.h:220
dbw_fca_can::throttlePedalFromPercent
static float throttlePedalFromPercent(float percent)
Definition: pedal_lut.h:147
dbw_fca_can::DbwNode::recvCanImu
void recvCanImu(const std::vector< can_msgs::Frame::ConstPtr > &msgs)
Definition: DbwNode.cpp:761
header
const std::string header
dbw_fca_can::DbwNode::~DbwNode
~DbwNode()
Definition: DbwNode.cpp:191
dbw_fca_can::MsgSteeringReport::TMOUT
uint8_t TMOUT
Definition: dispatch.h:171
ROS_INFO
#define ROS_INFO(...)
dbw_fca_can::DbwNode::sub_can_
ros::Subscriber sub_can_
Definition: DbwNode.h:250
dbw_fca_can::ID_THROTTLE_REPORT
@ ID_THROTTLE_REPORT
Definition: dispatch.h:522
dbw_fca_can::MsgMiscCmd::fl_vs_cmd
uint8_t fl_vs_cmd
Definition: dispatch.h:215
ROS_ASSERT
#define ROS_ASSERT(cond)
dbw_fca_can::MsgThrottleCmd::IGNORE
uint8_t IGNORE
Definition: dispatch.h:114
dbw_fca_can::DbwNode::fault_watchdog_warned_
bool fault_watchdog_warned_
Definition: DbwNode.h:171
dbw_fca_can::DbwNode::enabled_throttle_
bool enabled_throttle_
Definition: DbwNode.h:176
dbw_fca_can::MsgSteeringReport::CMD
int16_t CMD
Definition: dispatch.h:160
ros::Duration
dbw_fca_can::DbwNode::enable_joint_states_
bool enable_joint_states_
Definition: DbwNode.h:245
dbw_fca_can::MsgReportWheelSpeed
Definition: dispatch.h:281
dbw_fca_can::DbwNode::pub_sys_enable_
ros::Publisher pub_sys_enable_
Definition: DbwNode.h:279
dbw_fca_can::MsgBrakeReport::ENABLED
uint8_t ENABLED
Definition: dispatch.h:98
dbw_fca_can::MsgReportWheelSpeed::front_right
int16_t front_right
Definition: dispatch.h:283
dbw_fca_can::MsgBrakeCmd::EN
uint8_t EN
Definition: dispatch.h:110
dbw_fca_can::DbwNode::wheel_radius_
double wheel_radius_
Definition: DbwNode.h:242
dbw_fca_can::MsgGearCmd
Definition: dispatch.h:174
dbw_fca_can::MsgGearReport::OVERRIDE
uint8_t OVERRIDE
Definition: dispatch.h:184
dbw_fca_can::DbwNode::pub_can_
ros::Publisher pub_can_
Definition: DbwNode.h:259
dbw_fca_can::MsgMiscCmd
Definition: dispatch.h:192
dbw_fca_can::MsgSteeringReport::FLTCAL
uint8_t FLTCAL
Definition: dispatch.h:170
dbw_fca_can::ID_VERSION
@ ID_VERSION
Definition: dispatch.h:542
brake_sweep.node
node
Definition: brake_sweep.py:161
dbw_fca_can::DbwNode::enable_
bool enable_
Definition: DbwNode.h:160
dbw_fca_can::LIC_MUX_BDATE1
@ LIC_MUX_BDATE1
Definition: dispatch.h:393
dbw_fca_can::DbwNode::recvEnable
void recvEnable(const std_msgs::Empty::ConstPtr &msg)
Definition: DbwNode.cpp:195
ros::NodeHandle
dbw_fca_can::MsgMisc2Report::fr_vs_stat
uint8_t fr_vs_stat
Definition: dispatch.h:278
dbw_fca_can::MsgVersion::major
uint16_t major
Definition: dispatch.h:484
dbw_fca_can::ID_STEERING_REPORT
@ ID_STEERING_REPORT
Definition: dispatch.h:524
dbw_fca_can::MsgLicense::ldate1
uint8_t ldate1
Definition: dispatch.h:416
dbw_fca_can::MsgSteeringReport::TMODE
uint8_t TMODE
Definition: dispatch.h:161
dbw_fca_can::MsgSteeringCmd::CMD_TYPE
uint8_t CMD_TYPE
Definition: dispatch.h:149
ROS_INFO_THROTTLE
#define ROS_INFO_THROTTLE(period,...)
dbw_fca_can::MsgThrottleReport
Definition: dispatch.h:124
dbw_fca_can::MsgReportThrottleInfo::ign_stat
uint8_t ign_stat
Definition: dispatch.h:372


dbw_fca_can
Author(s): Kevin Hallenbeck
autogenerated on Fri Jan 5 2024 03:53:38