Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
helper_functions.hpp
Go to the documentation of this file.
1#pragma once
2/*
3 * Copyright (C) 2021-2022 LEIDOS.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
18
19namespace basic_autonomy
20{
21namespace waypoint_generation
22{
23 //Small value corresponding to 0.1 mm in meters for comparing distance to a near zero.
24 const double epsilon_ = 0.0000001;
33 int get_nearest_point_index(const std::vector<lanelet::BasicPoint2d>& points,
34 const carma_planning_msgs::msg::VehicleState& state);
35
44 int get_nearest_point_index(const std::vector<PointSpeedPair>& points,
45 const carma_planning_msgs::msg::VehicleState& state);
46
58 int get_nearest_index_by_downtrack(const std::vector<lanelet::BasicPoint2d>& points, const carma_wm::WorldModelConstPtr& wm, double target_downtrack);
59
66 void split_point_speed_pairs(const std::vector<PointSpeedPair>& points,
67 std::vector<lanelet::BasicPoint2d>* basic_points,
68 std::vector<double>* speeds);
69
82 int get_nearest_index_by_downtrack(const std::vector<PointSpeedPair>& points, const carma_wm::WorldModelConstPtr& wm,
83 const carma_planning_msgs::msg::VehicleState& state);
84
97 int get_nearest_index_by_downtrack(const std::vector<lanelet::BasicPoint2d>& points, const carma_wm::WorldModelConstPtr& wm,
98 const carma_planning_msgs::msg::VehicleState& state);
99
100}
101}
void split_point_speed_pairs(const std::vector< PointSpeedPair > &points, std::vector< lanelet::BasicPoint2d > *basic_points, std::vector< double > *speeds)
Helper method to split a list of PointSpeedPair into separate point and speed lists.
int get_nearest_point_index(const std::vector< lanelet::BasicPoint2d > &points, const carma_planning_msgs::msg::VehicleState &state)
Returns the nearest point (in terms of cartesian 2d distance) to the provided vehicle pose in the pro...
int get_nearest_index_by_downtrack(const std::vector< lanelet::BasicPoint2d > &points, const carma_wm::WorldModelConstPtr &wm, double target_downtrack)
Returns the nearest "less than" point to the provided vehicle pose in the provided list by utilizing ...
std::shared_ptr< const WorldModel > WorldModelConstPtr
Definition: WorldModel.hpp:452