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 simple planning simulator package #5

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
8e97427
release v0.4.0
mitsudome-r Sep 18, 2020
bbcddb4
remove ROS1 packages temporarily
mitsudome-r Sep 29, 2020
edc7b36
add sample ros2 packages
mitsudome-r Sep 29, 2020
5fac7eb
add COLCON_IGNORE to ros1 packages
mitsudome-r Oct 8, 2020
c41b710
Fix simple planning simulator (#26)
TakaHoribe Oct 13, 2020
e14ecad
[simple_planning_simulator] add rostopic relay in launch file (#117)
mitsudome-r Nov 24, 2020
7406784
Adjust copyright notice on 532 out of 699 source files (#143)
nnmm Dec 3, 2020
7aa3365
Use quotes for includes where appropriate (#144)
nnmm Dec 7, 2020
c2ecb34
Run uncrustify on the entire Pilot.Auto codebase (#151)
nnmm Dec 8, 2020
ffab21d
reduce terminal ouput for better error message visibility (#200)
mitsudome-r Dec 23, 2020
fc3691f
Use trajectory for z position source (#243)
wep21 Dec 24, 2020
a97a775
Ros2 v0.8.0 engage (#342)
wep21 Feb 17, 2021
4dcfe97
Ros2 v0.8.0 fix packages (#351)
tkimura4 Feb 24, 2021
bdd1791
Rename ROS-related .yaml to .param.yaml (#352)
kenji-miyake Feb 24, 2021
bf134df
Fix typo in simulator module (#439)
kmiya Mar 16, 2021
b222d75
add use_sim-time option (#454)
tkimura4 Mar 26, 2021
4ef120c
Format launch files (#1219)
kenji-miyake Mar 30, 2021
0ccd6f1
Fix rolling build errors (#1225)
kenji-miyake Apr 5, 2021
9c2f176
Sync public repo (#1228)
mitsudome-r Apr 5, 2021
2e3c97d
Remove use_sim_time for set_parameter (#1260)
wep21 Apr 26, 2021
0289c8f
Refactor vehicle info util (#1305)
kenji-miyake May 11, 2021
c5f4978
Fix lint errors (#1378)
kenji-miyake May 25, 2021
52b35cf
Add pre-commit (#1560)
KeisukeShima Jul 19, 2021
04ccb95
Add markdownlint and prettier (#1661)
kenji-miyake Jul 20, 2021
5b7f460
add cov pub in psim (#1732)
k0suke-murakami Jul 30, 2021
f74b212
Fix -Wunused-parameter (#1836)
kenji-miyake Aug 14, 2021
c506ed7
fix some typos (#1941)
h-ohta Aug 25, 2021
4f99ca0
Add autoware api (#1979)
isamu-takagi Aug 31, 2021
7a3670e
add sort-package-xml hook in pre-commit (#1881)
KeisukeShima Sep 9, 2021
467c390
Feature/add ideal accel model interface (#1894)
mkuri Oct 21, 2021
7a8aa72
Change formatter to clang-format and black (#2332)
kenji-miyake Nov 2, 2021
b96e68b
Add COLCON_IGNORE (#500)
kenji-miyake Nov 4, 2021
789899e
Back port .auto control packages (#571)
TakaHoribe Nov 11, 2021
059f0e1
[simple planning simulator]change type of msg (#590)
tkimura4 Nov 12, 2021
82666d7
[autoware_vehicle_rviz_plugin/route_handler/simple_planning_simulator…
tkimura4 Nov 12, 2021
ee7955b
update to support velocity report header (#655)
TakaHoribe Nov 15, 2021
cc7525d
adapt to actuation cmd/status as control msg (#646)
taikitanaka3 Nov 16, 2021
b47409b
FIx vehicle status topic name/type (#658)
tkimura4 Nov 16, 2021
9068bd1
fix topic name (#674)
TakaHoribe Nov 17, 2021
4845cd6
Fix psim param path (#696)
isamu-takagi Nov 18, 2021
40add7f
Fix/psim topics emergency handler awapi (#702)
taikitanaka3 Nov 18, 2021
bc9c8c5
Auto/add turn indicators and hazards (#717)
kyoichi-sugahara Nov 19, 2021
336c5f9
[simple_planning_simulator]fix bug (#727)
tkimura4 Nov 24, 2021
530a622
fix gear process in sim (#728)
tkimura4 Nov 24, 2021
8168271
Fix for integration test (#732)
isamu-takagi Nov 25, 2021
69ad7af
Simple planning simulator update for latest develop (#735)
TakaHoribe Nov 26, 2021
4acd06b
Fix acceleration for reverse (#737)
rej55 Nov 29, 2021
764a4e7
Merge branch 'tier4/proposal' into 1-add-simple-planning-simulator
1222-takeshi Dec 2, 2021
7731f62
ci(pre-commit): autofix
pre-commit-ci[bot] Dec 2, 2021
bf2fc6b
Merge branch 'tier4/proposal' into 1-add-simple-planning-simulator
1222-takeshi Dec 2, 2021
373f7a4
Merge branch 'tier4/proposal' into 1-add-simple-planning-simulator
1222-takeshi Dec 3, 2021
a6f18eb
remove tests
tkimura4 Dec 6, 2021
3c67709
Merge branch 'tier4/proposal' into 1-add-simple-planning-simulator
tkimura4 Dec 6, 2021
17b40e0
Merge branch 'tier4/proposal' into 1-add-simple-planning-simulator
tkimura4 Dec 6, 2021
e1abab4
Revert "ci(pre-commit): autofix"
tkimura4 Dec 6, 2021
2306e18
Merge branch 'tier4/proposal' into 1-add-simple-planning-simulator
tkimura4 Dec 6, 2021
e277c4c
fix format
tkimura4 Dec 6, 2021
83cf537
Merge branch '1-add-simple-planning-simulator' of github.com:tkimura4…
tkimura4 Dec 6, 2021
72d50cf
Merge branch 'tier4/proposal' into 1-add-simple-planning-simulator
tkimura4 Dec 6, 2021
7c1f7c1
Merge branch 'tier4/proposal' into 1-add-simple-planning-simulator
tkimura4 Dec 6, 2021
9a8ae1e
Merge branch 'tier4/proposal' into 1-add-simple-planning-simulator
tkimura4 Dec 6, 2021
d947eee
fix autoware_api_utils
tkimura4 Dec 6, 2021
68b5ded
Merge branch 'tier4/proposal' into 1-add-simple-planning-simulator
tkimura4 Dec 6, 2021
6fb3e65
Merge branch 'tier4/proposal' into 1-add-simple-planning-simulator
tkimura4 Dec 6, 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
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ class Client
const typename ServiceT::Request::SharedPtr & request,
const std::chrono::nanoseconds & timeout = std::chrono::seconds(2))
{
RCLCPP_INFO(
logger_, "client request: \n%s", rosidl_generator_traits::to_yaml(*request).c_str());
RCLCPP_INFO(logger_, "client request");

if (!client_->service_is_ready()) {
RCLCPP_INFO(logger_, "client available");
Expand All @@ -55,8 +54,7 @@ class Client
return {response_error("Internal service has timed out."), nullptr};
}

RCLCPP_INFO(
logger_, "client response: \n%s", rosidl_generator_traits::to_yaml(future.get()).c_str());
RCLCPP_INFO(logger_, "client response");
return {response_success(), future.get()};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ class Service
auto wrapped_callback = [logger, callback](
typename ServiceT::Request::SharedPtr request,
typename ServiceT::Response::SharedPtr response) {
RCLCPP_INFO(
logger, "service request: \n%s", rosidl_generator_traits::to_yaml(*request).c_str());
RCLCPP_INFO(logger, "service request");
callback(request, response);
RCLCPP_INFO(
logger, "service response: \n%s", rosidl_generator_traits::to_yaml(*response).c_str());
RCLCPP_INFO(logger, "service response");
};
return wrapped_callback;
}
Expand Down
44 changes: 44 additions & 0 deletions simulator/simple_planning_simulator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
cmake_minimum_required(VERSION 3.6)

project(simple_planning_simulator)

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


# Component
ament_auto_add_library(${PROJECT_NAME} SHARED
include/simple_planning_simulator/simple_planning_simulator_core.hpp
include/simple_planning_simulator/visibility_control.hpp
src/simple_planning_simulator/simple_planning_simulator_core.cpp
src/simple_planning_simulator/vehicle_model/sim_model_interface.cpp
src/simple_planning_simulator/vehicle_model/sim_model_ideal_steer_vel.cpp
src/simple_planning_simulator/vehicle_model/sim_model_ideal_steer_acc.cpp
src/simple_planning_simulator/vehicle_model/sim_model_ideal_steer_acc_geared.cpp
src/simple_planning_simulator/vehicle_model/sim_model_delay_steer_acc.cpp
src/simple_planning_simulator/vehicle_model/sim_model_delay_steer_acc_geared.cpp
)
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${tf2_INCLUDE_DIRS})
autoware_set_compile_options(${PROJECT_NAME})

target_compile_options(${PROJECT_NAME} PRIVATE -Wno-old-style-cast) # RCLCPP_ERROR_THROTTLE() has built-in old-style casts.


# Node executable
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "simulation::simple_planning_simulator::SimplePlanningSimulator"
EXECUTABLE ${PROJECT_NAME}_exe
)


### Test
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()




ament_auto_package(INSTALL_TO_SHARE param launch)
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
simple_planning_simulator {#simple_planning_simulator-package-design}
===========


# Purpose / Use cases

This node simulates the vehicle motion for a vehicle command in 2D using a simple vehicle model.



# Design


The purpose of this simulator is for the integration test of planning and control modules. This does not simulate sensing or perception, but is implemented in pure c++ only and works without GPU.

## Assumptions / Known limits

- It simulates only in 2D motion.
- It does not perform physical operations such as collision and sensing, but only calculates the integral results of vehicle dynamics.


## Inputs / Outputs / API


**input**
- input/vehicle_control_command [`autoware_auto_msgs/msg/VehicleControlCommand`] : target command to drive a vehicle.
- input/ackermann_control_command [`autoware_auto_msgs/msg/AckermannControlCommand`] : target command to drive a vehicle.
- input/vehicle_state_command [`autoware_auto_msgs/msg/VehicleStateCommand`] : target state command (e.g. gear).
- /initialpose [`geometry_msgs/msg/PoseWithCovarianceStamped`] : for initial pose

**output**
- /tf [`tf2_msgs/msg/TFMessage`] : simulated vehicle pose (base_link)
- /vehicle/vehicle_kinematic_state [`autoware_auto_msgs/msg/VehicleKinematicState`] : simulated kinematic state (defined in CoM)
- /vehicle/state_report [`autoware_auto_msgs/msg/VehicleStateReport`] : current vehicle state (e.g. gear, mode, etc.)


## Inner-workings / Algorithms

### Common Parameters

|Name|Type|Description|Default value|
|:---|:---|:---|:---|
|simulated_frame_id | string | set to the child_frame_id in output tf |"base_link"|
|origin_frame_id | string | set to the frame_id in output tf |"odom"|
|initialize_source | string | If "ORIGIN", the initial pose is set at (0,0,0). If "INITIAL_POSE_TOPIC", node will wait until the `/initialpose` topic is published. | "INITIAL_POSE_TOPIC" | "INITIAL_POSE_TOPIC" |
|add_measurement_noise | bool | If true, the Gaussian noise is added to the simulated results.| true|
|pos_noise_stddev | double | Standard deviation for position noise | 0.01|
|rpy_noise_stddev | double | Standard deviation for Euler angle noise| 0.0001|
|vel_noise_stddev | double | Standard deviation for longitudinal velocity noise | 0.0|
|angvel_noise_stddev | double | Standard deviation for angular velocity noise| 0.0|
|steer_noise_stddev | double | Standard deviation for steering angle noise| 0.0001|



### Vehicle Model Parameters


**vehicle_model_type options**

- `IDEAL_STEER_VEL`
- `IDEAL_STEER_ACC`
- `IDEAL_STEER_ACC_GEARED`
- `DELAY_STEER_ACC`
- `DELAY_STEER_ACC_GEARED`

The `IDEAL` model moves ideally as commanded, while the `DELAY` model moves based on a 1st-order with time delay model. The `STEER` means the model receives the steer command. The `VEL` means the model receives the target velocity command, while the `ACC` model receives the target acceleration command. The `GEARED` suffix means that the motion will consider the gear command: the vehicle moves only one direction following the gear.

The table below shows which models correspond to what parameters. The model names are written in abbreviated form (e.g. IDEAL_STEER_VEL = I_ST_V).


|Name|Type|Description|I_ST_V|I_ST_A|I_ST_A_G|D_ST_A|D_ST_A_G|Default value| unit |
|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|
|acc_time_delay | double | dead time for the acceleration input | x | x | x | o | o | 0.1 | [s] |
|steer_time_delay | double | dead time for the steering input | x | x | x | o | o | 0.24| [s] |
|acc_time_constant | double | time constant of the 1st-order acceleration dynamics | x | x | x | o | o | 0.1 | [s] |
|steer_time_constant | double | time constant of the 1st-order steering dynamics | x | x | x | o | o | 0.27| [s] |
|vel_lim | double | limit of velocity | x | x | x | o | o | 50.0| [m/s] |
|vel_rate_lim | double | limit of acceleration | x | x | x | o | o | 7.0 | [m/ss] |
|steer_lim | double | limit of steering angle | x | x | x | o | o | 1.0 | [rad] |
|steer_rate_lim | double | limit of steering angle change rate | x | x | x | o | o | 5.0 | [rad/s] |
<!-- |deadzone_delta_steer | double | dead zone for the steering dynamics | x | x | x | o | o | 0.0 | [rad] | -->


*Note*: The steering/velocity/acceleration dynamics is modeled by a first order system with a deadtime in a *delay* model. The definition of the *time constant* is the time it takes for the step response to rise up to 63% of its final value. The *deadtime* is a delay in the response to a control input.


### Default TF configuration

Since the vehicle outputs `odom`->`base_link` tf, this simulator outputs the tf with the same frame_id configuration.
In the simple_planning_simulator.launch.py, the node that outputs the `map`->`odom` tf, that usually estimated by the localization module (e.g. NDT), will be launched as well. Since the tf output by this simulator module is an ideal value, `odom`->`map` will always be 0.


## Error detection and handling

The only validation on inputs being done is testing for a valid vehicle model type.


# Security considerations
<!-- Required -->
<!-- Things to consider:
- Spoofing (How do you check for and handle fake input?)
- Tampering (How do you check for and handle tampered input?)
- Repudiation (How are you affected by the actions of external actors?).
- Information Disclosure (Can data leak?).
- Denial of Service (How do you handle spamming?).
- Elevation of Privilege (Do you need to change permission levels during execution?) -->


# References / External links
This is originally developed in the Autoware.AI. See the link below.

https://github.com/Autoware-AI/simulation/tree/master/wf_simulator

# Future extensions / Unimplemented parts

- Improving the accuracy of vehicle models (e.g., adding steering dead zones and slip behavior)
- Cooperation with modules that output pseudo pointcloud or pseudo perception results


# Related issues

- #1142: Follow-up to #570 - Integrate simple_planning_simulator Into CI
Loading