Skip to content

Commit d47faeb

Browse files
authored
Merge branch 'main' into main
2 parents 2bc2ec8 + 0410e92 commit d47faeb

File tree

64 files changed

+2607
-224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2607
-224
lines changed

.github/workflows/build-and-test-differential.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
rosdistro:
2525
- humble
2626
container-suffix:
27-
- ""
2827
- -cuda
2928
include:
3029
- rosdistro: humble

control/joy_controller/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@
44

55
`joy_controller` is the package to convert a joy msg to autoware commands (e.g. steering wheel, shift, turn signal, engage) for a vehicle.
66

7+
## Usage
8+
9+
### ROS 2 launch
10+
11+
```bash
12+
# With default config (ds4)
13+
ros2 launch joy_controller joy_controller.launch.xml
14+
15+
# Default config but select from the existing parameter files
16+
ros2 launch joy_controller joy_controller_param_selection.launch.xml joy_type:=ds4 # or g29, p65, xbox
17+
18+
# Override the param file
19+
ros2 launch joy_controller joy_controller.launch.xml config_file:=/path/to/your/param.yaml
20+
```
21+
722
## Input / Output
823

924
### Input topics

control/joy_controller/config/joy_controller.param.yaml control/joy_controller/config/joy_controller_ds4.param.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**:
22
ros__parameters:
3-
joy_type: $(var joy_type)
3+
joy_type: DS4
44
update_rate: 10.0
55
accel_ratio: 3.0
66
brake_ratio: 5.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**:
2+
ros__parameters:
3+
joy_type: G29
4+
update_rate: 10.0
5+
accel_ratio: 3.0
6+
brake_ratio: 5.0
7+
steer_ratio: 0.5
8+
steering_angle_velocity: 0.1
9+
accel_sensitivity: 1.0
10+
brake_sensitivity: 1.0
11+
control_command:
12+
raw_control: false
13+
velocity_gain: 3.0
14+
max_forward_velocity: 20.0
15+
max_backward_velocity: 3.0
16+
backward_accel_ratio: 1.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**:
2+
ros__parameters:
3+
joy_type: P65
4+
update_rate: 10.0
5+
accel_ratio: 3.0
6+
brake_ratio: 5.0
7+
steer_ratio: 0.5
8+
steering_angle_velocity: 0.1
9+
accel_sensitivity: 1.0
10+
brake_sensitivity: 1.0
11+
control_command:
12+
raw_control: false
13+
velocity_gain: 3.0
14+
max_forward_velocity: 20.0
15+
max_backward_velocity: 3.0
16+
backward_accel_ratio: 1.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**:
2+
ros__parameters:
3+
joy_type: XBOX
4+
update_rate: 10.0
5+
accel_ratio: 3.0
6+
brake_ratio: 5.0
7+
steer_ratio: 0.5
8+
steering_angle_velocity: 0.1
9+
accel_sensitivity: 1.0
10+
brake_sensitivity: 1.0
11+
control_command:
12+
raw_control: false
13+
velocity_gain: 3.0
14+
max_forward_velocity: 20.0
15+
max_backward_velocity: 3.0
16+
backward_accel_ratio: 1.0

control/joy_controller/launch/joy_controller.launch.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<launch>
2-
<arg name="joy_type" default="DS4" description="options: DS4, G29, P65, XBOX"/>
32
<arg name="external_cmd_source" default="remote" description="options: local, remote"/>
43

54
<arg name="input_joy" default="/joy"/>
@@ -13,7 +12,7 @@
1312
<arg name="output_gate_mode" default="/control/gate_mode_cmd"/>
1413
<arg name="output_vehicle_engage" default="/vehicle/engage"/>
1514

16-
<arg name="config_file" default="$(find-pkg-share joy_controller)/config/joy_controller.param.yaml"/>
15+
<arg name="config_file" default="$(find-pkg-share joy_controller)/config/joy_controller_ds4.param.yaml"/>
1716

1817
<node pkg="joy_controller" exec="joy_controller" name="joy_controller" output="screen">
1918
<remap from="input/joy" to="$(var input_joy)"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<launch>
2+
<arg name="joy_type" default="ds4" description="options: ds4, g29, p65, xbox"/>
3+
4+
<include file="$(find-pkg-share joy_controller)/launch/joy_controller.launch.xml">
5+
<arg name="config_file" value="$(find-pkg-share joy_controller)/config/joy_controller_$(var joy_type).param.yaml"/>
6+
</include>
7+
</launch>

localization/ndt_scan_matcher/include/ndt_scan_matcher/map_update_module.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class MapUpdateModule
5555
friend class NDTScanMatcher;
5656

5757
// Update the specified NDT
58-
void update_ndt(const geometry_msgs::msg::Point & position, NdtType & ndt);
58+
bool update_ndt(const geometry_msgs::msg::Point & position, NdtType & ndt);
5959
void update_map(const geometry_msgs::msg::Point & position);
6060
[[nodiscard]] bool should_update_map(const geometry_msgs::msg::Point & position);
6161
void publish_partial_pcd_map();

localization/ndt_scan_matcher/src/map_update_module.cpp

+13-4
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ void MapUpdateModule::update_map(const geometry_msgs::msg::Point & position)
7070
// lock and rebuild ndt_ptr_
7171
if (need_rebuild_) {
7272
ndt_ptr_mutex_->lock();
73+
7374
auto param = ndt_ptr_->getParams();
7475
auto input_source = ndt_ptr_->getInputSource();
7576

@@ -87,13 +88,20 @@ void MapUpdateModule::update_map(const geometry_msgs::msg::Point & position)
8788
// the main ndt_ptr_) overlap, the latency of updating/alignment reduces partly.
8889
// If the updating is done the main ndt_ptr_, either the update or the NDT
8990
// align will be blocked by the other.
90-
update_ndt(position, *secondary_ndt_ptr_);
91+
const bool updated = update_ndt(position, *secondary_ndt_ptr_);
92+
if (!updated) {
93+
last_update_position_ = position;
94+
return;
95+
}
9196

9297
ndt_ptr_mutex_->lock();
98+
auto dummy_ptr = ndt_ptr_;
9399
auto input_source = ndt_ptr_->getInputSource();
94100
ndt_ptr_ = secondary_ndt_ptr_;
95101
ndt_ptr_->setInputSource(input_source);
96102
ndt_ptr_mutex_->unlock();
103+
104+
dummy_ptr.reset();
97105
}
98106

99107
secondary_ndt_ptr_.reset(new NdtType);
@@ -106,7 +114,7 @@ void MapUpdateModule::update_map(const geometry_msgs::msg::Point & position)
106114
publish_partial_pcd_map();
107115
}
108116

109-
void MapUpdateModule::update_ndt(const geometry_msgs::msg::Point & position, NdtType & ndt)
117+
bool MapUpdateModule::update_ndt(const geometry_msgs::msg::Point & position, NdtType & ndt)
110118
{
111119
auto request = std::make_shared<autoware_map_msgs::srv::GetDifferentialPointCloudMap::Request>();
112120

@@ -128,7 +136,7 @@ void MapUpdateModule::update_ndt(const geometry_msgs::msg::Point & position, Ndt
128136
while (status != std::future_status::ready) {
129137
RCLCPP_INFO(logger_, "waiting response");
130138
if (!rclcpp::ok()) {
131-
return;
139+
return false; // No update
132140
}
133141
status = result.wait_for(std::chrono::seconds(1));
134142
}
@@ -140,7 +148,7 @@ void MapUpdateModule::update_ndt(const geometry_msgs::msg::Point & position, Ndt
140148
logger_, "Update map (Add: %lu, Remove: %lu)", maps_to_add.size(), map_ids_to_remove.size());
141149
if (maps_to_add.empty() && map_ids_to_remove.empty()) {
142150
RCLCPP_INFO(logger_, "Skip map update");
143-
return;
151+
return false; // No update
144152
}
145153

146154
const auto exe_start_time = std::chrono::system_clock::now();
@@ -170,6 +178,7 @@ void MapUpdateModule::update_ndt(const geometry_msgs::msg::Point & position, Ndt
170178
std::chrono::duration_cast<std::chrono::microseconds>(exe_end_time - exe_start_time).count();
171179
const auto exe_time = static_cast<double>(duration_micro_sec) / 1000.0;
172180
RCLCPP_INFO(logger_, "Time duration for creating new ndt_ptr: %lf [ms]", exe_time);
181+
return true; // Updated
173182
}
174183

175184
void MapUpdateModule::publish_partial_pcd_map()

perception/probabilistic_occupancy_grid_map/src/pointcloud_based_occupancy_grid_map/pointcloud_based_occupancy_grid_map_node.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void PointcloudBasedOccupancyGridMapNode::onPointcloudWithObstacleAndRaw(
170170
Pose gridmap_origin{};
171171
Pose scan_origin{};
172172
try {
173-
robot_pose = utils::getPose(input_raw_msg->header, *tf2_, map_frame_);
173+
robot_pose = utils::getPose(input_raw_msg->header.stamp, *tf2_, base_link_frame_, map_frame_);
174174
gridmap_origin =
175175
utils::getPose(input_raw_msg->header.stamp, *tf2_, gridmap_origin_frame_, map_frame_);
176176
scan_origin =

perception/radar_crossing_objects_noise_filter/CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,17 @@ rclcpp_components_register_node(radar_crossing_objects_noise_filter_node_compone
1717

1818
# Tests
1919
if(BUILD_TESTING)
20+
find_package(ament_cmake_ros REQUIRED)
2021
list(APPEND AMENT_LINT_AUTO_EXCLUDE ament_cmake_uncrustify)
2122
find_package(ament_lint_auto REQUIRED)
2223
ament_lint_auto_find_test_dependencies()
24+
25+
file(GLOB_RECURSE test_files test/**/*.cpp)
26+
ament_add_ros_isolated_gtest(radar_crossing_objects_noise_filter ${test_files})
27+
28+
target_link_libraries(radar_crossing_objects_noise_filter
29+
radar_crossing_objects_noise_filter_node_component
30+
)
2331
endif()
2432

2533
# Package

perception/radar_crossing_objects_noise_filter/include/radar_crossing_objects_noise_filter/radar_crossing_objects_noise_filter_node.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class RadarCrossingObjectsNoiseFilterNode : public rclcpp::Node
5858
// Parameter
5959
NodeParam node_param_{};
6060

61+
public:
6162
// Core
6263
bool isNoise(const DetectedObject & object);
6364
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2024 TierIV
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include <rclcpp/rclcpp.hpp>
16+
17+
#include <gtest/gtest.h>
18+
19+
int main(int argc, char * argv[])
20+
{
21+
testing::InitGoogleTest(&argc, argv);
22+
rclcpp::init(argc, argv);
23+
bool result = RUN_ALL_TESTS();
24+
rclcpp::shutdown();
25+
return result;
26+
}

0 commit comments

Comments
 (0)