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

chore: sync upstream #776

Merged
merged 28 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4003ba4
feat(dynamic_avoidance): not avoid back object (#4751)
takayuki5168 Aug 28, 2023
55b53e1
feat(imu_corrector): add gyro_bias_validator (#4729)
kminoda Aug 28, 2023
e897b19
feat(eluclidean_cluster): add cyclic/processing time ms (#4747)
soblin Aug 28, 2023
572cf8e
refactor(behavior_path_planner): renaming and comment collision check…
zulfaqar-azmi-t4 Aug 28, 2023
1e27327
chore(map_based_prediction): add maintainer (#4627)
takayuki5168 Aug 28, 2023
2875bf6
feat(tier4_autoware_utils): add getOrDeclearParam function (#4763)
TakaHoribe Aug 28, 2023
8613b51
feat(map_based_prediciton): consider y component of the velocity vect…
YoshiRi Aug 28, 2023
6bc983c
fix(multi_object_tracker): consider vehicle twist direction (#4637)
takayuki5168 Aug 28, 2023
6dcd8b0
chore(blind_spot): use getOrDeclareParam (#4764)
TakaHoribe Aug 28, 2023
bb702a6
feat(gnss_poser): remove local cartesian wgs84 coordinate (#4726)
kminoda Aug 28, 2023
e017725
refactor(crosswalk): use getOrDeclareParameter (#4765)
TakaHoribe Aug 28, 2023
ddb49ec
refactor(detection_area): use getOrDeclareParameter (#4766)
TakaHoribe Aug 28, 2023
61630e6
refactor(intersection): use getOrDeclareParameter (#4767)
TakaHoribe Aug 28, 2023
af177f4
refactor(no_stopping_area): use getOrDeclareParameter (#4769)
TakaHoribe Aug 28, 2023
73f3e0e
refactor(occlusion_spot): use getOrDeclareParameter (#4770)
TakaHoribe Aug 28, 2023
7f5f946
feat!: add vertical datum in map_projector_info (#4708)
kminoda Aug 28, 2023
d5204ab
refactor(out_of_lane): use getOrDeclareParameter (#4771)
TakaHoribe Aug 28, 2023
820130a
refactor(run_out): use getOrDeclareParameter (#4772)
TakaHoribe Aug 28, 2023
3cdf4f5
refactor(speed_bump): use getOrDeclareParameter (#4773)
TakaHoribe Aug 28, 2023
440d1c9
refactor(stop_line): use getOrDeclareParameter (#4774)
TakaHoribe Aug 28, 2023
4ed36d2
refactor(traffic_light): use getOrDeclareParameter (#4775)
TakaHoribe Aug 28, 2023
8f4e473
refactor(virtual_traffic_light): use getOrDeclareParameter (#4776)
TakaHoribe Aug 28, 2023
e70531f
refactor(walkway): use getOrDeclareParameter (#4777)
TakaHoribe Aug 28, 2023
ae51e2a
refactor(behavior_path_planner): use getOrDeclareParameter (#4790)
satoshi-ota Aug 28, 2023
dbeeeb1
feat(avoidance): flexible avoidance safety check param (#4754)
satoshi-ota Aug 28, 2023
84107d0
style(map_projection_loader): unify the name of yaml file (#4778)
kminoda Aug 28, 2023
0cbfc3d
refactor(perception_rviz_plugin): only delete markers with unused Mar…
Owen-Liuyuxuan Aug 29, 2023
06f4052
perf(safety_check): use light weight object position check logic (#4762)
satoshi-ota Aug 29, 2023
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 @@ -146,6 +146,11 @@ class AUTOWARE_AUTO_PERCEPTION_RVIZ_PLUGIN_PUBLIC ObjectPolygonDisplayBase
m_marker_common.addMessage(markers_ptr);
}

void deleteMarker(rviz_default_plugins::displays::MarkerID marker_id)
{
m_marker_common.deleteMarker(marker_id);
}

protected:
/// \brief Convert given shape msg into a Marker
/// \tparam ClassificationContainerT List type with ObjectClassificationMsg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <condition_variable>
#include <list>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
Expand Down Expand Up @@ -112,6 +113,7 @@ class AUTOWARE_AUTO_PERCEPTION_RVIZ_PLUGIN_PUBLIC PredictedObjectsDisplay
std::mutex mutex;
std::condition_variable condition;
std::vector<visualization_msgs::msg::Marker::SharedPtr> markers;
std::set<rviz_default_plugins::displays::MarkerID> existing_marker_ids;
};

} // namespace object_detection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <object_detection/predicted_objects_display.hpp>

#include <memory>
#include <set>

namespace autoware
{
Expand Down Expand Up @@ -130,7 +131,7 @@ std::vector<visualization_msgs::msg::Marker::SharedPtr> PredictedObjectsDisplay:
auto acceleration_text_marker_ptr = acceleration_text_marker.value();
acceleration_text_marker_ptr->header = msg->header;
acceleration_text_marker_ptr->id = uuid_to_marker_id(object.object_id);
add_marker(acceleration_text_marker_ptr);
markers.push_back(acceleration_text_marker_ptr);
}

// Get marker for twist
Expand Down Expand Up @@ -195,11 +196,19 @@ void PredictedObjectsDisplay::update(float wall_dt, float ros_dt)
std::unique_lock<std::mutex> lock(mutex);

if (!markers.empty()) {
clear_markers();

std::set new_marker_ids = std::set<rviz_default_plugins::displays::MarkerID>();
for (const auto & marker : markers) {
rviz_default_plugins::displays::MarkerID marker_id =
rviz_default_plugins::displays::MarkerID(marker->ns, marker->id);
add_marker(marker);
new_marker_ids.insert(marker_id);
}
for (auto itr = existing_marker_ids.begin(); itr != existing_marker_ids.end(); itr++) {
if (new_marker_ids.find(*itr) == new_marker_ids.end()) {
deleteMarker(*itr);
}
}
existing_marker_ids = new_marker_ids;

markers.clear();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2023 Tier IV, Inc.
//
// 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 TIER4_AUTOWARE_UTILS__ROS__PARAMETER_HPP_
#define TIER4_AUTOWARE_UTILS__ROS__PARAMETER_HPP_

#include <rclcpp/rclcpp.hpp>

#include <string>

namespace tier4_autoware_utils
{
template <class T>
T getOrDeclareParameter(rclcpp::Node & node, const std::string & name)
{
if (node.has_parameter(name)) {
return node.get_parameter(name).get_value<T>();
}

return node.declare_parameter<T>(name);
}
} // namespace tier4_autoware_utils

#endif // TIER4_AUTOWARE_UTILS__ROS__PARAMETER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "tier4_autoware_utils/ros/marker_helper.hpp"
#include "tier4_autoware_utils/ros/msg_covariance.hpp"
#include "tier4_autoware_utils/ros/msg_operation.hpp"
#include "tier4_autoware_utils/ros/parameter.hpp"
#include "tier4_autoware_utils/ros/processing_time_publisher.hpp"
#include "tier4_autoware_utils/ros/self_pose_listener.hpp"
#include "tier4_autoware_utils/ros/transform_listener.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ void Lanelet2MapLoaderNode::on_map_projector_info(
const auto center_line_resolution = get_parameter("center_line_resolution").as_double();

// load map from file
const auto map =
load_map(lanelet2_filename, msg->type, msg->map_origin.latitude, msg->map_origin.longitude);
const auto map = load_map(
lanelet2_filename, msg->projector_type, msg->map_origin.latitude, msg->map_origin.longitude);
if (!map) {
return;
}
Expand Down
13 changes: 8 additions & 5 deletions map/map_projection_loader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ If you want to use MGRS, please specify the MGRS grid as well.

```yaml
# map_projector_info.yaml
type: "MGRS"
mgrs_grid: "54SUE"
projector_type: MGRS
vertical_datum: WGS84
mgrs_grid: 54SUE
```

### Using LocalCartesianUTM
Expand All @@ -44,10 +45,12 @@ If you want to use local cartesian UTM, please specify the map origin as well.

```yaml
# map_projector_info.yaml
type: "LocalCartesianUTM"
projector_type: LocalCartesianUTM
vertical_datum: WGS84
map_origin:
latitude: 35.6092
longitude: 139.7303
latitude: 35.6762 # [deg]
longitude: 139.6503 # [deg]
altitude: 0.0 # [m]
```

## Published Topics
Expand Down
9 changes: 7 additions & 2 deletions map/map_projection_loader/src/load_info_from_lanelet2_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ tier4_map_msgs::msg::MapProjectorInfo load_info_from_lanelet2_map(const std::str

tier4_map_msgs::msg::MapProjectorInfo msg;
if (is_local) {
msg.type = "local";
msg.projector_type = "local";
} else {
msg.type = "MGRS";
msg.projector_type = "MGRS";
msg.mgrs_grid = projector.getProjectedMGRSGrid();
}

// We assume that the vertical datum of the map is WGS84 when using lanelet2 map.
// However, do note that this is not always true, and may cause problems in the future.
// Thus, please consider using the map_projector_info.yaml instead of this deprecated function.
msg.vertical_datum = "WGS84";
return msg;
}
10 changes: 6 additions & 4 deletions map/map_projection_loader/src/map_projection_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ tier4_map_msgs::msg::MapProjectorInfo load_info_from_yaml(const std::string & fi
YAML::Node data = YAML::LoadFile(filename);

tier4_map_msgs::msg::MapProjectorInfo msg;
msg.type = data["type"].as<std::string>();
if (msg.type == "MGRS") {
msg.projector_type = data["projector_type"].as<std::string>();
if (msg.projector_type == "MGRS") {
msg.vertical_datum = data["vertical_datum"].as<std::string>();
msg.mgrs_grid = data["mgrs_grid"].as<std::string>();
} else if (msg.type == "LocalCartesianUTM") {
} else if (msg.projector_type == "LocalCartesianUTM") {
msg.vertical_datum = data["vertical_datum"].as<std::string>();
msg.map_origin.latitude = data["map_origin"]["latitude"].as<double>();
msg.map_origin.longitude = data["map_origin"]["longitude"].as<double>();
} else if (msg.type == "local") {
} else if (msg.projector_type == "local") {
; // do nothing
} else {
throw std::runtime_error(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
projector_type: local
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
projector_type: LocalCartesianUTM
vertical_datum: WGS84
map_origin:
latitude: 35.6762 # [deg]
longitude: 139.6503 # [deg]
altitude: 0.0 # [m]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
projector_type: MGRS
vertical_datum: WGS84
mgrs_grid: 54SUE

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions map/map_projection_loader/test/data/projection_info_mgrs.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ TEST(TestLoadFromLanelet2Map, LoadMGRSGrid)
const auto projector_info = load_info_from_lanelet2_map(output_path);

// Check the result
EXPECT_EQ(projector_info.type, "MGRS");
EXPECT_EQ(projector_info.projector_type, "MGRS");
EXPECT_EQ(projector_info.mgrs_grid, mgrs_grid);
}

Expand All @@ -109,7 +109,7 @@ TEST(TestLoadFromLanelet2Map, LoadLocalGrid)
const auto projector_info = load_info_from_lanelet2_map(output_path);

// Check the result
EXPECT_EQ(projector_info.type, "local");
EXPECT_EQ(projector_info.projector_type, "local");
}

TEST(TestLoadFromLanelet2Map, LoadNoLocalGrid)
Expand All @@ -122,7 +122,7 @@ TEST(TestLoadFromLanelet2Map, LoadNoLocalGrid)
const auto projector_info = load_info_from_lanelet2_map(output_path);

// Check the result
EXPECT_EQ(projector_info.type, "MGRS");
EXPECT_EQ(projector_info.projector_type, "MGRS");
}

int main(int argc, char ** argv)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@

logger = get_logger(__name__)

YAML_FILE_PATH = "test/data/projection_info_local_cartesian_utm.yaml"
YAML_FILE_PATH = "test/data/map_projector_info_local_cartesian_utm.yaml"


@pytest.mark.launch_test
def generate_test_description():
map_projection_info_path = os.path.join(
map_projector_info_path = os.path.join(
get_package_share_directory("map_projection_loader"), YAML_FILE_PATH
)

Expand All @@ -48,7 +48,7 @@ def generate_test_description():
output="screen",
parameters=[
{
"map_projector_info_path": map_projection_info_path,
"map_projector_info_path": map_projector_info_path,
"lanelet2_map_path": "",
"use_local_projector": False,
},
Expand Down Expand Up @@ -121,17 +121,18 @@ def test_node_link(self):
)

# Load the yaml file directly
map_projection_info_path = os.path.join(
map_projector_info_path = os.path.join(
get_package_share_directory("map_projection_loader"), YAML_FILE_PATH
)
with open(map_projection_info_path) as f:
with open(map_projector_info_path) as f:
yaml_data = yaml.load(f, Loader=yaml.FullLoader)

# Test if message received
self.assertIsNotNone(
self.received_message, "No message received on map_projector_info topic"
)
self.assertEqual(self.received_message.type, yaml_data["type"])
self.assertEqual(self.received_message.projector_type, yaml_data["projector_type"])
self.assertEqual(self.received_message.vertical_datum, yaml_data["vertical_datum"])
self.assertEqual(
self.received_message.map_origin.latitude, yaml_data["map_origin"]["latitude"]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@

logger = get_logger(__name__)

YAML_FILE_PATH = "test/data/projection_info_local.yaml"
YAML_FILE_PATH = "test/data/map_projector_info_local.yaml"


@pytest.mark.launch_test
def generate_test_description():
map_projection_info_path = os.path.join(
map_projector_info_path = os.path.join(
get_package_share_directory("map_projection_loader"), YAML_FILE_PATH
)

Expand All @@ -48,7 +48,7 @@ def generate_test_description():
output="screen",
parameters=[
{
"map_projector_info_path": map_projection_info_path,
"map_projector_info_path": map_projector_info_path,
"lanelet2_map_path": "",
"use_local_projector": False,
},
Expand Down Expand Up @@ -121,17 +121,17 @@ def test_node_link(self):
)

# Load the yaml file directly
map_projection_info_path = os.path.join(
map_projector_info_path = os.path.join(
get_package_share_directory("map_projection_loader"), YAML_FILE_PATH
)
with open(map_projection_info_path) as f:
with open(map_projector_info_path) as f:
yaml_data = yaml.load(f, Loader=yaml.FullLoader)

# Test if message received
self.assertIsNotNone(
self.received_message, "No message received on map_projector_info topic"
)
self.assertEqual(self.received_message.type, yaml_data["type"])
self.assertEqual(self.received_message.projector_type, yaml_data["projector_type"])

self.test_node.destroy_subscription(subscription)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@

logger = get_logger(__name__)

YAML_FILE_PATH = "test/data/projection_info_mgrs.yaml"
YAML_FILE_PATH = "test/data/map_projector_info_mgrs.yaml"


@pytest.mark.launch_test
def generate_test_description():
map_projection_info_path = os.path.join(
map_projector_info_path = os.path.join(
get_package_share_directory("map_projection_loader"), YAML_FILE_PATH
)

Expand All @@ -48,7 +48,7 @@ def generate_test_description():
output="screen",
parameters=[
{
"map_projector_info_path": map_projection_info_path,
"map_projector_info_path": map_projector_info_path,
"lanelet2_map_path": "",
"use_local_projector": False,
},
Expand Down Expand Up @@ -121,17 +121,18 @@ def test_node_link(self):
)

# Load the yaml file directly
map_projection_info_path = os.path.join(
map_projector_info_path = os.path.join(
get_package_share_directory("map_projection_loader"), YAML_FILE_PATH
)
with open(map_projection_info_path) as f:
with open(map_projector_info_path) as f:
yaml_data = yaml.load(f, Loader=yaml.FullLoader)

# Test if message received
self.assertIsNotNone(
self.received_message, "No message received on map_projector_info topic"
)
self.assertEqual(self.received_message.type, yaml_data["type"])
self.assertEqual(self.received_message.projector_type, yaml_data["projector_type"])
self.assertEqual(self.received_message.vertical_datum, yaml_data["vertical_datum"])
self.assertEqual(self.received_message.mgrs_grid, yaml_data["mgrs_grid"])

self.test_node.destroy_subscription(subscription)
Expand Down
Loading
Loading