ami-iit / bipedal-locomotion-framework

Suite of libraries for achieving bipedal locomotion on humanoid robots

Home Page:https://ami-iit.github.io/bipedal-locomotion-framework/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LD fails if `BipedalLocomotion::ContinuousDynamicalSystem::CentroidalDynamics::setControlInput` is used

GiulioRomualdi opened this issue · comments

I've created a separate application outside the project where I try to call BipedalLocomotion::ContinuousDynamicalSystem::CentroidalDynamics::setControlInput however when I tried to compile I got the following linking error

/usr/bin/ld: CMakeFiles/test.dir/test.cpp.o: in function `main':
test.cpp:(.text+0xdf): undefined reference to `BipedalLocomotion::ContinuousDynamicalSystem::CentroidalDynamics::setControlInput(BipedalLocomotion::GenericContainer::named_tuple<BipedalLocomotion::GenericContainer::named_param<5902450104467380426ul, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, BipedalLocomotion::Contacts::DiscreteGeometryContact, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, BipedalLocomotion::Contacts::DiscreteGeometryContact> > > >, BipedalLocomotion::GenericContainer::named_param<7575707358851770354ul, std::optional<BipedalLocomotion::Math::Wrench<double> > > > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/test.dir/build.make:112: test] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/test.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

This is the application

cpp

#include <BipedalLocomotion/ContinuousDynamicalSystem/CentroidalDynamics.h>
#include <BipedalLocomotion/ContinuousDynamicalSystem/ForwardEuler.h>
#include <BipedalLocomotion/Math/Wrench.h>
#include <BipedalLocomotion/Contacts/Contact.h>
#include <chrono>

using namespace std::chrono_literals;

template <typename _Dynamics> struct DynamicsAndIntegrator
{
    std::shared_ptr<BipedalLocomotion::ContinuousDynamicalSystem::ForwardEuler<_Dynamics>> integrator;
    std::shared_ptr<_Dynamics> dynamics;
};

int main()
{
    using namespace BipedalLocomotion::ContinuousDynamicalSystem;

    DynamicsAndIntegrator<BipedalLocomotion::ContinuousDynamicalSystem::CentroidalDynamics>
        m_centroidalSystem;

    BipedalLocomotion::Math::Wrenchd wrench;
    std::map<std::string, BipedalLocomotion::Contacts::DiscreteGeometryContact> contacts;
    m_centroidalSystem.dynamics->setControlInput({contacts, wrench});

    return 0;
}

Cmake

cmake_minimum_required(VERSION 3.22)

project(test)

find_package(BipedalLocomotionFramework REQUIRED)

add_executable(test test.cpp)

target_link_libraries(test
                  BipedalLocomotion::ContinuousDynamicalSystem
                  BipedalLocomotion::Math
                  BipedalLocomotion::GenericContainer)

This does not happen with the other classes defined in ContinuousDynamicalSystem

After removing all the installed packages in blf and recompiling again blf the problem got solved.