Skip to content

Commit

Permalink
Removes maliput_drake dependency. (#105)
Browse files Browse the repository at this point in the history
Signed-off-by: Franco Cipollone <[email protected]>
  • Loading branch information
francocipollone authored Sep 27, 2023
1 parent 416b658 commit c0294d7
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 31 deletions.
4 changes: 0 additions & 4 deletions .github/dependencies.repos
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ repositories:
type: git
url: https://github.com/maliput/maliput
version: main
maliput_drake:
type: git
url: https://github.com/maliput/maliput_drake
version: main
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ message(STATUS "\n\n====== Finding 3rd Party Packages ======\n")

find_package(ament_cmake REQUIRED)
find_package(maliput REQUIRED)
find_package(maliput_drake REQUIRED)
find_package(yaml-cpp REQUIRED)

##############################################################################
Expand Down Expand Up @@ -78,7 +77,6 @@ ament_export_include_directories(include)

ament_export_dependencies(ament_cmake)
ament_export_dependencies(maliput)
ament_export_dependencies(maliput_drake)
ament_export_dependencies(yaml-cpp)
ament_export_targets(${PROJECT_NAME}-targets HAS_LIBRARY_TARGET)
ament_package()
1 change: 0 additions & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<doc_depend>ament_cmake_doxygen</doc_depend>

<depend>maliput</depend>
<depend>maliput_drake</depend>
<depend>yaml-cpp</depend>

<test_depend>ament_cmake_gtest</test_depend>
Expand Down
9 changes: 4 additions & 5 deletions src/maliput_multilane/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@ target_link_libraries(maliput_multilane
PUBLIC
maliput::api
maliput::base
maliput::drake_systems_analysis
maliput::geometry_base
maliput::common
maliput::math
maliput_drake::analysis
PRIVATE
maliput_drake::common
maliput_drake::framework
maliput_drake::math
maliput_drake::trajectories
maliput::drake_common
maliput::drake_common_trajectories
maliput::drake_systems_framework
yaml-cpp
)

Expand Down
5 changes: 2 additions & 3 deletions src/maliput_multilane/arc_road_curve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <limits>

#include <maliput/common/maliput_abort.h>
#include <maliput/drake/math/saturate.h>

namespace maliput {
namespace multilane {
Expand Down Expand Up @@ -129,13 +128,13 @@ math::Vector3 ArcRoadCurve::ToCurveFrame(const math::Vector3& geo_coordinate, do
// Compute r (its direction depends on the direction of the +s-coordinate)
const double r_unsaturated = (d_theta_ >= 0.) ? radius_ - v.norm() : v.norm() - radius_;
// Saturate r within segment bounds.
const double r = maliput::drake::math::saturate(r_unsaturated, r_min, r_max);
const double r = std::clamp(r_unsaturated, r_min, r_max);

// Calculate the (uniform) road elevation.
// N.B. h is the geo z-coordinate referenced against the lane elevation (whose
// `a` coefficient is normalized by lane length).
const double h_unsaturated = geo_coordinate.z() - elevation().a() * l_max();
const double h = maliput::drake::math::saturate(h_unsaturated, height_bounds.min(), height_bounds.max());
const double h = std::clamp(h_unsaturated, height_bounds.min(), height_bounds.max());
return math::Vector3(p, r, h);
}

Expand Down
8 changes: 4 additions & 4 deletions src/maliput_multilane/line_road_curve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "maliput_multilane/line_road_curve.h"

#include <maliput/drake/math/saturate.h>
#include <algorithm>

namespace maliput {
namespace multilane {
Expand Down Expand Up @@ -59,13 +59,13 @@ math::Vector3 LineRoadCurve::ToCurveFrame(const math::Vector3& geo_coordinate, d

// Compute the distance from `q` to the start of the lane.
const double p_unsaturated = lane_origin_to_q.dot(s_unit_vector) / l_max();
const double p = maliput::drake::math::saturate(p_unsaturated, 0., 1.);
const double p = std::clamp(p_unsaturated, 0., 1.);
const double r_unsaturated = lane_origin_to_q.dot(r_unit_vector);
const double r = maliput::drake::math::saturate(r_unsaturated, r_min, r_max);
const double r = std::clamp(r_unsaturated, r_min, r_max);
// N.B. h is the geo z-coordinate referenced against the lane elevation (whose
// `a` coefficient is normalized by lane length).
const double h_unsaturated = geo_coordinate.z() - elevation().a() * l_max();
const double h = maliput::drake::math::saturate(h_unsaturated, height_bounds.min(), height_bounds.max());
const double h = std::clamp(h_unsaturated, height_bounds.min(), height_bounds.max());
return math::Vector3(p, r, h);
}

Expand Down
10 changes: 5 additions & 5 deletions src/maliput_multilane_test_utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ target_link_libraries(test_utilities
maliput::math
maliput_multilane
PRIVATE
maliput_drake::analysis
maliput_drake::common
maliput_drake::framework
maliput_drake::math
maliput_drake::trajectories
maliput::drake_common
maliput::drake_common_trajectories
maliput::drake_systems_analysis
maliput::drake_systems_framework
)


install(
TARGETS test_utilities
EXPORT ${PROJECT_NAME}-targets
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ macro(add_dependencies_to_test target)
target_link_libraries(${target}
maliput::api
maliput::common
maliput::drake_common
maliput::math
maliput_drake::common
maliput_multilane::maliput_multilane
maliput_multilane::test_utilities
)
Expand Down
11 changes: 5 additions & 6 deletions test/plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@ macro(add_dependencies_to_test target)
maliput_multilane::maliput_multilane
maliput::common
maliput::plugin
# maliput_drake is required because we include maliput_multilane/road_geometry.h to verify
# maliput::drake is required because we include maliput_multilane/road_geometry.h to verify
# the type of the loaded plugin. That requires other types to be imported as well which
# boils down up to road_curve.h.
maliput_drake::analysis
maliput_drake::common
maliput_drake::framework
maliput_drake::math
maliput_drake::trajectories
maliput::drake_common
maliput::drake_common_trajectories
maliput::drake_systems_analysis
maliput::drake_systems_framework
)
endif()
endmacro()
Expand Down

0 comments on commit c0294d7

Please sign in to comment.