Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
isouf authored Feb 28, 2024
2 parents 2bc2ec8 + 0410e92 commit d47faeb
Show file tree
Hide file tree
Showing 64 changed files with 2,607 additions and 224 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-and-test-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
rosdistro:
- humble
container-suffix:
- ""
- -cuda
include:
- rosdistro: humble
Expand Down
15 changes: 15 additions & 0 deletions control/joy_controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@

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

## Usage

### ROS 2 launch

```bash
# With default config (ds4)
ros2 launch joy_controller joy_controller.launch.xml

# Default config but select from the existing parameter files
ros2 launch joy_controller joy_controller_param_selection.launch.xml joy_type:=ds4 # or g29, p65, xbox

# Override the param file
ros2 launch joy_controller joy_controller.launch.xml config_file:=/path/to/your/param.yaml
```

## Input / Output

### Input topics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**:
ros__parameters:
joy_type: $(var joy_type)
joy_type: DS4
update_rate: 10.0
accel_ratio: 3.0
brake_ratio: 5.0
Expand Down
16 changes: 16 additions & 0 deletions control/joy_controller/config/joy_controller_g29.param.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**:
ros__parameters:
joy_type: G29
update_rate: 10.0
accel_ratio: 3.0
brake_ratio: 5.0
steer_ratio: 0.5
steering_angle_velocity: 0.1
accel_sensitivity: 1.0
brake_sensitivity: 1.0
control_command:
raw_control: false
velocity_gain: 3.0
max_forward_velocity: 20.0
max_backward_velocity: 3.0
backward_accel_ratio: 1.0
16 changes: 16 additions & 0 deletions control/joy_controller/config/joy_controller_p65.param.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**:
ros__parameters:
joy_type: P65
update_rate: 10.0
accel_ratio: 3.0
brake_ratio: 5.0
steer_ratio: 0.5
steering_angle_velocity: 0.1
accel_sensitivity: 1.0
brake_sensitivity: 1.0
control_command:
raw_control: false
velocity_gain: 3.0
max_forward_velocity: 20.0
max_backward_velocity: 3.0
backward_accel_ratio: 1.0
16 changes: 16 additions & 0 deletions control/joy_controller/config/joy_controller_xbox.param.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**:
ros__parameters:
joy_type: XBOX
update_rate: 10.0
accel_ratio: 3.0
brake_ratio: 5.0
steer_ratio: 0.5
steering_angle_velocity: 0.1
accel_sensitivity: 1.0
brake_sensitivity: 1.0
control_command:
raw_control: false
velocity_gain: 3.0
max_forward_velocity: 20.0
max_backward_velocity: 3.0
backward_accel_ratio: 1.0
3 changes: 1 addition & 2 deletions control/joy_controller/launch/joy_controller.launch.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<launch>
<arg name="joy_type" default="DS4" description="options: DS4, G29, P65, XBOX"/>
<arg name="external_cmd_source" default="remote" description="options: local, remote"/>

<arg name="input_joy" default="/joy"/>
Expand All @@ -13,7 +12,7 @@
<arg name="output_gate_mode" default="/control/gate_mode_cmd"/>
<arg name="output_vehicle_engage" default="/vehicle/engage"/>

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

<node pkg="joy_controller" exec="joy_controller" name="joy_controller" output="screen">
<remap from="input/joy" to="$(var input_joy)"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<launch>
<arg name="joy_type" default="ds4" description="options: ds4, g29, p65, xbox"/>

<include file="$(find-pkg-share joy_controller)/launch/joy_controller.launch.xml">
<arg name="config_file" value="$(find-pkg-share joy_controller)/config/joy_controller_$(var joy_type).param.yaml"/>
</include>
</launch>
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MapUpdateModule
friend class NDTScanMatcher;

// Update the specified NDT
void update_ndt(const geometry_msgs::msg::Point & position, NdtType & ndt);
bool update_ndt(const geometry_msgs::msg::Point & position, NdtType & ndt);
void update_map(const geometry_msgs::msg::Point & position);
[[nodiscard]] bool should_update_map(const geometry_msgs::msg::Point & position);
void publish_partial_pcd_map();
Expand Down
17 changes: 13 additions & 4 deletions localization/ndt_scan_matcher/src/map_update_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ void MapUpdateModule::update_map(const geometry_msgs::msg::Point & position)
// lock and rebuild ndt_ptr_
if (need_rebuild_) {
ndt_ptr_mutex_->lock();

auto param = ndt_ptr_->getParams();
auto input_source = ndt_ptr_->getInputSource();

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

ndt_ptr_mutex_->lock();
auto dummy_ptr = ndt_ptr_;
auto input_source = ndt_ptr_->getInputSource();
ndt_ptr_ = secondary_ndt_ptr_;
ndt_ptr_->setInputSource(input_source);
ndt_ptr_mutex_->unlock();

dummy_ptr.reset();
}

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

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

Expand All @@ -128,7 +136,7 @@ void MapUpdateModule::update_ndt(const geometry_msgs::msg::Point & position, Ndt
while (status != std::future_status::ready) {
RCLCPP_INFO(logger_, "waiting response");
if (!rclcpp::ok()) {
return;
return false; // No update
}
status = result.wait_for(std::chrono::seconds(1));
}
Expand All @@ -140,7 +148,7 @@ void MapUpdateModule::update_ndt(const geometry_msgs::msg::Point & position, Ndt
logger_, "Update map (Add: %lu, Remove: %lu)", maps_to_add.size(), map_ids_to_remove.size());
if (maps_to_add.empty() && map_ids_to_remove.empty()) {
RCLCPP_INFO(logger_, "Skip map update");
return;
return false; // No update
}

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

void MapUpdateModule::publish_partial_pcd_map()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void PointcloudBasedOccupancyGridMapNode::onPointcloudWithObstacleAndRaw(
Pose gridmap_origin{};
Pose scan_origin{};
try {
robot_pose = utils::getPose(input_raw_msg->header, *tf2_, map_frame_);
robot_pose = utils::getPose(input_raw_msg->header.stamp, *tf2_, base_link_frame_, map_frame_);
gridmap_origin =
utils::getPose(input_raw_msg->header.stamp, *tf2_, gridmap_origin_frame_, map_frame_);
scan_origin =
Expand Down
8 changes: 8 additions & 0 deletions perception/radar_crossing_objects_noise_filter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@ rclcpp_components_register_node(radar_crossing_objects_noise_filter_node_compone

# Tests
if(BUILD_TESTING)
find_package(ament_cmake_ros REQUIRED)
list(APPEND AMENT_LINT_AUTO_EXCLUDE ament_cmake_uncrustify)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()

file(GLOB_RECURSE test_files test/**/*.cpp)
ament_add_ros_isolated_gtest(radar_crossing_objects_noise_filter ${test_files})

target_link_libraries(radar_crossing_objects_noise_filter
radar_crossing_objects_noise_filter_node_component
)
endif()

# Package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class RadarCrossingObjectsNoiseFilterNode : public rclcpp::Node
// Parameter
NodeParam node_param_{};

public:
// Core
bool isNoise(const DetectedObject & object);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2024 TierIV
//
// 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.

#include <rclcpp/rclcpp.hpp>

#include <gtest/gtest.h>

int main(int argc, char * argv[])
{
testing::InitGoogleTest(&argc, argv);
rclcpp::init(argc, argv);
bool result = RUN_ALL_TESTS();
rclcpp::shutdown();
return result;
}
Loading

0 comments on commit d47faeb

Please sign in to comment.