Convert floats to doubles and uncrustify
This commit is contained in:
parent
f139babcbc
commit
db29652124
|
@ -19,208 +19,243 @@ namespace parser {
|
|||
using DependencyID = std::string;
|
||||
using SignalReferenceID = std::string;
|
||||
|
||||
template <typename T>
|
||||
static void AddValidity(pugi::xml_node parent_node, const std::string &node_name,
|
||||
const ObjectID &objectID, T &&function);
|
||||
|
||||
template <typename T>
|
||||
static void AddValidity(pugi::xml_node parent_node, const std::string &node_name,
|
||||
const ObjectID &objectID, T &&function){
|
||||
for (pugi::xml_node validity_node = parent_node.child(node_name.c_str());
|
||||
validity_node;
|
||||
validity_node = validity_node.next_sibling("validity")) {
|
||||
const int from_lane = validity_node.attribute("fromLane").as_int();
|
||||
const int to_lane = validity_node.attribute("toLane").as_int();
|
||||
log_debug("Added validity to signal ", objectID, ":", from_lane, to_lane);
|
||||
function(objectID, from_lane, to_lane);
|
||||
}
|
||||
static void AddValidity(
|
||||
pugi::xml_node parent_node,
|
||||
const std::string &node_name,
|
||||
const ObjectID &objectID,
|
||||
T &&function) {
|
||||
for (pugi::xml_node validity_node = parent_node.child(node_name.c_str());
|
||||
validity_node;
|
||||
validity_node = validity_node.next_sibling("validity")) {
|
||||
const int from_lane = validity_node.attribute("fromLane").as_int();
|
||||
const int to_lane = validity_node.attribute("toLane").as_int();
|
||||
log_debug("Added validity to signal ", objectID, ":", from_lane, to_lane);
|
||||
function(objectID, from_lane, to_lane);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectParser::Parse(
|
||||
const pugi::xml_document & xml,
|
||||
carla::road::MapBuilder & /* map_builder */ ) {
|
||||
/// @todo: uncomment this return
|
||||
return;
|
||||
//Extracting the OpenDRIVE
|
||||
pugi::xml_node opendrive_node = xml.child("OpenDRIVE");
|
||||
for (pugi::xml_node road_node = opendrive_node.child("road");
|
||||
road_node;
|
||||
road_node = road_node.next_sibling("road")) {
|
||||
const RoadID road_id = (RoadID) road_node.attribute("id").value();
|
||||
const pugi::xml_node objects_node = road_node.child("objects");
|
||||
for (pugi::xml_node object_node = objects_node.child("object");
|
||||
object_node;
|
||||
object_node = object_node.next_sibling("object")) {
|
||||
const std::string type = object_node.attribute("type").value();
|
||||
const std::string name = object_node.attribute("name").value();
|
||||
const ObjectID object_id = object_node.attribute("id").value();
|
||||
const double s_position = object_node.attribute("s").as_double();
|
||||
const double t_position = object_node.attribute("t").as_double();
|
||||
const double z_offset = object_node.attribute("zOffset").as_double();
|
||||
const double valid_length = object_node.attribute("validLength").as_double();
|
||||
const std::string orientation = object_node.attribute("orientation").value();
|
||||
const double lenght = object_node.attribute("lenght").as_double();
|
||||
const double width = object_node.attribute("width").as_double();
|
||||
const double radius = object_node.attribute("radius").as_double();
|
||||
const double height = object_node.attribute("height").as_double();
|
||||
const double hdg = object_node.attribute("hdg").as_double();
|
||||
const double pitch = object_node.attribute("pitch").as_double();
|
||||
const double roll = object_node.attribute("roll").as_double();
|
||||
/*map_builder.AddObjectInRoad(road_id, type, name, object_id, s_position, t_position, z_offset, valid_length,
|
||||
orientation, lenght, width, radius, height, hdg, pitch, roll);*/
|
||||
log_debug("AddObjectInRoad", road_id, type, name, object_id, s_position, t_position, z_offset, valid_length,
|
||||
orientation, lenght, width, radius, height, hdg, pitch, roll);
|
||||
for (pugi::xml_node repeat_node = object_node.child("repeat");
|
||||
repeat_node;
|
||||
repeat_node = repeat_node.next_sibling("repeat")) {
|
||||
const double s_position_rep = repeat_node.attribute("s").as_double();
|
||||
const double lenght_rep = repeat_node.attribute("lenght").as_double();
|
||||
const double distance_rep = repeat_node.attribute("distance").as_double();
|
||||
const double t_start_rep = repeat_node.attribute("tStart").as_double();
|
||||
const double t_end_rep = repeat_node.attribute("tEnd").as_double();
|
||||
const double width_start_rep = repeat_node.attribute("widthStart").as_double();
|
||||
const double width_end_rep = repeat_node.attribute("widthEnd").as_double();
|
||||
const double height_start_rep = repeat_node.attribute("heightStart").as_double();
|
||||
const double z_offset_start_rep = repeat_node.attribute("zOffsetStart").as_double();
|
||||
const double z_offset_end_rep = repeat_node.attribute("zOffsetEnd").as_double();
|
||||
/*map_builder.AddRepeatRecordInObject(object_id, s_position_rep, lenght_rep, t_start_rep,
|
||||
t_start_rep, t_end_rep, width_start_rep, width_end_rep, height_start_rep, z_offset_start_rep,
|
||||
z_offset_end_rep);
|
||||
*/
|
||||
log_debug("AddRepeatRecordInObject", object_id, s_position_rep, lenght_rep, distance_rep,
|
||||
t_start_rep, t_end_rep, width_start_rep, width_end_rep, height_start_rep, z_offset_start_rep,
|
||||
z_offset_end_rep);
|
||||
const pugi::xml_document &xml,
|
||||
carla::road::MapBuilder & /* map_builder */) {
|
||||
/// @todo: uncomment this return
|
||||
return;
|
||||
// Extracting the OpenDRIVE
|
||||
pugi::xml_node opendrive_node = xml.child("OpenDRIVE");
|
||||
for (pugi::xml_node road_node = opendrive_node.child("road");
|
||||
road_node;
|
||||
road_node = road_node.next_sibling("road")) {
|
||||
const RoadID road_id = (RoadID) road_node.attribute("id").value();
|
||||
const pugi::xml_node objects_node = road_node.child("objects");
|
||||
for (pugi::xml_node object_node = objects_node.child("object");
|
||||
object_node;
|
||||
object_node = object_node.next_sibling("object")) {
|
||||
const std::string type = object_node.attribute("type").value();
|
||||
const std::string name = object_node.attribute("name").value();
|
||||
const ObjectID object_id = object_node.attribute("id").value();
|
||||
const double s_position = object_node.attribute("s").as_double();
|
||||
const double t_position = object_node.attribute("t").as_double();
|
||||
const double z_offset = object_node.attribute("zOffset").as_double();
|
||||
const double valid_length = object_node.attribute("validLength").as_double();
|
||||
const std::string orientation = object_node.attribute("orientation").value();
|
||||
const double lenght = object_node.attribute("lenght").as_double();
|
||||
const double width = object_node.attribute("width").as_double();
|
||||
const double radius = object_node.attribute("radius").as_double();
|
||||
const double height = object_node.attribute("height").as_double();
|
||||
const double hdg = object_node.attribute("hdg").as_double();
|
||||
const double pitch = object_node.attribute("pitch").as_double();
|
||||
const double roll = object_node.attribute("roll").as_double();
|
||||
/*map_builder.AddObjectInRoad(road_id, type, name, object_id,
|
||||
s_position, t_position, z_offset, valid_length,
|
||||
orientation, lenght, width, radius, height, hdg, pitch, roll);*/
|
||||
log_debug("AddObjectInRoad",
|
||||
road_id,
|
||||
type,
|
||||
name,
|
||||
object_id,
|
||||
s_position,
|
||||
t_position,
|
||||
z_offset,
|
||||
valid_length,
|
||||
orientation,
|
||||
lenght,
|
||||
width,
|
||||
radius,
|
||||
height,
|
||||
hdg,
|
||||
pitch,
|
||||
roll);
|
||||
for (pugi::xml_node repeat_node = object_node.child("repeat");
|
||||
repeat_node;
|
||||
repeat_node = repeat_node.next_sibling("repeat")) {
|
||||
const double s_position_rep = repeat_node.attribute("s").as_double();
|
||||
const double lenght_rep = repeat_node.attribute("lenght").as_double();
|
||||
const double distance_rep = repeat_node.attribute("distance").as_double();
|
||||
const double t_start_rep = repeat_node.attribute("tStart").as_double();
|
||||
const double t_end_rep = repeat_node.attribute("tEnd").as_double();
|
||||
const double width_start_rep = repeat_node.attribute("widthStart").as_double();
|
||||
const double width_end_rep = repeat_node.attribute("widthEnd").as_double();
|
||||
const double height_start_rep = repeat_node.attribute("heightStart").as_double();
|
||||
const double z_offset_start_rep = repeat_node.attribute("zOffsetStart").as_double();
|
||||
const double z_offset_end_rep = repeat_node.attribute("zOffsetEnd").as_double();
|
||||
/*map_builder.AddRepeatRecordInObject(object_id, s_position_rep,
|
||||
lenght_rep, t_start_rep,
|
||||
t_start_rep, t_end_rep, width_start_rep, width_end_rep,
|
||||
height_start_rep, z_offset_start_rep,
|
||||
z_offset_end_rep);
|
||||
*/
|
||||
log_debug("AddRepeatRecordInObject", object_id, s_position_rep, lenght_rep, distance_rep,
|
||||
t_start_rep, t_end_rep, width_start_rep, width_end_rep, height_start_rep, z_offset_start_rep,
|
||||
z_offset_end_rep);
|
||||
|
||||
}
|
||||
pugi::xml_node outline_node = object_node.child("outline");
|
||||
for (pugi::xml_node corner_road_node = outline_node.child("cornerRoad");
|
||||
corner_road_node;
|
||||
corner_road_node = corner_road_node.next_sibling("cornerRoad")) {
|
||||
const double s_position_corner_road = corner_road_node.attribute("s").as_double();
|
||||
const double t_position_corner_road = corner_road_node.attribute("t").as_double();
|
||||
const double dz_position_corner_road = corner_road_node.attribute("dz").as_double();
|
||||
const double height_position_corner_road = corner_road_node.attribute("height").as_double();
|
||||
/*
|
||||
map_builder.AddCornerRoadToObject(object_id, s_position_corner_road, t_position_corner_road,
|
||||
dz_position_corner_road, height_position_corner_road);
|
||||
*/
|
||||
log_debug("AddCornerRoadToObject", object_id, s_position_corner_road, t_position_corner_road,
|
||||
dz_position_corner_road, height_position_corner_road);
|
||||
}
|
||||
for (pugi::xml_node corner_local_node = outline_node.child("cornerLocal");
|
||||
corner_local_node;
|
||||
corner_local_node = corner_local_node.next_sibling("cornerLocal")) {
|
||||
const double u_coordinate_corner_local = corner_local_node.attribute("u").as_double();
|
||||
const double v_coordinate_corner_local = corner_local_node.attribute("v").as_double();
|
||||
const double z_coordinate_corner_local = corner_local_node.attribute("z").as_double();
|
||||
const double height_corner_local = corner_local_node.attribute("height").as_double();
|
||||
/*
|
||||
map_builder.AddCornerLocalToObject(object_id, u_coordinate_corner_local, v_coordinate_corner_local,
|
||||
z_coordinate_corner_local, height_corner_local);
|
||||
*/
|
||||
log_debug("AddCornerLocalToObject", object_id, u_coordinate_corner_local, v_coordinate_corner_local,
|
||||
z_coordinate_corner_local, height_corner_local);
|
||||
}
|
||||
pugi::xml_node material_node = object_node.child("material");
|
||||
if(material_node != nullptr) {
|
||||
const std::string surface_material = material_node.attribute("surface").value();
|
||||
const double friction_material = material_node.attribute("friction").as_double();
|
||||
const double roughness_material = material_node.attribute("roughness").as_double();
|
||||
/*
|
||||
map_builder.AddMaterialToObject(object_id, surface_material, friction_material, roughness_material);
|
||||
*/
|
||||
log_debug("AddMaterialToObject",object_id, surface_material, friction_material, roughness_material);
|
||||
}
|
||||
}
|
||||
pugi::xml_node outline_node = object_node.child("outline");
|
||||
for (pugi::xml_node corner_road_node = outline_node.child("cornerRoad");
|
||||
corner_road_node;
|
||||
corner_road_node = corner_road_node.next_sibling("cornerRoad")) {
|
||||
const double s_position_corner_road = corner_road_node.attribute("s").as_double();
|
||||
const double t_position_corner_road = corner_road_node.attribute("t").as_double();
|
||||
const double dz_position_corner_road = corner_road_node.attribute("dz").as_double();
|
||||
const double height_position_corner_road = corner_road_node.attribute("height").as_double();
|
||||
/*
|
||||
map_builder.AddCornerRoadToObject(object_id,
|
||||
s_position_corner_road, t_position_corner_road,
|
||||
dz_position_corner_road, height_position_corner_road);
|
||||
*/
|
||||
log_debug("AddCornerRoadToObject", object_id, s_position_corner_road, t_position_corner_road,
|
||||
dz_position_corner_road, height_position_corner_road);
|
||||
}
|
||||
for (pugi::xml_node corner_local_node = outline_node.child("cornerLocal");
|
||||
corner_local_node;
|
||||
corner_local_node = corner_local_node.next_sibling("cornerLocal")) {
|
||||
const double u_coordinate_corner_local = corner_local_node.attribute("u").as_double();
|
||||
const double v_coordinate_corner_local = corner_local_node.attribute("v").as_double();
|
||||
const double z_coordinate_corner_local = corner_local_node.attribute("z").as_double();
|
||||
const double height_corner_local = corner_local_node.attribute("height").as_double();
|
||||
/*
|
||||
map_builder.AddCornerLocalToObject(object_id,
|
||||
u_coordinate_corner_local, v_coordinate_corner_local,
|
||||
z_coordinate_corner_local, height_corner_local);
|
||||
*/
|
||||
log_debug("AddCornerLocalToObject", object_id, u_coordinate_corner_local, v_coordinate_corner_local,
|
||||
z_coordinate_corner_local, height_corner_local);
|
||||
}
|
||||
pugi::xml_node material_node = object_node.child("material");
|
||||
if (material_node != nullptr) {
|
||||
const std::string surface_material = material_node.attribute("surface").value();
|
||||
const double friction_material = material_node.attribute("friction").as_double();
|
||||
const double roughness_material = material_node.attribute("roughness").as_double();
|
||||
/*
|
||||
map_builder.AddMaterialToObject(object_id, surface_material,
|
||||
friction_material, roughness_material);
|
||||
*/
|
||||
log_debug("AddMaterialToObject", object_id, surface_material, friction_material,
|
||||
roughness_material);
|
||||
}
|
||||
|
||||
/* AddValidity(object_node, "validity", object_id,
|
||||
([&map_builder](const ObjectID &object_id, const int16_t from_lane, const int16_t to_lane)
|
||||
{ map_builder.AddValidityToObject(object_id, from_lane, to_lane);})); */
|
||||
/* AddValidity(object_node, "validity", object_id,
|
||||
([&map_builder](const ObjectID &object_id, const int16_t from_lane,
|
||||
const int16_t to_lane)
|
||||
{ map_builder.AddValidityToObject(object_id, from_lane,
|
||||
to_lane);})); */
|
||||
|
||||
pugi::xml_node parking_space_node = object_node.child("parkingSpace");
|
||||
if(parking_space_node != nullptr) {
|
||||
const std::string access_parking = parking_space_node.attribute("access").value();
|
||||
const std::string restrictions_parking = parking_space_node.attribute("restrictions").value();
|
||||
/*
|
||||
map_builder.AddParkingSpaceToObject(object_id, access_parking, restrictions_parking);
|
||||
*/
|
||||
log_debug("AddParkingSpaceToObject",object_id, access_parking, restrictions_parking);
|
||||
}
|
||||
for (pugi::xml_node marking_node = parking_space_node.child("marking");
|
||||
marking_node;
|
||||
marking_node = marking_node.next_sibling("marking")) {
|
||||
const std::string side_marking = marking_node.attribute("side").value();
|
||||
const std::string type_marking = marking_node.attribute("type").value();
|
||||
const double width_marking = marking_node.attribute("width").as_double();
|
||||
const std::string color_marking = marking_node.attribute("color").value();
|
||||
/*
|
||||
Problem, there is no "Parking ID" or anything similar... how do we link them?
|
||||
map_builder.AddMarkingToParkingSpace(side_marking, type_marking,
|
||||
width_marking, color_marking);
|
||||
*/
|
||||
log_debug("AddMarkingToParkingSpace",side_marking, type_marking,
|
||||
width_marking, color_marking);
|
||||
}
|
||||
for (pugi::xml_node obj_reference_node = object_node.child("objectReference");
|
||||
obj_reference_node;
|
||||
obj_reference_node = obj_reference_node.next_sibling("objectReference")) {
|
||||
const double s_position_obj_ref = obj_reference_node.attribute("s").as_double();
|
||||
const double t_position_obj_ref = obj_reference_node.attribute("t").as_double();
|
||||
const ObjectID id_obj_ref = obj_reference_node.attribute("id").value();
|
||||
const double z_offset_obj_ref = obj_reference_node.attribute("zOffset").as_double();
|
||||
const double valid_lenght_obj_ref = obj_reference_node.attribute("validLenght").as_double();
|
||||
const std::string orientation_obj_ref = obj_reference_node.attribute("orientation").value();
|
||||
/*
|
||||
map_builder.AddObjectReferenceToObject(object_id, s_position_obj_ref, t_position_obj_ref,
|
||||
id_obj_ref, z_offset_obj_ref, valid_lenght_obj_ref, orientation_obj_ref);
|
||||
*/
|
||||
log_debug("AddObjectReferenceToObject",object_id, s_position_obj_ref, t_position_obj_ref,
|
||||
id_obj_ref, z_offset_obj_ref, valid_lenght_obj_ref, orientation_obj_ref);
|
||||
/* AddValidity(obj_reference_node, "validity", id_obj_ref,
|
||||
([&map_builder](const ObjectID &id_obj_ref, const int16_t from_lane, const int16_t to_lane)
|
||||
{ map_builder.AddValidityToObjectRef(id_obj_ref, from_lane, to_lane);})); */
|
||||
}
|
||||
pugi::xml_node parking_space_node = object_node.child("parkingSpace");
|
||||
if (parking_space_node != nullptr) {
|
||||
const std::string access_parking = parking_space_node.attribute("access").value();
|
||||
const std::string restrictions_parking = parking_space_node.attribute("restrictions").value();
|
||||
/*
|
||||
map_builder.AddParkingSpaceToObject(object_id, access_parking,
|
||||
restrictions_parking);
|
||||
*/
|
||||
log_debug("AddParkingSpaceToObject", object_id, access_parking, restrictions_parking);
|
||||
}
|
||||
for (pugi::xml_node marking_node = parking_space_node.child("marking");
|
||||
marking_node;
|
||||
marking_node = marking_node.next_sibling("marking")) {
|
||||
const std::string side_marking = marking_node.attribute("side").value();
|
||||
const std::string type_marking = marking_node.attribute("type").value();
|
||||
const double width_marking = marking_node.attribute("width").as_double();
|
||||
const std::string color_marking = marking_node.attribute("color").value();
|
||||
/*
|
||||
Problem, there is no "Parking ID" or anything similar... how do we
|
||||
link them?
|
||||
map_builder.AddMarkingToParkingSpace(side_marking, type_marking,
|
||||
width_marking, color_marking);
|
||||
*/
|
||||
log_debug("AddMarkingToParkingSpace", side_marking, type_marking,
|
||||
width_marking, color_marking);
|
||||
}
|
||||
for (pugi::xml_node obj_reference_node = object_node.child("objectReference");
|
||||
obj_reference_node;
|
||||
obj_reference_node = obj_reference_node.next_sibling("objectReference")) {
|
||||
const double s_position_obj_ref = obj_reference_node.attribute("s").as_double();
|
||||
const double t_position_obj_ref = obj_reference_node.attribute("t").as_double();
|
||||
const ObjectID id_obj_ref = obj_reference_node.attribute("id").value();
|
||||
const double z_offset_obj_ref = obj_reference_node.attribute("zOffset").as_double();
|
||||
const double valid_lenght_obj_ref = obj_reference_node.attribute("validLenght").as_double();
|
||||
const std::string orientation_obj_ref = obj_reference_node.attribute("orientation").value();
|
||||
/*
|
||||
map_builder.AddObjectReferenceToObject(object_id,
|
||||
s_position_obj_ref, t_position_obj_ref,
|
||||
id_obj_ref, z_offset_obj_ref, valid_lenght_obj_ref,
|
||||
orientation_obj_ref);
|
||||
*/
|
||||
log_debug("AddObjectReferenceToObject", object_id, s_position_obj_ref, t_position_obj_ref,
|
||||
id_obj_ref, z_offset_obj_ref, valid_lenght_obj_ref, orientation_obj_ref);
|
||||
/* AddValidity(obj_reference_node, "validity", id_obj_ref,
|
||||
([&map_builder](const ObjectID &id_obj_ref, const int16_t
|
||||
from_lane, const int16_t to_lane)
|
||||
{ map_builder.AddValidityToObjectRef(id_obj_ref, from_lane,
|
||||
to_lane);})); */
|
||||
}
|
||||
|
||||
}
|
||||
for (pugi::xml_node tunnel_node = objects_node.child("tunnel");
|
||||
tunnel_node;
|
||||
tunnel_node = tunnel_node.next_sibling("tunnel")) {
|
||||
const double s_position_tunnel = tunnel_node.attribute("s").as_double();
|
||||
const double lenght_tunnel = tunnel_node.attribute("lenght").as_double();
|
||||
const std::string name_tunnel = tunnel_node.attribute("name").value();
|
||||
const ObjectID id_tunnel = tunnel_node.attribute("id").value();
|
||||
const std::string type_tunnel = tunnel_node.attribute("type").value();
|
||||
const double lightning_tunnel = tunnel_node.attribute("lightning").as_double();
|
||||
const double daylight_tunnel = tunnel_node.attribute("daylight").as_double();
|
||||
/*
|
||||
map_builder.AddTunnel(s_position_tunnel, lenght_tunnel, name_tunnel, id_tunnel,
|
||||
type_tunnel, lightning_tunnel, daylight_tunnel);
|
||||
*/
|
||||
log_debug("AddTunnel", s_position_tunnel, lenght_tunnel, name_tunnel, id_tunnel,
|
||||
type_tunnel, lightning_tunnel, daylight_tunnel);
|
||||
/* AddValidity(tunnel_node, "validity", id_tunnel,
|
||||
([&map_builder](const ObjectID &id_tunnel, const int16_t from_lane, const int16_t to_lane)
|
||||
{ map_builder.AddValidityToTunnel(id_tunnel, from_lane, to_lane);})); */
|
||||
}
|
||||
for (pugi::xml_node bridge_node = objects_node.child("bridge");
|
||||
bridge_node;
|
||||
bridge_node = bridge_node.next_sibling("bridge")) {
|
||||
const double s_position_bridge = bridge_node.attribute("s").as_double();
|
||||
const double lenght_bridge = bridge_node.attribute("lenght").as_double();
|
||||
const std::string name_bridge = bridge_node.attribute("name").value();
|
||||
const ObjectID id_bridge = bridge_node.attribute("id").value();
|
||||
const std::string type_bridge = bridge_node.attribute("type").value();
|
||||
/*
|
||||
map_builder.AddBridge(s_position_bridge, lenght_bridge, name_bridge, id_bridge,
|
||||
type_bridge);
|
||||
*/
|
||||
log_debug("AddTunnel", s_position_bridge, lenght_bridge, name_bridge, id_bridge,
|
||||
type_bridge);
|
||||
/*AddValidity(bridge_node, "validity", id_bridge,
|
||||
([&map_builder](const ObjectID &id_bridge, const int16_t from_lane, const int16_t to_lane)
|
||||
{ map_builder.AddValidityToBridge(id_bridge, from_lane, to_lane);}));*/
|
||||
}
|
||||
}
|
||||
}
|
||||
for (pugi::xml_node tunnel_node = objects_node.child("tunnel");
|
||||
tunnel_node;
|
||||
tunnel_node = tunnel_node.next_sibling("tunnel")) {
|
||||
const double s_position_tunnel = tunnel_node.attribute("s").as_double();
|
||||
const double lenght_tunnel = tunnel_node.attribute("lenght").as_double();
|
||||
const std::string name_tunnel = tunnel_node.attribute("name").value();
|
||||
const ObjectID id_tunnel = tunnel_node.attribute("id").value();
|
||||
const std::string type_tunnel = tunnel_node.attribute("type").value();
|
||||
const double lightning_tunnel = tunnel_node.attribute("lightning").as_double();
|
||||
const double daylight_tunnel = tunnel_node.attribute("daylight").as_double();
|
||||
/*
|
||||
map_builder.AddTunnel(s_position_tunnel, lenght_tunnel, name_tunnel,
|
||||
id_tunnel,
|
||||
type_tunnel, lightning_tunnel, daylight_tunnel);
|
||||
*/
|
||||
log_debug("AddTunnel", s_position_tunnel, lenght_tunnel, name_tunnel, id_tunnel,
|
||||
type_tunnel, lightning_tunnel, daylight_tunnel);
|
||||
/* AddValidity(tunnel_node, "validity", id_tunnel,
|
||||
([&map_builder](const ObjectID &id_tunnel, const int16_t from_lane,
|
||||
const int16_t to_lane)
|
||||
{ map_builder.AddValidityToTunnel(id_tunnel, from_lane,
|
||||
to_lane);})); */
|
||||
}
|
||||
for (pugi::xml_node bridge_node = objects_node.child("bridge");
|
||||
bridge_node;
|
||||
bridge_node = bridge_node.next_sibling("bridge")) {
|
||||
const double s_position_bridge = bridge_node.attribute("s").as_double();
|
||||
const double lenght_bridge = bridge_node.attribute("lenght").as_double();
|
||||
const std::string name_bridge = bridge_node.attribute("name").value();
|
||||
const ObjectID id_bridge = bridge_node.attribute("id").value();
|
||||
const std::string type_bridge = bridge_node.attribute("type").value();
|
||||
/*
|
||||
map_builder.AddBridge(s_position_bridge, lenght_bridge, name_bridge,
|
||||
id_bridge,
|
||||
type_bridge);
|
||||
*/
|
||||
log_debug("AddTunnel", s_position_bridge, lenght_bridge, name_bridge, id_bridge,
|
||||
type_bridge);
|
||||
/*AddValidity(bridge_node, "validity", id_bridge,
|
||||
([&map_builder](const ObjectID &id_bridge, const int16_t from_lane,
|
||||
const int16_t to_lane)
|
||||
{ map_builder.AddValidityToBridge(id_bridge, from_lane,
|
||||
to_lane);}));*/
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace parser
|
||||
} // namespace opendrive
|
||||
} // namespace carla
|
||||
|
|
|
@ -15,12 +15,12 @@ namespace opendrive {
|
|||
namespace parser {
|
||||
|
||||
struct ElevationProfile {
|
||||
carla::road::Road* road { nullptr };
|
||||
float s { 0.0 };
|
||||
float a { 0.0 };
|
||||
float b { 0.0 };
|
||||
float c { 0.0 };
|
||||
float d { 0.0 };
|
||||
carla::road::Road *road { nullptr };
|
||||
double s { 0.0 };
|
||||
double a { 0.0 };
|
||||
double b { 0.0 };
|
||||
double c { 0.0 };
|
||||
double d { 0.0 };
|
||||
};
|
||||
|
||||
struct LateralCrossfall {
|
||||
|
@ -28,16 +28,16 @@ namespace parser {
|
|||
};
|
||||
|
||||
struct LateralShape {
|
||||
float t { 0.0 };
|
||||
double t { 0.0 };
|
||||
};
|
||||
|
||||
struct LateralProfile {
|
||||
carla::road::Road* road { nullptr };
|
||||
float s { 0.0 };
|
||||
float a { 0.0 };
|
||||
float b { 0.0 };
|
||||
float c { 0.0 };
|
||||
float d { 0.0 };
|
||||
carla::road::Road *road { nullptr };
|
||||
double s { 0.0 };
|
||||
double a { 0.0 };
|
||||
double b { 0.0 };
|
||||
double c { 0.0 };
|
||||
double d { 0.0 };
|
||||
std::string type { "superelevation" };
|
||||
LateralCrossfall cross;
|
||||
LateralShape shape;
|
||||
|
@ -47,78 +47,81 @@ namespace parser {
|
|||
const pugi::xml_document &xml,
|
||||
carla::road::MapBuilder &map_builder) {
|
||||
|
||||
std::vector<ElevationProfile> elevation_profile;
|
||||
std::vector<LateralProfile> lateral_profile;
|
||||
std::vector<ElevationProfile> elevation_profile;
|
||||
std::vector<LateralProfile> lateral_profile;
|
||||
|
||||
for (pugi::xml_node node_road : xml.child("OpenDRIVE").children("road")) {
|
||||
for (pugi::xml_node node_road : xml.child("OpenDRIVE").children("road")) {
|
||||
|
||||
// parse elevation profile
|
||||
pugi::xml_node node_profile = node_road.child("elevationProfile");
|
||||
if (node_profile) {
|
||||
// all geometry
|
||||
for (pugi::xml_node node_elevation : node_profile.children("elevation")) {
|
||||
ElevationProfile elev;
|
||||
// parse elevation profile
|
||||
pugi::xml_node node_profile = node_road.child("elevationProfile");
|
||||
if (node_profile) {
|
||||
// all geometry
|
||||
for (pugi::xml_node node_elevation : node_profile.children("elevation")) {
|
||||
ElevationProfile elev;
|
||||
|
||||
// get road id
|
||||
road::RoadId road_id = node_road.attribute("id").as_int();
|
||||
elev.road = map_builder.GetRoad(road_id);
|
||||
// get road id
|
||||
road::RoadId road_id = node_road.attribute("id").as_int();
|
||||
elev.road = map_builder.GetRoad(road_id);
|
||||
|
||||
// get common properties
|
||||
elev.s = node_elevation.attribute("s").as_float();
|
||||
elev.a = node_elevation.attribute("a").as_float();
|
||||
elev.b = node_elevation.attribute("b").as_float();
|
||||
elev.c = node_elevation.attribute("c").as_float();
|
||||
elev.d = node_elevation.attribute("d").as_float();
|
||||
// get common properties
|
||||
elev.s = node_elevation.attribute("s").as_double();
|
||||
elev.a = node_elevation.attribute("a").as_double();
|
||||
elev.b = node_elevation.attribute("b").as_double();
|
||||
elev.c = node_elevation.attribute("c").as_double();
|
||||
elev.d = node_elevation.attribute("d").as_double();
|
||||
|
||||
// add it
|
||||
elevation_profile.emplace_back(elev);
|
||||
}
|
||||
}
|
||||
|
||||
// parse lateral profile
|
||||
node_profile = node_road.child("lateralProfile");
|
||||
if (node_profile) {
|
||||
for (pugi::xml_node node : node_profile.children()) {
|
||||
LateralProfile lateral;
|
||||
|
||||
// get road id
|
||||
road::RoadId road_id = node_road.attribute("id").as_int();
|
||||
lateral.road = map_builder.GetRoad(road_id);
|
||||
|
||||
// get common properties
|
||||
lateral.s = node.attribute("s").as_float();
|
||||
lateral.a = node.attribute("a").as_float();
|
||||
lateral.b = node.attribute("b").as_float();
|
||||
lateral.c = node.attribute("c").as_float();
|
||||
lateral.d = node.attribute("d").as_float();
|
||||
|
||||
// handle different types
|
||||
lateral.type = node.name();
|
||||
if (lateral.type == "crossfall") {
|
||||
lateral.cross.side = node.attribute("side").value();
|
||||
} else if (lateral.type == "shape") {
|
||||
lateral.shape.t = node.attribute("t").as_float();
|
||||
}
|
||||
|
||||
// add it
|
||||
lateral_profile.emplace_back(lateral);
|
||||
}
|
||||
// add it
|
||||
elevation_profile.emplace_back(elev);
|
||||
}
|
||||
}
|
||||
|
||||
// map_builder calls
|
||||
for (auto const pro : elevation_profile) {
|
||||
map_builder.AddRoadElevationProfile(pro.road, pro.s, pro.a, pro.b, pro.c, pro.d);
|
||||
// parse lateral profile
|
||||
node_profile = node_road.child("lateralProfile");
|
||||
if (node_profile) {
|
||||
for (pugi::xml_node node : node_profile.children()) {
|
||||
LateralProfile lateral;
|
||||
|
||||
// get road id
|
||||
road::RoadId road_id = node_road.attribute("id").as_int();
|
||||
lateral.road = map_builder.GetRoad(road_id);
|
||||
|
||||
// get common properties
|
||||
lateral.s = node.attribute("s").as_double();
|
||||
lateral.a = node.attribute("a").as_double();
|
||||
lateral.b = node.attribute("b").as_double();
|
||||
lateral.c = node.attribute("c").as_double();
|
||||
lateral.d = node.attribute("d").as_double();
|
||||
|
||||
// handle different types
|
||||
lateral.type = node.name();
|
||||
if (lateral.type == "crossfall") {
|
||||
lateral.cross.side = node.attribute("side").value();
|
||||
} else if (lateral.type == "shape") {
|
||||
lateral.shape.t = node.attribute("t").as_double();
|
||||
}
|
||||
|
||||
// add it
|
||||
lateral_profile.emplace_back(lateral);
|
||||
}
|
||||
}
|
||||
/// @todo: RoadInfo classes must be created to fit this information
|
||||
// for (auto const pro : lateral_profile) {
|
||||
// if (pro.type == "superelevation")
|
||||
// map_builder.AddRoadLateralSuperElevation(pro.road, pro.s, pro.a, pro.b, pro.c, pro.d);
|
||||
// else if (pro.type == "crossfall")
|
||||
// map_builder.AddRoadLateralCrossfall(pro.road, pro.s, pro.a, pro.b, pro.c, pro.d, pro.cross.side);
|
||||
// else if (pro.type == "shape")
|
||||
// map_builder.AddRoadLateralShape(pro.road, pro.s, pro.a, pro.b, pro.c, pro.d, pro.shape.t);
|
||||
// }
|
||||
}
|
||||
|
||||
// map_builder calls
|
||||
for (auto const pro : elevation_profile) {
|
||||
map_builder.AddRoadElevationProfile(pro.road, pro.s, pro.a, pro.b, pro.c, pro.d);
|
||||
}
|
||||
/// @todo: RoadInfo classes must be created to fit this information
|
||||
// for (auto const pro : lateral_profile) {
|
||||
// if (pro.type == "superelevation")
|
||||
// map_builder.AddRoadLateralSuperElevation(pro.road, pro.s, pro.a,
|
||||
// pro.b, pro.c, pro.d);
|
||||
// else if (pro.type == "crossfall")
|
||||
// map_builder.AddRoadLateralCrossfall(pro.road, pro.s, pro.a, pro.b,
|
||||
// pro.c, pro.d, pro.cross.side);
|
||||
// else if (pro.type == "shape")
|
||||
// map_builder.AddRoadLateralShape(pro.road, pro.s, pro.a, pro.b, pro.c,
|
||||
// pro.d, pro.shape.t);
|
||||
// }
|
||||
}
|
||||
|
||||
} // namespace parser
|
||||
|
|
|
@ -19,84 +19,137 @@ namespace parser {
|
|||
using DependencyID = uint32_t;
|
||||
|
||||
template <typename T>
|
||||
static void AddValidity(pugi::xml_node parent_node, const std::string &node_name,
|
||||
const SignalID &signalID, T &&function);
|
||||
|
||||
template <typename T>
|
||||
static void AddValidity(pugi::xml_node parent_node, const std::string &node_name,
|
||||
const RoadID roadID, const SignalID &signalID, T &&function){
|
||||
for (pugi::xml_node validity_node = parent_node.child(node_name.c_str());
|
||||
validity_node;
|
||||
validity_node = validity_node.next_sibling("validity")) {
|
||||
const int from_lane = validity_node.attribute("fromLane").as_int();
|
||||
const int to_lane = validity_node.attribute("toLane").as_int();
|
||||
log_debug("Added validity to signal ", signalID, ":", from_lane, to_lane);
|
||||
function(roadID, signalID, from_lane, to_lane);
|
||||
}
|
||||
static void AddValidity(
|
||||
pugi::xml_node parent_node,
|
||||
const std::string &node_name,
|
||||
const RoadID roadID,
|
||||
const SignalID &signalID,
|
||||
T &&function) {
|
||||
for (pugi::xml_node validity_node = parent_node.child(node_name.c_str());
|
||||
validity_node;
|
||||
validity_node = validity_node.next_sibling("validity")) {
|
||||
const int from_lane = validity_node.attribute("fromLane").as_int();
|
||||
const int to_lane = validity_node.attribute("toLane").as_int();
|
||||
log_debug("Added validity to signal ", signalID, ":", from_lane, to_lane);
|
||||
function(roadID, signalID, from_lane, to_lane);
|
||||
}
|
||||
}
|
||||
|
||||
void SignalParser::Parse(
|
||||
const pugi::xml_document & xml,
|
||||
carla::road::MapBuilder & map_builder ) {
|
||||
//Extracting the OpenDRIVE
|
||||
const pugi::xml_node opendrive_node = xml.child("OpenDRIVE");
|
||||
const std::string validity = "validity";
|
||||
for (pugi::xml_node road_node = opendrive_node.child("road");
|
||||
road_node;
|
||||
road_node = road_node.next_sibling("road")) {
|
||||
const RoadID road_id = (RoadID) road_node.attribute("id").as_int();
|
||||
const pugi::xml_node signals_node = road_node.child("signals");
|
||||
for (pugi::xml_node signal_node = signals_node.child("signal");
|
||||
signal_node;
|
||||
signal_node = signal_node.next_sibling("signal")) {
|
||||
const float s_position = signal_node.attribute("s").as_float();
|
||||
const float t_position = signal_node.attribute("t").as_float();
|
||||
const SignalID signal_id = (SignalID) signal_node.attribute("id").as_int();
|
||||
const std::string name = signal_node.attribute("name").value();
|
||||
const std::string dynamic = signal_node.attribute("dynamic").value();
|
||||
const std::string orientation = signal_node.attribute("orientation").value();
|
||||
const float zOffset = signal_node.attribute("zOffSet").as_float();
|
||||
const std::string country = signal_node.attribute("country").value();
|
||||
const std::string type = signal_node.attribute("type").value();
|
||||
const std::string subtype = signal_node.attribute("subtype").value();
|
||||
const float value = signal_node.attribute("value").as_float();
|
||||
const std::string unit = signal_node.attribute("unit").value();
|
||||
const float height = signal_node.attribute("height").as_float();
|
||||
const float width = signal_node.attribute("width").as_float();
|
||||
const std::string text = signal_node.attribute("text").value();
|
||||
const float hOffset = signal_node.attribute("hOffset").as_float();
|
||||
const float pitch = signal_node.attribute("pitch").as_float();
|
||||
const float roll = signal_node.attribute("roll").as_float();
|
||||
log_debug("Road: ", road_id, "Adding Signal: ", s_position, t_position, signal_id, name, dynamic, orientation, zOffset, country, type, subtype, value, unit, height, width, text, hOffset, pitch, roll);
|
||||
map_builder.AddSignal(road_id, signal_id, s_position, t_position, name, dynamic, orientation, zOffset, country, type, subtype, value, unit, height, width, text, hOffset, pitch, roll );
|
||||
AddValidity(signal_node, "validity", road_id, signal_id,
|
||||
([&map_builder](const RoadID roadID, const SignalID &signal_id, const int16_t from_lane, const int16_t to_lane)
|
||||
{ map_builder.AddValidityToSignal(roadID, signal_id, from_lane, to_lane);}));
|
||||
const pugi::xml_document &xml,
|
||||
carla::road::MapBuilder &map_builder) {
|
||||
// Extracting the OpenDRIVE
|
||||
const pugi::xml_node opendrive_node = xml.child("OpenDRIVE");
|
||||
const std::string validity = "validity";
|
||||
for (pugi::xml_node road_node = opendrive_node.child("road");
|
||||
road_node;
|
||||
road_node = road_node.next_sibling("road")) {
|
||||
const RoadID road_id = (RoadID) road_node.attribute("id").as_int();
|
||||
const pugi::xml_node signals_node = road_node.child("signals");
|
||||
for (pugi::xml_node signal_node = signals_node.child("signal");
|
||||
signal_node;
|
||||
signal_node = signal_node.next_sibling("signal")) {
|
||||
const double s_position = signal_node.attribute("s").as_double();
|
||||
const double t_position = signal_node.attribute("t").as_double();
|
||||
const SignalID signal_id = (SignalID) signal_node.attribute("id").as_int();
|
||||
const std::string name = signal_node.attribute("name").value();
|
||||
const std::string dynamic = signal_node.attribute("dynamic").value();
|
||||
const std::string orientation = signal_node.attribute("orientation").value();
|
||||
const double zOffset = signal_node.attribute("zOffSet").as_double();
|
||||
const std::string country = signal_node.attribute("country").value();
|
||||
const std::string type = signal_node.attribute("type").value();
|
||||
const std::string subtype = signal_node.attribute("subtype").value();
|
||||
const double value = signal_node.attribute("value").as_double();
|
||||
const std::string unit = signal_node.attribute("unit").value();
|
||||
const double height = signal_node.attribute("height").as_double();
|
||||
const double width = signal_node.attribute("width").as_double();
|
||||
const std::string text = signal_node.attribute("text").value();
|
||||
const double hOffset = signal_node.attribute("hOffset").as_double();
|
||||
const double pitch = signal_node.attribute("pitch").as_double();
|
||||
const double roll = signal_node.attribute("roll").as_double();
|
||||
log_debug("Road: ",
|
||||
road_id,
|
||||
"Adding Signal: ",
|
||||
s_position,
|
||||
t_position,
|
||||
signal_id,
|
||||
name,
|
||||
dynamic,
|
||||
orientation,
|
||||
zOffset,
|
||||
country,
|
||||
type,
|
||||
subtype,
|
||||
value,
|
||||
unit,
|
||||
height,
|
||||
width,
|
||||
text,
|
||||
hOffset,
|
||||
pitch,
|
||||
roll);
|
||||
map_builder.AddSignal(road_id,
|
||||
signal_id,
|
||||
s_position,
|
||||
t_position,
|
||||
name,
|
||||
dynamic,
|
||||
orientation,
|
||||
zOffset,
|
||||
country,
|
||||
type,
|
||||
subtype,
|
||||
value,
|
||||
unit,
|
||||
height,
|
||||
width,
|
||||
text,
|
||||
hOffset,
|
||||
pitch,
|
||||
roll);
|
||||
AddValidity(signal_node, "validity", road_id, signal_id,
|
||||
([&map_builder](const RoadID roadID, const SignalID &signal_id, const int16_t from_lane,
|
||||
const int16_t to_lane)
|
||||
{ map_builder.AddValidityToSignal(roadID, signal_id, from_lane, to_lane);
|
||||
}));
|
||||
|
||||
for (pugi::xml_node dependency_node = signal_node.child("dependency");
|
||||
dependency_node;
|
||||
dependency_node = dependency_node.next_sibling("validity")) {
|
||||
const DependencyID dependency_id = dependency_node.attribute("id").as_int();
|
||||
const std::string dependency_type = dependency_node.attribute("type").value();
|
||||
log_debug("Added dependency to signal ", signal_id, ":", dependency_id, dependency_type);
|
||||
map_builder.AddDependencyToSignal(road_id, signal_id, dependency_id, dependency_type);
|
||||
}
|
||||
}
|
||||
for (pugi::xml_node signalreference_node = signals_node.child("signalReference");
|
||||
signalreference_node;
|
||||
signalreference_node = signalreference_node.next_sibling("signalReference")) {
|
||||
const float s_position = signalreference_node.attribute("s").as_float();
|
||||
const float t_position = signalreference_node.attribute("t").as_float();
|
||||
const SignalID signal_reference_id = signalreference_node.attribute("id").as_int();
|
||||
const std::string signal_reference_orientation = signalreference_node.attribute("orientation").value();
|
||||
log_debug("Road: ", road_id, "Added SignalReference ", s_position, t_position, signal_reference_id, signal_reference_orientation);
|
||||
map_builder.AddSignalReference(road_id, signal_reference_id, s_position, t_position, signal_reference_orientation);
|
||||
AddValidity(signalreference_node, validity, road_id, signal_reference_id,
|
||||
([&map_builder](const RoadID &road_id, const SignalID &signal_id, const int16_t from_lane, const int16_t to_lane)
|
||||
{ map_builder.AddValidityToSignalReference(road_id, signal_id, from_lane, to_lane);}));
|
||||
}
|
||||
}
|
||||
for (pugi::xml_node dependency_node = signal_node.child("dependency");
|
||||
dependency_node;
|
||||
dependency_node = dependency_node.next_sibling("validity")) {
|
||||
const DependencyID dependency_id = dependency_node.attribute("id").as_int();
|
||||
const std::string dependency_type = dependency_node.attribute("type").value();
|
||||
log_debug("Added dependency to signal ", signal_id, ":", dependency_id, dependency_type);
|
||||
map_builder.AddDependencyToSignal(road_id, signal_id, dependency_id, dependency_type);
|
||||
}
|
||||
}
|
||||
for (pugi::xml_node signalreference_node = signals_node.child("signalReference");
|
||||
signalreference_node;
|
||||
signalreference_node = signalreference_node.next_sibling("signalReference")) {
|
||||
const double s_position = signalreference_node.attribute("s").as_double();
|
||||
const double t_position = signalreference_node.attribute("t").as_double();
|
||||
const SignalID signal_reference_id = signalreference_node.attribute("id").as_int();
|
||||
const std::string signal_reference_orientation =
|
||||
signalreference_node.attribute("orientation").value();
|
||||
log_debug("Road: ",
|
||||
road_id,
|
||||
"Added SignalReference ",
|
||||
s_position,
|
||||
t_position,
|
||||
signal_reference_id,
|
||||
signal_reference_orientation);
|
||||
map_builder.AddSignalReference(road_id,
|
||||
signal_reference_id,
|
||||
s_position,
|
||||
t_position,
|
||||
signal_reference_orientation);
|
||||
AddValidity(signalreference_node, validity, road_id, signal_reference_id,
|
||||
([&map_builder](const RoadID &road_id, const SignalID &signal_id, const int16_t from_lane,
|
||||
const int16_t to_lane)
|
||||
{ map_builder.AddValidityToSignalReference(road_id, signal_id, from_lane, to_lane);
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace parser
|
||||
} // namespace opendrive
|
||||
} // namespace carla
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
#pragma once
|
||||
|
||||
#include "carla/NonCopyable.h"
|
||||
#include "carla/road/RoadTypes.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "carla/road/RoadTypes.h"
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
|
@ -17,24 +18,23 @@ namespace road {
|
|||
class Object : private MovableNonCopyable {
|
||||
public:
|
||||
|
||||
Object() {}
|
||||
Object() = default;
|
||||
|
||||
private:
|
||||
|
||||
ObjId _id;
|
||||
ObjId _id = 0u;
|
||||
std::string _type;
|
||||
std::string _name;
|
||||
float _s;
|
||||
float _t;
|
||||
float _zOffset;
|
||||
float _validLength;
|
||||
double _s = 0.0;
|
||||
double _t = 0.0;
|
||||
double _zOffset = 0.0;
|
||||
double _validLength = 0.0;
|
||||
std::string _orientation;
|
||||
float _lenght;
|
||||
float _width;
|
||||
float _hdg;
|
||||
float _pitch;
|
||||
float _roll;
|
||||
|
||||
double _lenght = 0.0;
|
||||
double _width = 0.0;
|
||||
double _hdg = 0.0;
|
||||
double _pitch = 0.0;
|
||||
double _roll = 0.0;
|
||||
};
|
||||
|
||||
} // road
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "carla/road/element/LaneMarking.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace carla {
|
||||
|
@ -17,31 +18,29 @@ namespace element {
|
|||
|
||||
struct WaypointInfoRoadMark {
|
||||
|
||||
// WaypointInfoRoadMark() {}
|
||||
|
||||
WaypointInfoRoadMark(const RoadInfoMarkRecord &info);
|
||||
|
||||
LaneMarking type = LaneMarking::None;
|
||||
|
||||
enum class Color : uint8_t {
|
||||
Standard = 0, // (equivalent to "white")
|
||||
Blue = 1,
|
||||
Green = 2,
|
||||
Red = 3,
|
||||
White = Standard,
|
||||
Yellow = 4,
|
||||
Other = 5
|
||||
Standard = 0u, // (equivalent to "white")
|
||||
Blue = 1u,
|
||||
Green = 2u,
|
||||
Red = 3u,
|
||||
White = Standard,
|
||||
Yellow = 4u,
|
||||
Other = 5u
|
||||
} color = Color::Standard;
|
||||
|
||||
/// Can be used as flags
|
||||
enum class LaneChange : uint8_t {
|
||||
None = 0x00, //00
|
||||
Right = 0x01, //01
|
||||
Left = 0x02, //10
|
||||
Both = 0x03 //11
|
||||
None = 0x00, // 00
|
||||
Right = 0x01, // 01
|
||||
Left = 0x02, // 10
|
||||
Both = 0x03 // 11
|
||||
} lane_change = LaneChange::None;
|
||||
|
||||
float width = 0.0f;
|
||||
double width = 0.0;
|
||||
};
|
||||
|
||||
} // namespace element
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
// Copyright (c) 2019 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 "Signal.h"
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
namespace signal {
|
||||
|
||||
void Signal::AddValidity(general::Validity &&validity) {
|
||||
_validities.push_back(std::move(validity));
|
||||
}
|
||||
|
||||
void Signal::AddDependency(SignalDependency &&dependency) {
|
||||
_dependencies.push_back(std::move(dependency));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,12 +7,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "carla/NonCopyable.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "carla/road/RoadTypes.h"
|
||||
#include "carla/road/general/Validity.h"
|
||||
#include "carla/road/signal/SignalDependency.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
namespace signal {
|
||||
|
@ -23,51 +24,50 @@ namespace signal {
|
|||
Signal(
|
||||
int32_t road_id,
|
||||
int32_t signal_id,
|
||||
float s,
|
||||
float t,
|
||||
double s,
|
||||
double t,
|
||||
std::string name,
|
||||
std::string dynamic,
|
||||
std::string orientation,
|
||||
float zOffset,
|
||||
double zOffset,
|
||||
std::string country,
|
||||
std::string type,
|
||||
std::string subtype,
|
||||
float value,
|
||||
double value,
|
||||
std::string unit,
|
||||
float height,
|
||||
float width,
|
||||
double height,
|
||||
double width,
|
||||
std::string text,
|
||||
float hOffset,
|
||||
float pitch,
|
||||
float roll)
|
||||
: _road_id(road_id),
|
||||
_signal_id(signal_id),
|
||||
_s(s),
|
||||
_t(t),
|
||||
_name(name),
|
||||
_dynamic(dynamic),
|
||||
_orientation(orientation),
|
||||
_zOffset(zOffset),
|
||||
_country(country),
|
||||
_type(type),
|
||||
_subtype(subtype),
|
||||
_value(value),
|
||||
_unit(unit),
|
||||
_height(height),
|
||||
_width(width),
|
||||
_text(text),
|
||||
_hOffset(hOffset),
|
||||
_pitch(pitch),
|
||||
_roll(roll) {
|
||||
_validities = std::vector<general::Validity>();
|
||||
_dependencies = std::vector<signal::SignalDependency>();
|
||||
}
|
||||
double hOffset,
|
||||
double pitch,
|
||||
double roll)
|
||||
: _road_id(road_id),
|
||||
_signal_id(signal_id),
|
||||
_s(s),
|
||||
_t(t),
|
||||
_name(name),
|
||||
_dynamic(dynamic),
|
||||
_orientation(orientation),
|
||||
_zOffset(zOffset),
|
||||
_country(country),
|
||||
_type(type),
|
||||
_subtype(subtype),
|
||||
_value(value),
|
||||
_unit(unit),
|
||||
_height(height),
|
||||
_width(width),
|
||||
_text(text),
|
||||
_hOffset(hOffset),
|
||||
_pitch(pitch),
|
||||
_roll(roll) {}
|
||||
|
||||
void AddValidity(general::Validity &&validity);
|
||||
void AddValidity(general::Validity &&validity) {
|
||||
_validities.push_back(std::move(validity));
|
||||
}
|
||||
|
||||
void AddDependency(signal::SignalDependency &&dependency);
|
||||
|
||||
std::string GimmeRandomStuff();
|
||||
void AddDependency(signal::SignalDependency &&dependency) {
|
||||
_dependencies.push_back(std::move(dependency));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
@ -77,23 +77,23 @@ namespace signal {
|
|||
#endif
|
||||
int32_t _road_id;
|
||||
int32_t _signal_id;
|
||||
float _s;
|
||||
float _t;
|
||||
double _s;
|
||||
double _t;
|
||||
std::string _name;
|
||||
std::string _dynamic;
|
||||
std::string _orientation;
|
||||
float _zOffset;
|
||||
double _zOffset;
|
||||
std::string _country;
|
||||
std::string _type;
|
||||
std::string _subtype;
|
||||
float _value;
|
||||
double _value;
|
||||
std::string _unit;
|
||||
float _height;
|
||||
float _width;
|
||||
double _height;
|
||||
double _width;
|
||||
std::string _text;
|
||||
float _hOffset;
|
||||
float _pitch;
|
||||
float _roll;
|
||||
double _hOffset;
|
||||
double _pitch;
|
||||
double _roll;
|
||||
std::vector<general::Validity> _validities;
|
||||
std::vector<signal::SignalDependency> _dependencies;
|
||||
#if defined(__clang__)
|
||||
|
@ -101,8 +101,6 @@ namespace signal {
|
|||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // object
|
||||
} // road
|
||||
} // carla
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace signal {
|
|||
SignalReference(
|
||||
int32_t road_id,
|
||||
uint32_t id,
|
||||
float s,
|
||||
float t,
|
||||
double s,
|
||||
double t,
|
||||
std::string orientation)
|
||||
: _road_id(road_id),
|
||||
_signal_id(id),
|
||||
|
@ -43,8 +43,8 @@ namespace signal {
|
|||
#endif
|
||||
int32_t _road_id;
|
||||
int32_t _signal_id;
|
||||
float _s;
|
||||
float _t;
|
||||
double _s;
|
||||
double _t;
|
||||
std::string _orientation;
|
||||
std::vector<general::Validity> _validities;
|
||||
#if defined(__clang__)
|
||||
|
|
Loading…
Reference in New Issue