Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,19 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
)
endif()

find_package(example-robot-data 4.0.9 REQUIRED)
ADD_PROJECT_DEPENDENCY(OpenMP REQUIRED)
ADD_PROJECT_DEPENDENCY(proxsuite REQUIRED)
ADD_PROJECT_DEPENDENCY(pinocchio REQUIRED)
ADD_PROJECT_DEPENDENCY(aligator REQUIRED)
ADD_PROJECT_DEPENDENCY(ndcurves REQUIRED)
include(dependencies.cmake)

# Main Library
file(GLOB mpc_SOURCE CONFIGURE_DEPENDS src/*.cpp)
file(GLOB mpc_HEADER CONFIGURE_DEPENDS include/${PROJECT_NAME}/*.hpp)

add_library(${PROJECT_NAME} SHARED ${mpc_HEADER} ${mpc_SOURCE})
target_include_directories(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
target_include_directories(
${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(
${PROJECT_NAME}
PUBLIC
Expand Down
28 changes: 28 additions & 0 deletions dependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
find_package(example-robot-data 4.0.9 REQUIRED)
ADD_PROJECT_DEPENDENCY(OpenMP REQUIRED)
ADD_PROJECT_DEPENDENCY(proxsuite REQUIRED)
ADD_PROJECT_DEPENDENCY(pinocchio REQUIRED)
ADD_PROJECT_DEPENDENCY(aligator REQUIRED)

function(get_ndcurves)
find_package(ndcurves QUIET)
if(NOT ndcurves_FOUND)
FetchContent_Declare(
ndcurves
GIT_REPOSITORY "https://github.com/loco-3d/ndcurves"
GIT_PROGRESS True
GIT_TAG devel
SYSTEM
EXCLUDE_FROM_ALL
)
set(PROJECT_CUSTOM_HEADER_DIR)
set(PROJECT_CUSTOM_HEADER_EXTENSION)
set(BUILD_PYTHON_INTERFACE OFF)
set(BUILD_TESTING OFF)
FetchContent_MakeAvailable(ndcurves)
add_library(ndcurves::ndcurves ALIAS ndcurves)
install(TARGETS ndcurves EXPORT ${TARGETS_EXPORT_NAME})
endif()
endfunction()

get_ndcurves()
23 changes: 8 additions & 15 deletions include/simple-mpc/foot-trajectory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
// All rights reserved.
///////////////////////////////////////////////////////////////////////////////

#ifndef SIMPLE_MPC_FOOTTRAJ_HPP_
#define SIMPLE_MPC_FOOTTRAJ_HPP_
#pragma once

#include "simple-mpc/fwd.hpp"
#include <ndcurves/fwd.h>
Expand All @@ -19,14 +18,11 @@ namespace simple_mpc
* @brief Foot trajectory generation
*/

typedef Eigen::Vector3d point3_t;
typedef ndcurves::bezier_curve<float, double, false, point3_t> curve_translation;
typedef ndcurves::piecewise_curve<float, double, false, point3_t> piecewise_curve;
using point3_t = Eigen::Vector3d;
using piecewise_curve = ndcurves::piecewise_curve<float, double, false, point3_t>;

class FootTrajectory
{
/**
*/
protected:
std::map<std::string, point3_t> initial_poses_;
std::map<std::string, point3_t> final_poses_;
Expand All @@ -38,18 +34,21 @@ namespace simple_mpc
size_t T_;

public:
FootTrajectory() {};
virtual ~FootTrajectory() {};
explicit FootTrajectory() {};
FootTrajectory(
const std::map<std::string, point3_t> & initial_poses, double swing_apex, int T_fly, int T_contact, size_t T);
virtual ~FootTrajectory() {};

void updateApex(double swing_apex)
{
swing_apex_ = swing_apex;
}

piecewise_curve defineTranslationBezier(const point3_t & trans_init, const point3_t & trans_final);

std::vector<point3_t> createTrajectory(
int time_to_land, point3_t & initial_trans, point3_t & final_trans, piecewise_curve trajectory_swing);

void updateTrajectory(
bool update,
int landing_time,
Expand All @@ -63,9 +62,3 @@ namespace simple_mpc
};

} // namespace simple_mpc

/* --- Details -------------------------------------------------------------- */
/* --- Details -------------------------------------------------------------- */
/* --- Details -------------------------------------------------------------- */

#endif // SIMPLE_MPC_HPP_
1 change: 1 addition & 0 deletions src/foot-trajectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

namespace simple_mpc
{
using curve_translation = ndcurves::bezier_curve<float, double, false, point3_t>;

FootTrajectory::FootTrajectory(
const std::map<std::string, point3_t> & initial_poses, double swing_apex, int T_fly, int T_contact, size_t T)
Expand Down