Fixed style
This commit is contained in:
parent
3e6089a192
commit
744a2d47e0
|
@ -4,6 +4,7 @@
|
||||||
* Vehicles get destroyed when they are stuck in Traffic Manager
|
* Vehicles get destroyed when they are stuck in Traffic Manager
|
||||||
* Implemented intersection anticipation algorithm in Traffic Manager
|
* Implemented intersection anticipation algorithm in Traffic Manager
|
||||||
* Added support for new geometry: `spiral`, `poly3`, and `paramPoly3`
|
* Added support for new geometry: `spiral`, `poly3`, and `paramPoly3`
|
||||||
|
* Improved `get_waypoint(location)` performance
|
||||||
* New weather system: night time, fog, rain ripples, and now wind affects vegetation and rain (not car physics)
|
* New weather system: night time, fog, rain ripples, and now wind affects vegetation and rain (not car physics)
|
||||||
* Fixed Low/Epic quality settings transition
|
* Fixed Low/Epic quality settings transition
|
||||||
* Enabled Mesh distance fields
|
* Enabled Mesh distance fields
|
||||||
|
|
|
@ -198,11 +198,11 @@ file(GLOB libcarla_cephes_sources
|
||||||
set(libcarla_sources "${libcarla_sources};${libcarla_cephes_sources}")
|
set(libcarla_sources "${libcarla_sources};${libcarla_cephes_sources}")
|
||||||
install(FILES ${libcarla_cephes_sources} DESTINATION include/cephes)
|
install(FILES ${libcarla_cephes_sources} DESTINATION include/cephes)
|
||||||
|
|
||||||
file(GLOB libcarla_odrSpiral_sources
|
file(GLOB libcarla_odr_spiral_sources
|
||||||
"${libcarla_source_thirdparty_path}/odrSpiral/*.cpp"
|
"${libcarla_source_thirdparty_path}/odrSpiral/*.cpp"
|
||||||
"${libcarla_source_thirdparty_path}/odrSpiral/*.h")
|
"${libcarla_source_thirdparty_path}/odrSpiral/*.h")
|
||||||
set(libcarla_sources "${libcarla_sources};${libcarla_odrSpiral_sources}")
|
set(libcarla_sources "${libcarla_sources};${libcarla_odr_spiral_sources}")
|
||||||
install(FILES ${libcarla_odrSpiral_sources} DESTINATION include/odrSpiral)
|
install(FILES ${libcarla_odr_spiral_sources} DESTINATION include/odrSpiral)
|
||||||
|
|
||||||
file(GLOB libcarla_moodycamel_sources
|
file(GLOB libcarla_moodycamel_sources
|
||||||
"${libcarla_source_thirdparty_path}/moodycamel/*.h")
|
"${libcarla_source_thirdparty_path}/moodycamel/*.h")
|
||||||
|
|
|
@ -29,24 +29,24 @@ namespace geom {
|
||||||
CubicPolynomial(const CubicPolynomial &) = default;
|
CubicPolynomial(const CubicPolynomial &) = default;
|
||||||
|
|
||||||
CubicPolynomial(
|
CubicPolynomial(
|
||||||
const value_type &a,
|
const value_type &a,
|
||||||
const value_type &b,
|
const value_type &b,
|
||||||
const value_type &c,
|
const value_type &c,
|
||||||
const value_type &d)
|
const value_type &d)
|
||||||
: _v{ {a, b, c, d} },
|
: _v{ {a, b, c, d} },
|
||||||
_s(0.0) {}
|
_s(0.0) {}
|
||||||
|
|
||||||
CubicPolynomial(
|
CubicPolynomial(
|
||||||
const value_type &a,
|
const value_type &a,
|
||||||
const value_type &b,
|
const value_type &b,
|
||||||
const value_type &c,
|
const value_type &c,
|
||||||
const value_type &d,
|
const value_type &d,
|
||||||
const value_type &s) // lateral offset
|
const value_type &s) // lateral offset
|
||||||
: _v{ {a - b * s + c * s * s - d * s * s * s,
|
: _v{ {a - b * s + c * s * s - d * s * s * s,
|
||||||
b - 2 * c * s + 3 * d * s * s,
|
b - 2 * c * s + 3 * d * s * s,
|
||||||
c - 3 * d * s,
|
c - 3 * d * s,
|
||||||
d} },
|
d} },
|
||||||
_s(s) {}
|
_s(s) {}
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// -- Getters --------------------------------------------------------------
|
// -- Getters --------------------------------------------------------------
|
||||||
|
@ -77,11 +77,11 @@ namespace geom {
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
void Set(
|
void Set(
|
||||||
const value_type &a,
|
const value_type &a,
|
||||||
const value_type &b,
|
const value_type &b,
|
||||||
const value_type &c,
|
const value_type &c,
|
||||||
const value_type &d,
|
const value_type &d,
|
||||||
const value_type &s) { // lateral offset
|
const value_type &s) { // lateral offset
|
||||||
_v = { a - b * s + c * s * s - d * s * s * s,
|
_v = { a - b * s + c * s * s - d * s * s * s,
|
||||||
b - 2 * c * s + 3 * d * s * s,
|
b - 2 * c * s + 3 * d * s * s,
|
||||||
c - 3 * d * s,
|
c - 3 * d * s,
|
||||||
|
@ -90,12 +90,12 @@ namespace geom {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Set(
|
void Set(
|
||||||
const value_type &a,
|
const value_type &a,
|
||||||
const value_type &b,
|
const value_type &b,
|
||||||
const value_type &c,
|
const value_type &c,
|
||||||
const value_type &d) {
|
const value_type &d) {
|
||||||
_v = {{a, b, c, d}};
|
_v = {a, b, c, d};
|
||||||
_s = (0.0);
|
_s = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
|
@ -16,9 +16,9 @@ namespace geom {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<float, float> Math::DistanceSegmentToPoint(
|
std::pair<float, float> Math::DistanceSegmentToPoint(
|
||||||
const Vector3D &p,
|
const Vector3D &p,
|
||||||
const Vector3D &v,
|
const Vector3D &v,
|
||||||
const Vector3D &w) {
|
const Vector3D &w) {
|
||||||
const float l2 = DistanceSquared2D(v, w);
|
const float l2 = DistanceSquared2D(v, w);
|
||||||
const float l = std::sqrt(l2);
|
const float l = std::sqrt(l2);
|
||||||
if (l2 == 0.0f) {
|
if (l2 == 0.0f) {
|
||||||
|
@ -31,11 +31,11 @@ namespace geom {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<float, float> Math::DistanceArcToPoint(
|
std::pair<float, float> Math::DistanceArcToPoint(
|
||||||
Vector3D p,
|
Vector3D p,
|
||||||
Vector3D start_pos,
|
Vector3D start_pos,
|
||||||
const float length,
|
const float length,
|
||||||
float heading, // [radians]
|
float heading, // [radians]
|
||||||
float curvature) {
|
float curvature) {
|
||||||
|
|
||||||
/// @todo: Because Unreal's coordinates, hacky way to correct
|
/// @todo: Because Unreal's coordinates, hacky way to correct
|
||||||
/// the -y, this must be changed in the future
|
/// the -y, this must be changed in the future
|
||||||
|
@ -91,21 +91,21 @@ namespace geom {
|
||||||
DEBUG_ASSERT(angle >= 0.0f);
|
DEBUG_ASSERT(angle >= 0.0f);
|
||||||
if (angle <= last_point_angle) {
|
if (angle <= last_point_angle) {
|
||||||
return std::make_pair(
|
return std::make_pair(
|
||||||
angle * radius,
|
angle * radius,
|
||||||
Distance2D(intersection, rotated_p));
|
Distance2D(intersection, rotated_p));
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the nearest point, start or end to intersection
|
// find the nearest point, start or end to intersection
|
||||||
const float start_dist = Distance2D(Vector3D(), rotated_p);
|
const float start_dist = Distance2D(Vector3D(), rotated_p);
|
||||||
|
|
||||||
const Vector3D end_pos(
|
const Vector3D end_pos(
|
||||||
radius * std::cos(last_point_angle - pi_half),
|
radius * std::cos(last_point_angle - pi_half),
|
||||||
radius * std::sin(last_point_angle - pi_half) + circ_center.y,
|
radius * std::sin(last_point_angle - pi_half) + circ_center.y,
|
||||||
0.0f);
|
0.0f);
|
||||||
const float end_dist = Distance2D(end_pos, rotated_p);
|
const float end_dist = Distance2D(end_pos, rotated_p);
|
||||||
return (start_dist < end_dist) ?
|
return (start_dist < end_dist) ?
|
||||||
std::make_pair(0.0f, start_dist) :
|
std::make_pair(0.0f, start_dist) :
|
||||||
std::make_pair(length, end_dist);
|
std::make_pair(length, end_dist);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3D Math::RotatePointOnOrigin2D(Vector3D p, float angle) {
|
Vector3D Math::RotatePointOnOrigin2D(Vector3D p, float angle) {
|
||||||
|
@ -119,7 +119,7 @@ namespace geom {
|
||||||
const float sp = std::sin(ToRadians(rotation.pitch));
|
const float sp = std::sin(ToRadians(rotation.pitch));
|
||||||
const float cy = std::cos(ToRadians(rotation.yaw));
|
const float cy = std::cos(ToRadians(rotation.yaw));
|
||||||
const float sy = std::sin(ToRadians(rotation.yaw));
|
const float sy = std::sin(ToRadians(rotation.yaw));
|
||||||
return {cy *cp, sy *cp, sp};
|
return {cy * cp, sy * cp, sp};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace geom
|
} // namespace geom
|
||||||
|
|
|
@ -79,6 +79,7 @@ namespace geom {
|
||||||
return std::sqrt(DistanceSquared2D(a, b));
|
return std::sqrt(DistanceSquared2D(a, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the angle between 2 vectors in radians
|
||||||
static double GetVectorAngle(const Vector3D &a, const Vector3D &b);
|
static double GetVectorAngle(const Vector3D &a, const Vector3D &b);
|
||||||
|
|
||||||
/// Returns a pair containing:
|
/// Returns a pair containing:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -15,9 +15,9 @@
|
||||||
namespace carla {
|
namespace carla {
|
||||||
namespace geom {
|
namespace geom {
|
||||||
|
|
||||||
// Rtree class working with 3D point clouds.
|
/// Rtree class working with 3D point clouds.
|
||||||
// Asociates a T element with a 3D point
|
/// Asociates a T element with a 3D point
|
||||||
// Useful to perform fast k-NN searches
|
/// Useful to perform fast k-NN searches
|
||||||
template <typename T, size_t Dimension = 3>
|
template <typename T, size_t Dimension = 3>
|
||||||
class PointCloudRtree {
|
class PointCloudRtree {
|
||||||
public:
|
public:
|
||||||
|
@ -36,11 +36,12 @@ namespace geom {
|
||||||
void InsertElements(const std::vector<TreeElement> &elements) {
|
void InsertElements(const std::vector<TreeElement> &elements) {
|
||||||
_rtree.insert(elements.begin(), elements.end());
|
_rtree.insert(elements.begin(), elements.end());
|
||||||
}
|
}
|
||||||
// Return nearest neighbors with a user defined filter.
|
|
||||||
// The filter reveices as an argument a TreeElement value and needs to
|
/// Return nearest neighbors with a user defined filter.
|
||||||
// return a bool to accept or reject the value
|
/// The filter reveices as an argument a TreeElement value and needs to
|
||||||
// [&](Rtree::TreeElement const &element){if (IsOk(element)) return true;
|
/// return a bool to accept or reject the value
|
||||||
// else return false;}
|
/// [&](Rtree::TreeElement const &element){if (IsOk(element)) return true;
|
||||||
|
/// else return false;}
|
||||||
template <typename Filter>
|
template <typename Filter>
|
||||||
std::vector<TreeElement> GetNearestNeighboursWithFilter(const BPoint &point, Filter filter,
|
std::vector<TreeElement> GetNearestNeighboursWithFilter(const BPoint &point, Filter filter,
|
||||||
size_t number_neighbours = 1) const {
|
size_t number_neighbours = 1) const {
|
||||||
|
@ -50,12 +51,14 @@ namespace geom {
|
||||||
std::back_inserter(query_result));
|
std::back_inserter(query_result));
|
||||||
return query_result;
|
return query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<TreeElement> GetNearestNeighbours(const BPoint &point, size_t number_neighbours = 1) const {
|
std::vector<TreeElement> GetNearestNeighbours(const BPoint &point, size_t number_neighbours = 1) const {
|
||||||
std::vector<TreeElement> query_result;
|
std::vector<TreeElement> query_result;
|
||||||
_rtree.query(boost::geometry::index::nearest(point, static_cast<unsigned int>(number_neighbours)),
|
_rtree.query(boost::geometry::index::nearest(point, static_cast<unsigned int>(number_neighbours)),
|
||||||
std::back_inserter(query_result));
|
std::back_inserter(query_result));
|
||||||
return query_result;
|
return query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t GetTreeSize() const {
|
size_t GetTreeSize() const {
|
||||||
return _rtree.size();
|
return _rtree.size();
|
||||||
}
|
}
|
||||||
|
@ -66,9 +69,9 @@ namespace geom {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Rtree class working with 3D segment clouds.
|
/// Rtree class working with 3D segment clouds.
|
||||||
// Stores a pair of T elements (one for each end of the segment)
|
/// Stores a pair of T elements (one for each end of the segment)
|
||||||
// Useful to perform fast k-NN searches.
|
/// Useful to perform fast k-NN searches.
|
||||||
template <typename T, size_t Dimension = 3>
|
template <typename T, size_t Dimension = 3>
|
||||||
class SegmentCloudRtree {
|
class SegmentCloudRtree {
|
||||||
public:
|
public:
|
||||||
|
@ -80,6 +83,7 @@ namespace geom {
|
||||||
void InsertElement(const BSegment &segment, const T &element_start, const T &element_end) {
|
void InsertElement(const BSegment &segment, const T &element_start, const T &element_end) {
|
||||||
_rtree.insert(std::make_pair(segment, std::make_pair(element_start, element_end)));
|
_rtree.insert(std::make_pair(segment, std::make_pair(element_start, element_end)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsertElement(const TreeElement &element) {
|
void InsertElement(const TreeElement &element) {
|
||||||
_rtree.insert(element);
|
_rtree.insert(element);
|
||||||
}
|
}
|
||||||
|
@ -87,25 +91,30 @@ namespace geom {
|
||||||
void InsertElements(const std::vector<TreeElement> &elements) {
|
void InsertElements(const std::vector<TreeElement> &elements) {
|
||||||
_rtree.insert(elements.begin(), elements.end());
|
_rtree.insert(elements.begin(), elements.end());
|
||||||
}
|
}
|
||||||
// Return nearest neighbors with a user defined filter.
|
|
||||||
// The filter reveices as an argument a TreeElement value and needs to
|
/// Return nearest neighbors with a user defined filter.
|
||||||
// return a bool to accept or reject the value
|
/// The filter reveices as an argument a TreeElement value and needs to
|
||||||
// [&](Rtree::TreeElement const &element){if (IsOk(element)) return true;
|
/// return a bool to accept or reject the value
|
||||||
// else return false;}
|
/// [&](Rtree::TreeElement const &element){if (IsOk(element)) return true;
|
||||||
|
/// else return false;}
|
||||||
template <typename Filter>
|
template <typename Filter>
|
||||||
std::vector<TreeElement> GetNearestNeighboursWithFilter(const BPoint &point, Filter filter,
|
std::vector<TreeElement> GetNearestNeighboursWithFilter(
|
||||||
|
const BPoint &point,
|
||||||
|
Filter filter,
|
||||||
size_t number_neighbours = 1) const {
|
size_t number_neighbours = 1) const {
|
||||||
std::vector<TreeElement> query_result;
|
std::vector<TreeElement> query_result;
|
||||||
_rtree.query(boost::geometry::index::nearest(point,
|
_rtree.query(
|
||||||
static_cast<unsigned int>(number_neighbours)) && boost::geometry::index::satisfies(filter),
|
boost::geometry::index::nearest(point, static_cast<unsigned int>(number_neighbours)) &&
|
||||||
std::back_inserter(query_result));
|
boost::geometry::index::satisfies(filter),
|
||||||
|
std::back_inserter(query_result));
|
||||||
return query_result;
|
return query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<TreeElement> GetNearestNeighbours(const BPoint &point, size_t number_neighbours = 1) const {
|
std::vector<TreeElement> GetNearestNeighbours(const BPoint &point, size_t number_neighbours = 1) const {
|
||||||
std::vector<TreeElement> query_result;
|
std::vector<TreeElement> query_result;
|
||||||
_rtree.query(boost::geometry::index::nearest(point,
|
_rtree.query(
|
||||||
static_cast<unsigned int>(number_neighbours)),
|
boost::geometry::index::nearest(point, static_cast<unsigned int>(number_neighbours)),
|
||||||
std::back_inserter(query_result));
|
std::back_inserter(query_result));
|
||||||
return query_result;
|
return query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,13 +140,20 @@ private:
|
||||||
Rtree _rtree;
|
Rtree _rtree;
|
||||||
|
|
||||||
void CreateRtree();
|
void CreateRtree();
|
||||||
//Helper Functions for constructing the rtree element list
|
|
||||||
void AddElementToRtree(std::vector<Rtree::TreeElement> &rtree_elements,
|
/// Helper Functions for constructing the rtree element list
|
||||||
geom::Transform ¤t_transform, geom::Transform &next_transform,
|
void AddElementToRtree(
|
||||||
Waypoint ¤t_waypoint, Waypoint &next_waypoint);
|
std::vector<Rtree::TreeElement> &rtree_elements,
|
||||||
void AddElementToRtreeAndUpdateTransforms(std::vector<Rtree::TreeElement> &rtree_elements,
|
geom::Transform ¤t_transform,
|
||||||
geom::Transform ¤t_transform, Waypoint ¤t_waypoint,
|
geom::Transform &next_transform,
|
||||||
Waypoint &next_waypoint);
|
Waypoint ¤t_waypoint,
|
||||||
|
Waypoint &next_waypoint);
|
||||||
|
|
||||||
|
void AddElementToRtreeAndUpdateTransforms(
|
||||||
|
std::vector<Rtree::TreeElement> &rtree_elements,
|
||||||
|
geom::Transform ¤t_transform,
|
||||||
|
Waypoint ¤t_waypoint,
|
||||||
|
Waypoint &next_waypoint);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace road
|
} // namespace road
|
||||||
|
|
|
@ -91,8 +91,8 @@ else
|
||||||
mkdir -p ${BOOST_BASENAME}-install/include
|
mkdir -p ${BOOST_BASENAME}-install/include
|
||||||
mv ${BOOST_PACKAGE_BASENAME} ${BOOST_BASENAME}-source
|
mv ${BOOST_PACKAGE_BASENAME} ${BOOST_BASENAME}-source
|
||||||
# Boost patch for exception handling
|
# Boost patch for exception handling
|
||||||
cp ${CARLA_BUILD_FOLDER}/../Util/BoostFiles/rational.hpp ${BOOST_BASENAME}-source/boost/rational.hpp
|
cp "${CARLA_BUILD_FOLDER}/../Util/BoostFiles/rational.hpp ${BOOST_BASENAME}-source/boost/rational.hpp"
|
||||||
cp ${CARLA_BUILD_FOLDER}/../Util/BoostFiles/read.hpp ${BOOST_BASENAME}-source/boost/geometry/io/wkt/read.hpp
|
cp "${CARLA_BUILD_FOLDER}/../Util/BoostFiles/read.hpp ${BOOST_BASENAME}-source/boost/geometry/io/wkt/read.hpp"
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
pushd ${BOOST_BASENAME}-source >/dev/null
|
pushd ${BOOST_BASENAME}-source >/dev/null
|
||||||
|
@ -160,8 +160,8 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Boost patch for exception handling
|
# Boost patch for exception handling
|
||||||
cp ${CARLA_BUILD_FOLDER}/../Util/BoostFiles/rational.hpp ${BOOST_BASENAME}-install/include/boost/rational.hpp
|
cp "${CARLA_BUILD_FOLDER}/../Util/BoostFiles/rational.hpp ${BOOST_BASENAME}-install/include/boost/rational.hpp"
|
||||||
cp ${CARLA_BUILD_FOLDER}/../Util/BoostFiles/read.hpp ${BOOST_BASENAME}-install/include/boost/geometry/io/wkt/read.hpp
|
cp "${CARLA_BUILD_FOLDER}/../Util/BoostFiles/read.hpp ${BOOST_BASENAME}-install/include/boost/geometry/io/wkt/read.hpp"
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
unset BOOST_BASENAME
|
unset BOOST_BASENAME
|
||||||
|
|
Loading…
Reference in New Issue