Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add vehicle cmd gate package #75

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
c8b6ab7
release v0.4.0
mitsudome-r Sep 18, 2020
c6cabd1
remove ROS1 packages temporarily
mitsudome-r Sep 29, 2020
93a1e35
add sample ros2 packages
mitsudome-r Sep 29, 2020
ba8eb70
remove ROS1 packages
mitsudome-r Oct 6, 2020
3c7c6b2
Revert "remove ROS1 packages temporarily"
mitsudome-r Oct 8, 2020
01bcd36
add COLCON_IGNORE to ros1 packages
mitsudome-r Oct 8, 2020
a48b308
Port vehicle_cmd_gate to ROS2 (#3)
nnmm Oct 13, 2020
ee858a7
fix duration unit for RCLCPP_*_THROTTLE (#75)
TakaHoribe Oct 30, 2020
f7b627f
Rename h files to hpp (#142)
nnmm Dec 3, 2020
54ab924
Adjust copyright notice on 532 out of 699 source files (#143)
nnmm Dec 3, 2020
307ada9
Use quotes for includes where appropriate (#144)
nnmm Dec 7, 2020
e3af1d8
Run uncrustify on the entire Pilot.Auto codebase (#151)
nnmm Dec 8, 2020
eaab510
Added linters to vehicle_cmd_gate (#168)
esteve Dec 16, 2020
0cc92ab
Make launch files load vehicle model params dependent on argument (#228)
nnmm Dec 23, 2020
3c29c99
change from vehicle_model to vehicle_param_file (#242)
k0suke-murakami Dec 24, 2020
ebcc005
[update to v0.8.0] vehicle cmd gate (#252)
TakaHoribe Feb 8, 2021
f7829b5
[vehicle_cmd_gate]: Fix launch (#320)
wep21 Feb 10, 2021
5a0fc6e
Ros2 v0.8.0 engage (#342)
wep21 Feb 17, 2021
93266f0
Ros2 v0.8.0 fix packages (#351)
tkimura4 Feb 24, 2021
a6e3b16
Ros2 fix service name (#448)
wep21 Mar 22, 2021
c446370
add use_sim-time option (#454)
tkimura4 Mar 26, 2021
52e8590
Sync public repo (#1228)
mitsudome-r Apr 5, 2021
c50c039
Fix/fix porting miss (#1254)
kenji-miyake Apr 14, 2021
e0c2418
Unify Apache-2.0 license name (#1242)
kmiya Apr 15, 2021
17c8c67
Make control modules components (#1262)
wep21 Apr 21, 2021
fc75ddb
Remove use_sim_time for set_parameter (#1260)
wep21 Apr 26, 2021
64e2c8b
Porting remote cmd selector (#1286)
KeisukeShima May 7, 2021
31926c4
Refactor vehicle info util (#1305)
kenji-miyake May 11, 2021
9ce908e
Fix -Wunused-parameter (#1836)
kenji-miyake Aug 14, 2021
ca56504
suppress warnings for control packages (#1892)
h-ohta Aug 19, 2021
27b9f14
Add autoware api (#1979)
isamu-takagi Aug 31, 2021
4ad6b40
Use EmergencyState instead of deprecated EmergencyMode (#2030)
kenji-miyake Sep 8, 2021
c048847
add sort-package-xml hook in pre-commit (#1881)
KeisukeShima Sep 9, 2021
fcd31dc
fix subscription topic name (#2076)
Sep 13, 2021
ddb8f3c
Add emergency status API (#2174)
isamu-takagi Oct 5, 2021
e837d1f
Fix lateral jerk filter in vehicle cmd gate (#1657)
TakaHoribe Oct 21, 2021
40f3be4
[vehicle_cmd_gate] parametrize acceleration (#1771)
TakaHoribe Oct 21, 2021
13de633
Change formatter to clang-format and black (#2332)
kenji-miyake Nov 2, 2021
cb5bb23
Add COLCON_IGNORE (#500)
kenji-miyake Nov 4, 2021
a26af1b
[vehicle cmd gate] porting vehicle cmd gate (#609)
kyoichi-sugahara Nov 15, 2021
6947015
adapt to actuation cmd/status as control msg (#646)
taikitanaka3 Nov 16, 2021
ce043fc
fix emergency command (#665)
taikitanaka3 Nov 16, 2021
bfefc2d
[vehicle_cmd_gate]add readme (#624)
kyoichi-sugahara Nov 16, 2021
29eb8d3
set default gear (#675)
tkimura4 Nov 17, 2021
11df3ea
Merge branch 'tier4/proposal' into 1-add-vehicle-cmd-gate
taikitanaka3 Dec 1, 2021
2c90d72
Merge branch 'tier4/proposal' into 1-add-vehicle-cmd-gate
tkimura4 Dec 3, 2021
de071e8
Merge branch 'tier4/proposal' into 1-add-vehicle-cmd-gate
taikitanaka3 Dec 6, 2021
e6498b8
Merge branch 'tier4/proposal' into 1-add-vehicle-cmd-gate
taikitanaka3 Dec 6, 2021
ec94aa0
Merge branch 'tier4/proposal' into 1-add-vehicle-cmd-gate
1222-takeshi Dec 6, 2021
ae5c5bc
Merge branch 'tier4/proposal' into 1-add-vehicle-cmd-gate
1222-takeshi Dec 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions control/vehicle_cmd_gate/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
cmake_minimum_required(VERSION 3.5)
project(vehicle_cmd_gate)

### Compile options
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
endif()

### Dependencies
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()

# Generate exe file
ament_auto_add_library(vehicle_cmd_gate_node SHARED
src/vehicle_cmd_gate.cpp
src/vehicle_cmd_filter.cpp
)

rclcpp_components_register_node(vehicle_cmd_gate_node
PLUGIN "VehicleCmdGate"
EXECUTABLE vehicle_cmd_gate
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()

ament_add_gtest(test_vehicle_cmd_gate
test/src/test_main.cpp
test/src/test_vehicle_cmd_filter.cpp
)
ament_target_dependencies(test_vehicle_cmd_gate
rclcpp
autoware_control_msgs
)
target_link_libraries(test_vehicle_cmd_gate
vehicle_cmd_gate_node
)
endif()

ament_auto_package(
INSTALL_TO_SHARE
launch
config
)
62 changes: 62 additions & 0 deletions control/vehicle_cmd_gate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# vehicle_cmd_gate

## Purpose

`vehicle_cmd_gate` is the package to get information from emergency handler, planning module, external controller, and send a msg to vehicle.

## Inputs / Outputs

### Input

| Name | Type | Description |
| ------------------------------------------- | ---------------------------------------------------------- | -------------------------------------------------------------------- |
| `~/input/steering` | `autoware_auto_vehicle_msgs::msg::SteeringReport` | steering status |
| `~/input/auto/control_cmd` | `autoware_auto_control_msgs::msg::AckermannControlCommand` | command for lateral and longitudinal velocity from planning module |
| `~/input/auto/turn_indicators_cmd` | `autoware_auto_vehicle_msgs::msg::TurnIndicatorsCommand` | turn indicators command from planning module |
| `~/input/auto/hazard_lights_cmd` | `autoware_auto_vehicle_msgs::msg::HazardLightsCommand` | hazard lights command from planning module |
| `~/input/auto/gear_cmd` | `autoware_auto_vehicle_msgs::msg::GearCommand` | gear command from planning module |
| `~/input/external/control_cmd` | `autoware_auto_control_msgs::msg::AckermannControlCommand` | command for lateral and longitudinal velocity from external |
| `~/input/external/turn_indicators_cmd` | `autoware_auto_vehicle_msgs::msg::TurnIndicatorsCommand` | turn indicators command from external |
| `~/input/external/hazard_lights_cmd` | `autoware_auto_vehicle_msgs::msg::HazardLightsCommand` | hazard lights command from external |
| `~/input/external/gear_cmd` | `autoware_auto_vehicle_msgs::msg::GearCommand` | gear command from external |
| `~/input/external_emergency_stop_heartbeat` | `autoware_external_api_msgs::msg::Heartbeat` | heartbeat |
| `~/input/gate_mode` | `autoware_control_msgs::msg::GateMode` | gate mode (AUTO or EXTERNAL) |
| `~/input/emergency_state` | `autoware_auto_system_msgs::msg::EmergencyState` | used to detect the emergency situation of the vehicle |
| `~/input/emergency/control_cmd` | `autoware_auto_control_msgs::msg::AckermannControlCommand` | command for lateral and longitudinal velocity from emergency handler |
| `~/input/emergency/hazard_lights_cmd` | `autoware_auto_vehicle_msgs::msg::HazardLightsCommand` | hazard lights command from emergency handler |
| `~/input/emergency/gear_cmd` | `autoware_auto_vehicle_msgs::msg::GearCommand` | gear command from emergency handler |
| `~/input/engage` | `autoware_auto_vehicle_msgs::msg::Engage` | engage signal |

### Output

| Name | Type | Description |
| -------------------------------------- | ---------------------------------------------------------- | -------------------------------------------------------- |
| `~/output/vehicle_cmd_emergency` | `autoware_auto_system_msgs::msg::EmergencyState` | emergency state which was originally in vehicle command |
| `~/output/command/control_cmd` | `autoware_auto_control_msgs::msg::AckermannControlCommand` | command for lateral and longitudinal velocity to vehicle |
| `~/output/command/turn_indicators_cmd` | `autoware_auto_vehicle_msgs::msg::TurnIndicatorsCommand` | turn indicators command to vehicle |
| `~/output/command/hazard_lights_cmd` | `autoware_auto_vehicle_msgs::msg::HazardLightsCommand` | hazard lights command to vehicle |
| `~/output/command/gear_cmd` | `autoware_auto_vehicle_msgs::msg::GearCommand` | gear command to vehicle |
| `~/output/gate_mode` | `autoware_control_msgs::msg::GateMode` | gate mode (AUTO or EXTERNAL) |
| `~/output/engage` | `autoware_auto_vehicle_msgs::msg::Engage` | engage signal |
| `~/output/external_emergency` | `autoware_external_api_msgs::msg::Emergency` | external emergency signal |

## Parameters

| Parameter | Type | Description |
| ------------------------------------------- | ------ | -------------------------------------------------------------- |
| `update_period` | double | update period |
| `use_emergency_handling` | bool | true when emergency handler is used |
| `use_external_emergency_stop` | bool | true when external emergency stop information is used |
| `system_emergency_heartbeat_timeout` | double | timeout for system emergency |
| `external_emergency_stop_heartbeat_timeout` | double | timeout for external emergency |
| `stop_hold_acceleration` | double | longitudinal acceleration cmd when vehicle should stop |
| `emergency_acceleration` | double | longitudinal acceleration cmd when vehicle stop with emergency |
| `vel_lim` | double | limit of longitudinal velocity |
| `lon_acc_lim` | double | limit of longitudinal acceleration |
| `lon_jerk_lim` | double | limit of longitudinal jerk |
| `lat_acc_lim` | double | limit of lateral acceleration |
| `lat_jerk_lim` | double | limit of lateral jerk |

## Assumptions / Known limits

TBD.
12 changes: 12 additions & 0 deletions control/vehicle_cmd_gate/config/vehicle_cmd_gate.param.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**:
ros__parameters:
update_rate: 10.0
system_emergency_heartbeat_timeout: 0.5
external_emergency_stop_heartbeat_timeout: 0.0
stop_hold_acceleration: -1.5
emergency_acceleration: -2.4
vel_lim: 25.0
lon_acc_lim: 5.0
lon_jerk_lim: 5.0
lat_acc_lim: 5.0
lat_jerk_lim: 5.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright 2015-2019 Autoware Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef VEHICLE_CMD_GATE__VEHICLE_CMD_FILTER_HPP_
#define VEHICLE_CMD_GATE__VEHICLE_CMD_FILTER_HPP_

#include <autoware_auto_control_msgs/msg/ackermann_control_command.hpp>

class VehicleCmdFilter
{
public:
VehicleCmdFilter();
~VehicleCmdFilter() = default;

void setWheelBase(double v) { wheel_base_ = v; }
void setVelLim(double v) { vel_lim_ = v; }
void setLonAccLim(double v) { lon_acc_lim_ = v; }
void setLonJerkLim(double v) { lon_jerk_lim_ = v; }
void setLatAccLim(double v) { lat_acc_lim_ = v; }
void setLatJerkLim(double v) { lat_jerk_lim_ = v; }
void setPrevCmd(const autoware_auto_control_msgs::msg::AckermannControlCommand & v)
{
prev_cmd_ = v;
}

void limitLongitudinalWithVel(
autoware_auto_control_msgs::msg::AckermannControlCommand & input) const;
void limitLongitudinalWithAcc(
const double dt, autoware_auto_control_msgs::msg::AckermannControlCommand & input) const;
void limitLongitudinalWithJerk(
const double dt, autoware_auto_control_msgs::msg::AckermannControlCommand & input) const;
void limitLateralWithLatAcc(
const double dt, autoware_auto_control_msgs::msg::AckermannControlCommand & input) const;
void limitLateralWithLatJerk(
const double dt, autoware_auto_control_msgs::msg::AckermannControlCommand & input) const;

private:
double wheel_base_;
double vel_lim_;
double lon_acc_lim_;
double lon_jerk_lim_;
double lat_acc_lim_;
double lat_jerk_lim_;
autoware_auto_control_msgs::msg::AckermannControlCommand prev_cmd_;

double calcLatAcc(const autoware_auto_control_msgs::msg::AckermannControlCommand & cmd) const;
double calcSteerFromLatacc(const double v, const double latacc) const;
double limitDiff(const double curr, const double prev, const double diff_lim) const;
};

#endif // VEHICLE_CMD_GATE__VEHICLE_CMD_FILTER_HPP_
Loading