Skip to content

Commit

Permalink
feat(vehicle_cmd_gate): add an option for using raw external commands (
Browse files Browse the repository at this point in the history
…autowarefoundation#4325)

* clean_commit

Signed-off-by: ismetatabay <ismet@leodrive.ai>

* move enable_cmd_limit_filter argument to param file

Signed-off-by: ismetatabay <ismet@leodrive.ai>

---------

Signed-off-by: ismetatabay <ismet@leodrive.ai>
  • Loading branch information
ismetatabay authored and kminoda committed Aug 23, 2023
1 parent f7cafb1 commit c0b6e10
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use_emergency_handling: false
check_external_emergency_heartbeat: false
use_start_request: false
enable_cmd_limit_filter: true
external_emergency_stop_heartbeat_timeout: 0.0
stop_hold_acceleration: -1.5
emergency_acceleration: -2.4
Expand Down
9 changes: 6 additions & 3 deletions control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ VehicleCmdGate::VehicleCmdGate(const rclcpp::NodeOptions & node_options)
moderate_stop_service_acceleration_ =
declare_parameter<double>("moderate_stop_service_acceleration");
stop_check_duration_ = declare_parameter<double>("stop_check_duration");
enable_cmd_limit_filter_ = declare_parameter<bool>("enable_cmd_limit_filter");

// Vehicle Parameter
const auto vehicle_info = vehicle_info_util::VehicleInfoUtil(*this).getVehicleInfo();
Expand Down Expand Up @@ -411,9 +412,11 @@ void VehicleCmdGate::publishControlCommands(const Commands & commands)
filtered_commands.control.longitudinal.acceleration = stop_hold_acceleration_;
}

// Apply limit filtering
filtered_commands.control = filterControlCommand(filtered_commands.control);

// Check if command filtering option is enable
if (enable_cmd_limit_filter_) {
// Apply limit filtering
filtered_commands.control = filterControlCommand(filtered_commands.control);
}
// tmp: Publish vehicle emergency status
VehicleEmergencyStamped vehicle_cmd_emergency;
vehicle_cmd_emergency.emergency = (use_emergency_handling_ && is_system_emergency_);
Expand Down
1 change: 1 addition & 0 deletions control/vehicle_cmd_gate/src/vehicle_cmd_gate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class VehicleCmdGate : public rclcpp::Node
double stop_hold_acceleration_;
double emergency_acceleration_;
double moderate_stop_service_acceleration_;
bool enable_cmd_limit_filter_;

// Service
rclcpp::Service<EngageSrv>::SharedPtr srv_engage_;
Expand Down

0 comments on commit c0b6e10

Please sign in to comment.