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(control_data_collecting_tool): add trajectory inside circle and lanelet2 trajectory #156

Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
98cfbb1
Add trajectory inside circle
YoshihiroKogure Nov 20, 2024
6305aa5
Fix bug
YoshihiroKogure Nov 20, 2024
43316cf
Add lanelet2 trajectory
YoshihiroKogure Nov 20, 2024
40c6c9c
pre-commit run
YoshihiroKogure Nov 20, 2024
a9d671a
Fix bug
YoshihiroKogure Nov 20, 2024
5d8654a
pre-commit
YoshihiroKogure Nov 20, 2024
61312ec
Update README.md
YoshihiroKogure Nov 20, 2024
4adc140
Add parameter descriptions to the README
YoshihiroKogure Nov 20, 2024
063f281
style(pre-commit): autofix
pre-commit-ci[bot] Nov 20, 2024
1e31241
Revise the content
YoshihiroKogure Nov 20, 2024
2d954d8
style(pre-commit): autofix
pre-commit-ci[bot] Nov 20, 2024
ebd457e
Update README
YoshihiroKogure Nov 20, 2024
5f7df16
Update README
YoshihiroKogure Nov 20, 2024
d3b8e37
Add comments
YoshihiroKogure Nov 20, 2024
7014de7
Update prameters for along_road course
YoshihiroKogure Nov 22, 2024
80e95a8
style(pre-commit): autofix
pre-commit-ci[bot] Nov 22, 2024
2362225
Add default mask and mask selector
YoshihiroKogure Nov 25, 2024
08bc15e
Add mask to plotter
YoshihiroKogure Nov 25, 2024
857f08b
Data collection concerning Mask
YoshihiroKogure Nov 25, 2024
36ee806
Modify the code to publish the pose
YoshihiroKogure Nov 25, 2024
9f6e7ef
style(pre-commit): autofix
pre-commit-ci[bot] Nov 25, 2024
ef6afa9
Modify to work even when map_path is not provided
YoshihiroKogure Nov 25, 2024
c6d6cfb
Add steer rate plot
YoshihiroKogure Nov 26, 2024
3537a91
Update README.md and fix typo
YoshihiroKogure Nov 26, 2024
42e524e
Changes to the README and parameter values
YoshihiroKogure Nov 27, 2024
fa6c2a7
fix markdownlint
kosuke55 Nov 28, 2024
b5a4630
ignore prettier
kosuke55 Nov 28, 2024
edf18ab
Fix typo
YoshihiroKogure Nov 29, 2024
57856fa
style(pre-commit): autofix
pre-commit-ci[bot] Nov 29, 2024
31449f9
Add cpell:ignore
YoshihiroKogure Nov 29, 2024
ffd36b1
Remove cspell:ignore
YoshihiroKogure Nov 29, 2024
50f46bd
Merge branch 'main' into feat/trajectory_inside_circle_and_lanelet2_t…
YoshihiroKogure Dec 2, 2024
d372051
Merge branch 'feat/default_mask' into feat/trajectory_inside_circle_a…
YoshihiroKogure Dec 2, 2024
1cdbd05
style(pre-commit): autofix
pre-commit-ci[bot] Dec 2, 2024
1f5ec46
Revert "style(pre-commit): autofix"
YoshihiroKogure Dec 2, 2024
f98536d
Revert "Merge branch 'feat/default_mask' into feat/trajectory_inside_…
YoshihiroKogure Dec 2, 2024
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
46 changes: 30 additions & 16 deletions control_data_collecting_tool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,53 @@ project(control_data_collecting_tool)
find_package(autoware_cmake REQUIRED)
autoware_package()

# Configure Qt5
find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
set(QT_LIBRARIES Qt5::Widgets)
set(CMAKE_AUTOMOC ON)

# Find necessary ROS 2 packages
find_package(rviz_common REQUIRED)
find_package(pluginlib REQUIRED)
find_package(rclcpp REQUIRED)

# Build the library as a plugin
ament_auto_add_library(${PROJECT_NAME} SHARED
src/data_collecting_area_selection.cpp
src/data_collecting_goal_pose.cpp
)

# Link necessary libraries
ament_target_dependencies(${PROJECT_NAME}
Qt5
rviz_common
pluginlib
rclcpp
)

# Export the plugin XML file
pluginlib_export_plugin_description_file(rviz_common plugins/plugin_description.xml)

# Install scripts
install(PROGRAMS
scripts/data_collecting_pure_pursuit_trajectory_follower.py
scripts/data_collecting_trajectory_publisher.py
scripts/data_collecting_plotter.py
scripts/data_collecting_rosbag_record.py
scripts/data_collecting_data_counter.py
scripts/data_collecting_base_node.py
scripts/rosbag_play.py
DESTINATION lib/${PROJECT_NAME}
)

# Install other configurations and files
install(
DIRECTORY config/
DESTINATION share/${PROJECT_NAME}/config
)

find_package(Qt5 REQUIRED Core Widgets)
set(QT_LIBRARIES Qt5::Widgets)

set(CMAKE_AUTOMOC ON)


ament_auto_add_library(${PROJECT_NAME} SHARED
src/data_collecting_area_selection.cpp
)

target_link_libraries(${PROJECT_NAME}
${QT_LIBRARIES})

pluginlib_export_plugin_description_file(rviz_common plugins/plugin_description.xml)

install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})

# Build configuration for the package
ament_auto_package(
INSTALL_TO_SHARE
plugins
Expand Down
265 changes: 171 additions & 94 deletions control_data_collecting_tool/README.md

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions control_data_collecting_tool/config/common_param.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**:
ros__parameters:
LOAD_ROSBAG2_FILES: true

# COURSE_NAME: eight_course
# COURSE_NAME: u_shaped_return
# COURSE_NAME: straight_line_positive
# COURSE_NAME: straight_line_negative
COURSE_NAME: reversal_loop_circle
# COURSE_NAME: along_road

NUM_BINS_V: 10
NUM_BINS_STEER: 20
NUM_BINS_A: 10
V_MIN: 0.0
V_MAX: 11.5
STEER_MIN: -0.6
STEER_MAX: 0.6
A_MIN: -1.0
A_MAX: 1.0

max_lateral_accel: 2.0
lateral_error_threshold: 2.79
yaw_error_threshold: 0.75
velocity_limit_by_tracking_error: 1.0
mov_ave_window: 50
target_longitudinal_velocity: 6.0

pure_pursuit_type: linearized
# pure_pursuit_type: naive
wheel_base: 2.79
acc_kp: 1.0
lookahead_time: 2.0
min_lookahead: 2.0
linearized_pure_pursuit_steer_kp_param: 2.0
linearized_pure_pursuit_steer_kd_param: 2.0
stop_acc: -2.0
stop_jerk_lim: 5.0
lon_acc_lim: 1.5
lon_jerk_lim: 0.5
steer_lim: 0.6
steer_rate_lim: 0.6
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**:
ros__parameters:
# Course Specific Parameters
velocity_on_curve: 3.5
stopping_distance: 15.0
course_width: 1.5

# Smoothing window for calculating curvature
smoothing_window: 100

# Data Collection Range
COLLECTING_DATA_V_MIN: 0.5
COLLECTING_DATA_V_MAX: 8.0
COLLECTING_DATA_A_MIN: -1.0
COLLECTING_DATA_A_MAX: 1.0

# Noise Parameters
longitudinal_velocity_noise_amp: 0.01
longitudinal_velocity_noise_min_period: 5.0
longitudinal_velocity_noise_max_period: 20.0

acc_noise_amp: 0.01
acc_noise_min_period: 5.0
acc_noise_max_period: 20.0

steer_noise_amp: 0.01
steer_noise_min_period: 10.0
steer_noise_max_period: 20.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**:
ros__parameters:
# Course Specific Parameters
velocity_on_curve: 4.5
# Smoothing window for trajectory
smoothing_window: 400

# Data Collection Range
COLLECTING_DATA_V_MIN: 0.5
COLLECTING_DATA_V_MAX: 8.0
COLLECTING_DATA_A_MIN: -1.0
COLLECTING_DATA_A_MAX: 1.0

# Noise Parameters
longitudinal_velocity_noise_amp: 0.01
longitudinal_velocity_noise_min_period: 5.0
longitudinal_velocity_noise_max_period: 20.0

acc_noise_amp: 0.01
acc_noise_min_period: 5.0
acc_noise_max_period: 20.0

steer_noise_amp: 0.01
steer_noise_min_period: 5.0
steer_noise_max_period: 20.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**:
ros__parameters:
# Course Specific Parameters
trajectory_radius: 35.0
enclosing_radius: 40.0
Copy link
Contributor

@kosuke55 kosuke55 Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memo: the data collection area only indicates the center, currently need to set in params.
better to specify radius from area in the future

look_ahead_distance: 15.0

# Data Collection Range
COLLECTING_DATA_V_MIN: 0.5
COLLECTING_DATA_V_MAX: 8.0
COLLECTING_DATA_A_MIN: -1.0
COLLECTING_DATA_A_MAX: 1.0

# Noise Parameters
longitudinal_velocity_noise_amp: 0.01
longitudinal_velocity_noise_min_period: 5.0
longitudinal_velocity_noise_max_period: 20.0

acc_noise_amp: 0.01
acc_noise_min_period: 5.0
acc_noise_max_period: 20.0

steer_noise_amp: 0.01
steer_noise_min_period: 5.0
steer_noise_max_period: 20.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**:
ros__parameters:
# Course Specific Parameters
stopping_buffer_distance: 10.0

# Data Collection Range
COLLECTING_DATA_V_MIN: 0.5
COLLECTING_DATA_V_MAX: 8.0
COLLECTING_DATA_A_MIN: -1.0
COLLECTING_DATA_A_MAX: 1.0

# Noise Parameters
longitudinal_velocity_noise_amp: 0.01
longitudinal_velocity_noise_min_period: 5.0
longitudinal_velocity_noise_max_period: 20.0

acc_noise_amp: 0.01
acc_noise_min_period: 5.0
acc_noise_max_period: 20.0

steer_noise_amp: 0.01
steer_noise_min_period: 5.0
steer_noise_max_period: 20.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**:
ros__parameters:
# Course Specific Parameters
stopping_buffer_distance: 10.0

# Data Collection Range
COLLECTING_DATA_V_MIN: 0.5
COLLECTING_DATA_V_MAX: 8.0
COLLECTING_DATA_A_MIN: -1.0
COLLECTING_DATA_A_MAX: 1.0

# Noise Parameters
longitudinal_velocity_noise_amp: 0.01
longitudinal_velocity_noise_min_period: 5.0
longitudinal_velocity_noise_max_period: 20.0

acc_noise_amp: 0.01
acc_noise_min_period: 5.0
acc_noise_max_period: 20.0

steer_noise_amp: 0.01
steer_noise_min_period: 5.0
steer_noise_max_period: 20.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**:
ros__parameters:
# Course Specific Parameters
velocity_on_curve: 4.5

# Data Collection Range
COLLECTING_DATA_V_MIN: 0.5
COLLECTING_DATA_V_MAX: 8.0
COLLECTING_DATA_A_MIN: -1.0
COLLECTING_DATA_A_MAX: 1.0

# Noise Parameters
longitudinal_velocity_noise_amp: 0.01
longitudinal_velocity_noise_min_period: 5.0
longitudinal_velocity_noise_max_period: 20.0

acc_noise_amp: 0.01
acc_noise_min_period: 5.0
acc_noise_max_period: 20.0

steer_noise_amp: 0.01
steer_noise_min_period: 5.0
steer_noise_max_period: 20.0
54 changes: 0 additions & 54 deletions control_data_collecting_tool/config/param.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,61 @@
from ament_index_python.packages import get_package_share_directory
import launch
from launch import LaunchService
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
import yaml


# Load yaml file
def get_course_name(yaml_file_path):
with open(yaml_file_path, "r") as file:
data = yaml.safe_load(file)

# get 'COURSE_NAME'
course_name = data.get("/**", {}).get("ros__parameters", {}).get("COURSE_NAME", None)
return course_name


def generate_launch_description():
# Define the argument for map_path
DeclareLaunchArgument("map_path", description="Path to the map directory")
# Use the map_path argument in parameters
map_path = LaunchConfiguration("map_path")

# Get the path to the common param file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I forgot but we can get map with /map/vector_map but it is ok for now.
Currently, a map must be specified even when using something other than along_road.

Copy link
Contributor Author

@YoshihiroKogure YoshihiroKogure Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ef6afa9, I modified it so that it works without reading the map_path when the along_road feature is not used.

(I had the wrong URL, so I have replaced it with the correct one.)

package_share_directory = get_package_share_directory("control_data_collecting_tool")
param_file_path = os.path.join(package_share_directory, "config", "param.yaml")
common_param_file_path = os.path.join(package_share_directory, "config", "common_param.yaml")

# Get the path to the course-specific param file
course_name = get_course_name(common_param_file_path)
course_specific_param_file_path = os.path.join(
package_share_directory, "config/course_param", course_name + "_param.yaml"
)

return launch.LaunchDescription(
[
Node(
package="control_data_collecting_tool",
executable="data_collecting_pure_pursuit_trajectory_follower.py",
name="data_collecting_pure_pursuit_trajectory_follower",
parameters=[param_file_path],
parameters=[common_param_file_path],
),
Node(
package="control_data_collecting_tool",
executable="data_collecting_trajectory_publisher.py",
name="data_collecting_trajectory_publisher",
parameters=[param_file_path],
parameters=[
common_param_file_path,
course_specific_param_file_path,
{"map_path": map_path},
],
),
Node(
package="control_data_collecting_tool",
executable="data_collecting_plotter.py",
name="data_collecting_plotter",
parameters=[param_file_path],
parameters=[common_param_file_path],
),
Node(
package="control_data_collecting_tool",
Expand All @@ -54,7 +84,7 @@ def generate_launch_description():
package="control_data_collecting_tool",
executable="data_collecting_data_counter.py",
name="data_collecting_data_counter",
parameters=[param_file_path],
parameters=[common_param_file_path],
),
]
)
Expand Down
Loading
Loading