Skip to content

Commit

Permalink
Merge branch 'main' into ground-segmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
karishma1911 authored Jan 2, 2024
2 parents c6943c4 + ed8ffea commit 0c891db
Show file tree
Hide file tree
Showing 72 changed files with 1,175 additions and 494 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ Planning:
- node_name: /planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner
logger_name: planning.scenario_planning.lane_driving.behavior_planning.behavior_path_planner.avoidance

behavior_path_planner_goal_planner:
- node_name: /planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner
logger_name: planning.scenario_planning.lane_driving.behavior_planning.behavior_path_planner.goal_planner

behavior_path_planner_start_planner:
- node_name: /planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner
logger_name: planning.scenario_planning.lane_driving.behavior_planning.behavior_path_planner.start_planner

behavior_path_avoidance_by_lane_change:
- node_name: /planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner
logger_name: lane_change.AVOIDANCE_BY_LANE_CHANGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ void VelocitySteeringFactorsPanel::onSteeringFactors(const SteeringFactorArray::
case SteeringFactor::APPROACHING:
label->setText("APPROACHING");
break;
case SteeringFactor::TRYING:
label->setText("TRYING");
break;
case SteeringFactor::TURNING:
label->setText("TURNING");
break;
Expand Down
2 changes: 1 addition & 1 deletion common/traffic_light_utils/src/traffic_light_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void setSignalUnknown(tier4_perception_msgs::msg::TrafficSignal & signal, float
signal.elements[0].shape = tier4_perception_msgs::msg::TrafficLightElement::UNKNOWN;
signal.elements[0].color = tier4_perception_msgs::msg::TrafficLightElement::UNKNOWN;
// the default value is -1, which means to not set confidence
if (confidence >= 0) {
if (confidence > 0) {
signal.elements[0].confidence = confidence;
}
}
Expand Down
23 changes: 23 additions & 0 deletions control/joy_controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
| `steering_angle_velocity` | double | steering angle velocity for operation |
| `accel_sensitivity` | double | sensitivity to calculate acceleration for external API (commanded acceleration is pow(operation, 1 / sensitivity)) |
| `brake_sensitivity` | double | sensitivity to calculate deceleration for external API (commanded acceleration is pow(operation, 1 / sensitivity)) |
| `raw_control` | bool | skip input odometry if true |
| `velocity_gain` | double | ratio to calculate velocity by acceleration |
| `max_forward_velocity` | double | absolute max velocity to go forward |
| `max_backward_velocity` | double | absolute max velocity to go backward |
Expand Down Expand Up @@ -85,3 +86,25 @@
| Autoware Disengage ||
| Vehicle Engage ||
| Vehicle Disengage ||

## XBOX Joystick Key Map

| Action | Button |
| -------------------- | --------------------- |
| Acceleration | RT |
| Brake | LT |
| Steering | Left Stick Left Right |
| Shift up | Cursor Up |
| Shift down | Cursor Down |
| Shift Drive | Cursor Left |
| Shift Reverse | Cursor Right |
| Turn Signal Left | LB |
| Turn Signal Right | RB |
| Clear Turn Signal | A |
| Gate Mode | B |
| Emergency Stop | View |
| Clear Emergency Stop | Menu |
| Autoware Engage | X |
| Autoware Disengage | Y |
| Vehicle Engage | Left Stick Button |
| Vehicle Disengage | Right Stick Button |
1 change: 1 addition & 0 deletions control/joy_controller/config/joy_controller.param.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class AutowareJoyControllerNode : public rclcpp::Node
double brake_sensitivity_;

// ControlCommand Parameter
bool raw_control_;
double velocity_gain_;
double max_forward_velocity_;
double max_backward_velocity_;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Copyright 2023 The Autoware Contributors
//
// 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 JOY_CONTROLLER__JOY_CONVERTER__XBOX_JOY_CONVERTER_HPP_
#define JOY_CONTROLLER__JOY_CONVERTER__XBOX_JOY_CONVERTER_HPP_

#include "joy_controller/joy_converter/joy_converter_base.hpp"

#include <algorithm>

namespace joy_controller
{
class XBOXJoyConverter : public JoyConverterBase
{
public:
explicit XBOXJoyConverter(const sensor_msgs::msg::Joy & j) : j_(j) {}

float accel() const { return std::max(0.0f, -((RT() - 1.0f) / 2.0f)); }

float brake() const { return std::max(0.0f, -((LT() - 1.0f) / 2.0f)); }

float steer() const { return LStickLeftRight(); }

bool shift_up() const { return CursorUpDown() == 1.0f; }
bool shift_down() const { return CursorUpDown() == -1.0f; }
bool shift_drive() const { return CursorLeftRight() == 1.0f; }
bool shift_reverse() const { return CursorLeftRight() == -1.0f; }

bool turn_signal_left() const { return LB(); }
bool turn_signal_right() const { return RB(); }
bool clear_turn_signal() const { return A(); }

bool gate_mode() const { return B(); }

bool emergency_stop() const { return ChangeView(); }
bool clear_emergency_stop() const { return Menu(); }

bool autoware_engage() const { return X(); }
bool autoware_disengage() const { return Y(); }

bool vehicle_engage() const { return LStickButton(); }
bool vehicle_disengage() const { return RStickButton(); }

private:
float LStickLeftRight() const { return j_.axes.at(0); }
float LStickUpDown() const { return j_.axes.at(1); }
float RStickLeftRight() const { return j_.axes.at(2); }
float RStickUpDown() const { return j_.axes.at(3); }
float RT() const { return j_.axes.at(4); }
float LT() const { return j_.axes.at(5); }
float CursorLeftRight() const { return j_.axes.at(6); }
float CursorUpDown() const { return j_.axes.at(7); }

bool A() const { return j_.buttons.at(0); }
bool B() const { return j_.buttons.at(1); }
bool X() const { return j_.buttons.at(3); }
bool Y() const { return j_.buttons.at(4); }
bool LB() const { return j_.buttons.at(6); }
bool RB() const { return j_.buttons.at(7); }
bool Menu() const { return j_.buttons.at(11); }
bool LStickButton() const { return j_.buttons.at(13); }
bool RStickButton() const { return j_.buttons.at(14); }
bool ChangeView() const { return j_.buttons.at(15); }
bool Xbox() const { return j_.buttons.at(16); }

const sensor_msgs::msg::Joy j_;
};
} // namespace joy_controller

#endif // JOY_CONTROLLER__JOY_CONVERTER__XBOX_JOY_CONVERTER_HPP_
2 changes: 1 addition & 1 deletion control/joy_controller/launch/joy_controller.launch.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<launch>
<arg name="joy_type" default="DS4" description="options: DS4, G29, P65"/>
<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 Down
8 changes: 7 additions & 1 deletion control/joy_controller/schema/joy_controller.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"type": "string",
"description": "Joy controller type",
"default": "DS4",
"enum": ["P65", "DS4", "G29"]
"enum": ["P65", "DS4", "G29", "XBOX"]
},
"update_rate": {
"type": "number",
Expand Down Expand Up @@ -55,6 +55,11 @@
"control_command": {
"type": "object",
"properties": {
"raw_control": {
"type": "boolean",
"description": "Whether to skip input odometry",
"default": false
},
"velocity_gain": {
"type": "number",
"description": "Ratio to calculate velocity by acceleration",
Expand All @@ -79,6 +84,7 @@
}
},
"required": [
"raw_control",
"velocity_gain",
"max_forward_velocity",
"max_backward_velocity",
Expand Down
18 changes: 13 additions & 5 deletions control/joy_controller/src/joy_controller/joy_controller_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "joy_controller/joy_converter/ds4_joy_converter.hpp"
#include "joy_controller/joy_converter/g29_joy_converter.hpp"
#include "joy_controller/joy_converter/p65_joy_converter.hpp"
#include "joy_controller/joy_converter/xbox_joy_converter.hpp"

#include <tier4_api_utils/tier4_api_utils.hpp>

Expand Down Expand Up @@ -154,6 +155,8 @@ void AutowareJoyControllerNode::onJoy(const sensor_msgs::msg::Joy::ConstSharedPt
joy_ = std::make_shared<const G29JoyConverter>(*msg);
} else if (joy_type_ == "DS4") {
joy_ = std::make_shared<const DS4JoyConverter>(*msg);
} else if (joy_type_ == "XBOX") {
joy_ = std::make_shared<const XBOXJoyConverter>(*msg);
} else {
joy_ = std::make_shared<const P65JoyConverter>(*msg);
}
Expand Down Expand Up @@ -217,7 +220,7 @@ bool AutowareJoyControllerNode::isDataReady()
}

// Twist
{
if (!raw_control_) {
if (!twist_) {
RCLCPP_WARN_THROTTLE(
get_logger(), *get_clock(), std::chrono::milliseconds(5000).count(),
Expand Down Expand Up @@ -458,6 +461,7 @@ AutowareJoyControllerNode::AutowareJoyControllerNode(const rclcpp::NodeOptions &
steering_angle_velocity_ = declare_parameter<double>("steering_angle_velocity");
accel_sensitivity_ = declare_parameter<double>("accel_sensitivity");
brake_sensitivity_ = declare_parameter<double>("brake_sensitivity");
raw_control_ = declare_parameter<bool>("control_command.raw_control");
velocity_gain_ = declare_parameter<double>("control_command.velocity_gain");
max_forward_velocity_ = declare_parameter<double>("control_command.max_forward_velocity");
max_backward_velocity_ = declare_parameter<double>("control_command.max_backward_velocity");
Expand All @@ -477,10 +481,14 @@ AutowareJoyControllerNode::AutowareJoyControllerNode(const rclcpp::NodeOptions &
sub_joy_ = this->create_subscription<sensor_msgs::msg::Joy>(
"input/joy", 1, std::bind(&AutowareJoyControllerNode::onJoy, this, std::placeholders::_1),
subscriber_option);
sub_odom_ = this->create_subscription<nav_msgs::msg::Odometry>(
"input/odometry", 1,
std::bind(&AutowareJoyControllerNode::onOdometry, this, std::placeholders::_1),
subscriber_option);
if (!raw_control_) {
sub_odom_ = this->create_subscription<nav_msgs::msg::Odometry>(
"input/odometry", 1,
std::bind(&AutowareJoyControllerNode::onOdometry, this, std::placeholders::_1),
subscriber_option);
} else {
twist_ = std::make_shared<geometry_msgs::msg::TwistStamped>();
}

// Publisher
pub_control_command_ =
Expand Down
79 changes: 79 additions & 0 deletions control/lane_departure_checker/schema/lane_departure_checker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Parameters for lane_departure_checker",
"type": "object",
"definitions": {
"lane_departure_checker": {
"type": "object",
"properties": {
"footprint_margin_scale": {
"type": "number",
"default": 1.0,
"description": "Coefficient for expanding footprint margin. Multiplied by 1 standard deviation."
},
"resample_interval": {
"type": "number",
"default": 0.3,
"description": "Minimum Euclidean distance between points when resample trajectory.[m]."
},
"max_deceleration": {
"type": "number",
"default": 2.8,
"description": "Maximum deceleration when calculating braking distance."
},
"delay_time": {
"type": "number",
"default": 1.3,
"description": "Delay time which took to actuate brake when calculating braking distance. [second]."
},
"max_lateral_deviation": {
"type": "number",
"default": 2.0,
"description": "Maximum lateral deviation in vehicle coordinate. [m]."
},
"max_longitudinal_deviation": {
"type": "number",
"default": 2.0,
"description": "Maximum longitudinal deviation in vehicle coordinate. [m]."
},
"max_yaw_deviation_deg": {
"type": "number",
"default": 60.0,
"description": "Maximum ego yaw deviation from trajectory. [deg]."
},
"ego_nearest_dist_threshold": {
"type": "number"
},
"ego_nearest_yaw_threshold": {
"type": "number"
},
"min_braking_distance": {
"type": "number"
}
},
"required": [
"footprint_margin_scale",
"resample_interval",
"max_deceleration",
"max_lateral_deviation",
"max_longitudinal_deviation",
"max_yaw_deviation_deg",
"ego_nearest_dist_threshold",
"ego_nearest_yaw_threshold",
"min_braking_distance"
]
}
},
"properties": {
"/**": {
"type": "object",
"properties": {
"ros__parameters": {
"$ref": "#/definitions/lane_departure_checker"
}
},
"required": ["ros__parameters"]
}
},
"required": ["/**"]
}
6 changes: 2 additions & 4 deletions control/mpc_lateral_controller/src/lowpass_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,8 @@ bool filt_vector(const int num, std::vector<double> & u)
double tmp = 0.0;
int num_tmp = 0;
double count = 0;
if (i - num < 0) {
num_tmp = i;
} else if (i + num > static_cast<int>(u.size()) - 1) {
num_tmp = static_cast<int>(u.size()) - i - 1;
if ((i - num < 0) || (i + num > static_cast<int>(u.size()) - 1)) {
num_tmp = std::min(i, static_cast<int>(u.size()) - i - 1);
} else {
num_tmp = num;
}
Expand Down
24 changes: 24 additions & 0 deletions control/mpc_lateral_controller/test/test_lowpass_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,30 @@ TEST(TestLowpassFilter, MoveAverageFilter)
EXPECT_EQ(filtered_vec[4], 23.0 / 3);
EXPECT_EQ(filtered_vec[5], original_vec[5]);
}
{
const int window_size = 3;
const std::vector<double> original_vec = {1.0, 1.0, 1.0, 1.0};
std::vector<double> filtered_vec = original_vec;
EXPECT_TRUE(MoveAverageFilter::filt_vector(window_size, filtered_vec));
ASSERT_EQ(filtered_vec.size(), original_vec.size());
EXPECT_EQ(filtered_vec[0], original_vec[0]);
EXPECT_EQ(filtered_vec[1], 1.0);
EXPECT_EQ(filtered_vec[2], 1.0);
EXPECT_EQ(filtered_vec[3], original_vec[3]);
}
{
const int window_size = 4;
const std::vector<double> original_vec = {1.0, 3.0, 4.0, 6.0, 7.0, 10.0};
std::vector<double> filtered_vec = original_vec;
EXPECT_TRUE(MoveAverageFilter::filt_vector(window_size, filtered_vec));
ASSERT_EQ(filtered_vec.size(), original_vec.size());
EXPECT_EQ(filtered_vec[0], original_vec[0]);
EXPECT_EQ(filtered_vec[1], 8.0 / 3);
EXPECT_EQ(filtered_vec[2], 21.0 / 5);
EXPECT_EQ(filtered_vec[3], 30.0 / 5);
EXPECT_EQ(filtered_vec[4], 23.0 / 3);
EXPECT_EQ(filtered_vec[5], original_vec[5]);
}
}
TEST(TestLowpassFilter, Butterworth2dFilter)
{
Expand Down
Loading

0 comments on commit 0c891db

Please sign in to comment.