Added support for lane mark info on waypoint core
This commit is contained in:
parent
bad34f5fed
commit
a5f7261f27
|
@ -76,6 +76,14 @@ namespace client {
|
|||
static_cast<typename std::underlying_type<EnumT>::type>(rhs));
|
||||
}
|
||||
|
||||
const road::element::WaypointInfoRoadMark Waypoint::GetRightRoadMark() const {
|
||||
return road::element::WaypointInfoRoadMark(*_mark_record.first);
|
||||
}
|
||||
|
||||
const road::element::WaypointInfoRoadMark Waypoint::GetLeftRoadMark() const {
|
||||
return road::element::WaypointInfoRoadMark(*_mark_record.second);
|
||||
}
|
||||
|
||||
Waypoint::LaneChange Waypoint::GetLaneChange() const {
|
||||
const auto lane_change_right = _mark_record.first->GetLaneChange();
|
||||
const auto lane_change_left = _mark_record.second->GetLaneChange();
|
||||
|
|
|
@ -6,11 +6,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "carla/geom/Transform.h"
|
||||
#include "carla/Memory.h"
|
||||
#include "carla/NonCopyable.h"
|
||||
#include "carla/geom/Transform.h"
|
||||
#include "carla/road/element/RoadInfoMarkRecord.h"
|
||||
#include "carla/road/element/Waypoint.h"
|
||||
#include "carla/road/element/WaypointInformationTypes.h"
|
||||
#include "carla/road/Lane.h"
|
||||
|
||||
namespace carla {
|
||||
|
@ -73,6 +74,10 @@ namespace client {
|
|||
|
||||
SharedPtr<Waypoint> Left() const;
|
||||
|
||||
const road::element::WaypointInfoRoadMark GetRightRoadMark() const;
|
||||
|
||||
const road::element::WaypointInfoRoadMark GetLeftRoadMark() const;
|
||||
|
||||
Waypoint::LaneChange GetLaneChange() const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -13,7 +13,15 @@ namespace element {
|
|||
enum class LaneMarking {
|
||||
Other,
|
||||
Broken,
|
||||
Solid
|
||||
Solid,
|
||||
SolidSolid, // (for double solid line)
|
||||
SolidBroken, // (from inside to outside, exception: center lane -from left to right)
|
||||
BrokenSolid, // (from inside to outside, exception: center lane -from left to right)
|
||||
BrokenBroken, // (from inside to outside, exception: center lane -from left to right)
|
||||
BottsDots,
|
||||
Grass, // (meaning a grass edge)
|
||||
Curb,
|
||||
None
|
||||
};
|
||||
|
||||
} // namespace element
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#include "carla/road/element/WaypointInformationTypes.h"
|
||||
#include "carla/road/element/RoadInfoMarkRecord.h"
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
namespace element {
|
||||
|
||||
WaypointInfoRoadMark::WaypointInfoRoadMark(const RoadInfoMarkRecord &info) {
|
||||
const auto &t = info.GetType();
|
||||
const auto &c = info.GetColor();
|
||||
const auto &lc = info.GetLaneChange();
|
||||
|
||||
if (t == "broken") {
|
||||
type = LaneMarking::Broken;
|
||||
} else if (t == "solid") {
|
||||
type = LaneMarking::Solid;
|
||||
} else if (t == "solid solid") {
|
||||
type = LaneMarking::SolidSolid;
|
||||
} else if (t == "solid broken") {
|
||||
type = LaneMarking::SolidBroken;
|
||||
} else if (t == "broken solid") {
|
||||
type = LaneMarking::BrokenSolid;
|
||||
} else if (t == "broken broken") {
|
||||
type = LaneMarking::BrokenBroken;
|
||||
} else if (t == "botts dots") {
|
||||
type = LaneMarking::BottsDots;
|
||||
} else if (t == "grass") {
|
||||
type = LaneMarking::Grass;
|
||||
} else if (t == "curb") {
|
||||
type = LaneMarking::Curb;
|
||||
} else if (t == "none") {
|
||||
type = LaneMarking::None;
|
||||
} else {
|
||||
type = LaneMarking::Other;
|
||||
}
|
||||
|
||||
if (c == "standard") {
|
||||
color = WaypointInfoRoadMark::Color::Standard;
|
||||
} else if (c == "blue") {
|
||||
color = WaypointInfoRoadMark::Color::Blue;
|
||||
} else if (c == "green") {
|
||||
color = WaypointInfoRoadMark::Color::Green;
|
||||
} else if (c == "red") {
|
||||
color = WaypointInfoRoadMark::Color::Red;
|
||||
} else if (c == "white") {
|
||||
color = WaypointInfoRoadMark::Color::White;
|
||||
} else if (c == "yellow") {
|
||||
color = WaypointInfoRoadMark::Color::Yellow;
|
||||
} else {
|
||||
color = WaypointInfoRoadMark::Color::Other;
|
||||
}
|
||||
|
||||
if (lc == RoadInfoMarkRecord::LaneChange::Increase) {
|
||||
lane_change = WaypointInfoRoadMark::LaneChange::Increase;
|
||||
} else if (lc == RoadInfoMarkRecord::LaneChange::Decrease) {
|
||||
lane_change = WaypointInfoRoadMark::LaneChange::Decrease;
|
||||
} else if (lc == RoadInfoMarkRecord::LaneChange::Both) {
|
||||
lane_change = WaypointInfoRoadMark::LaneChange::Both;
|
||||
} else if (lc == RoadInfoMarkRecord::LaneChange::None) {
|
||||
lane_change = WaypointInfoRoadMark::LaneChange::None;
|
||||
}
|
||||
|
||||
width = info.GetWidth();
|
||||
}
|
||||
|
||||
} // namespace element
|
||||
} // namespace road
|
||||
} // namespace carla
|
|
@ -0,0 +1,48 @@
|
|||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "carla/road/element/LaneMarking.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
namespace element {
|
||||
|
||||
class RoadInfoMarkRecord;
|
||||
|
||||
struct WaypointInfoRoadMark {
|
||||
|
||||
// WaypointInfoRoadMark() {}
|
||||
|
||||
WaypointInfoRoadMark(const RoadInfoMarkRecord &info);
|
||||
|
||||
LaneMarking type = LaneMarking::None;
|
||||
|
||||
enum class Color : uint8_t {
|
||||
Standard, // (equivalent to "white")
|
||||
Blue,
|
||||
Green,
|
||||
Red,
|
||||
White = Standard,
|
||||
Yellow,
|
||||
Other
|
||||
} color = Color::Standard;
|
||||
|
||||
enum class LaneChange : uint8_t {
|
||||
Increase,
|
||||
Decrease,
|
||||
Both,
|
||||
None
|
||||
} lane_change = LaneChange::None;
|
||||
|
||||
float width = 0.0f;
|
||||
};
|
||||
|
||||
} // namespace element
|
||||
} // namespace road
|
||||
} // namespace carla
|
|
@ -130,13 +130,13 @@ def main():
|
|||
# check for available right driving lanes
|
||||
if current_w.lane_change & carla.LaneChange.Right:
|
||||
right_w = current_w.get_right_lane()
|
||||
if right_w and right_w.lane_type == 'driving':
|
||||
if right_w and right_w.lane_type == carla.LaneType.Driving:
|
||||
potential_w += list(right_w.next(waypoint_separation))
|
||||
|
||||
# check for available left driving lanes
|
||||
if current_w.lane_change & carla.LaneChange.Left:
|
||||
left_w = current_w.get_left_lane()
|
||||
if left_w and left_w.lane_type == 'driving':
|
||||
if left_w and left_w.lane_type == carla.LaneType.Driving:
|
||||
potential_w += list(left_w.next(waypoint_separation))
|
||||
|
||||
# choose a random waypoint to be the next
|
||||
|
|
Loading…
Reference in New Issue