Skip to content
Snippets Groups Projects
Commit ce940369 authored by Xiao Pan's avatar Xiao Pan
Browse files

Add PerformLaneChangeControlStrategy

parent 019aef26
No related branches found
No related tags found
1 merge request!42Add PerformLaneChangeControlStrategy
......@@ -68,8 +68,16 @@ public:
///@param lateral_offset Lateral offset to the target lane
///@return Pose that is at the given distance from reference_pose_on_lane in a relative lane. The new orientation is parallel to the lane orientation at the target position.
virtual std::optional<Pose> FindRelativeLanePoseAtDistanceFrom(const Pose& reference_pose_on_lane, int relative_target_lane, units::length::meter_t distance, units::length::meter_t lateral_offset) const = 0;
/// @brief Calculate the lane id of the relative target lane from a given position
///
///@param reference_pose_on_lane Starting position. Must be on a lane.
///@param relative_target_lane Shift of the target position in number of lanes relative to the lane where the reference pose is located. Positive to the left, negative to the right.
///@return Lane id that is at the given lateral shift (relative_lane_target) from given position (reference_pose_on_lane).
/// No value, if reference pose is not on a lane or if the lane doesn't have a suitable adjacent lane
virtual std::optional<mantle_api::UniqueId> GetRelativeLaneId(const mantle_api::Pose& reference_pose_on_lane, int relative_lane_target) const = 0;
};
} // namespace mantle_api
#endif // MANTLEAPI_MAP_ILANELOCATIONQUERYSERVICE_H
\ No newline at end of file
#endif // MANTLEAPI_MAP_ILANELOCATIONQUERYSERVICE_H
......@@ -15,6 +15,7 @@
#ifndef MANTLEAPI_TRAFFIC_CONTROLSTRATEGY_H
#define MANTLEAPI_TRAFFIC_CONTROLSTRATEGY_H
#include <MantleAPI/Common/i_identifiable.h>
#include <MantleAPI/Common/spline.h>
#include <MantleAPI/Common/trajectory.h>
#include <MantleAPI/Common/vector.h>
......@@ -44,7 +45,8 @@ enum class ControlStrategyType
kFollowRoute,
kAcquireLaneOffset,
kFollowTrajectory,
kUpdateTrafficLightStates
kUpdateTrafficLightStates,
kPerformLaneChange
};
struct ControlStrategy
......@@ -222,6 +224,19 @@ struct FollowTrajectoryControlStrategy : public ControlStrategy
std::optional<TrajectoryTimeReference> timeReference;
};
struct PerformLaneChangeControlStrategy : public ControlStrategy
{
PerformLaneChangeControlStrategy()
{
movement_domain = MovementDomain::kLateral;
type = ControlStrategyType::kPerformLaneChange;
}
mantle_api::UniqueId target_lane_id{0};
units::length::meter_t target_lane_offset{0.0};
TransitionDynamics transition_dynamics{};
};
} // namespace mantle_api
#endif // MANTLEAPI_TRAFFIC_CONTROLSTRATEGY_H
......@@ -151,6 +151,13 @@ public:
return pose;
}
std::optional<UniqueId> GetRelativeLaneId(const mantle_api::Pose& reference_pose_on_lane, int relative_lane_target) const override
{
std::ignore = reference_pose_on_lane;
std::ignore = relative_lane_target;
return {};
}
private:
MockVehicle test_vehicle_{};
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment