pantor / ruckig

Motion Generation for Robots and Machines. Real-time. Jerk-constrained. Time-optimal.
https://ruckig.com
MIT License
635 stars 155 forks source link

The problem encountered when using a class template with Ruckig. #169

Closed Sunfury2333 closed 9 months ago

Sunfury2333 commented 10 months ago

When I define it this way, it gives an error. Why is that?

namespace trajectory {

template <size_t mdof>
class velprofile_ruckig
{
private:
    ruckig::InputParameter<mdof> input;
    ruckig::Ruckig<mdof> otg;
    ruckig::Trajectory<mdof> ruckig_traj;
}

This is the compiler error message

include/ruckig/calculator_target.hpp:260: undefined reference to `ruckig::BrakeProfile::get_velocity_brake_trajectory(double, double, double, double)'
include/ruckig/calculator_target.hpp:273: undefined reference to `ruckig::PositionStep1::PositionStep1(double, double, double, double, double, double, double, double, double, double, double)'
include/ruckig/calculator_target.hpp:274: undefined reference to `ruckig::PositionStep1::get_profile(ruckig::Profile const&, ruckig::Block&)'
include/ruckig/calculator_target.hpp:277: undefined reference to `ruckig::VelocityStep1::VelocityStep1(double, double, double, double, double, double, double)'
include/ruckig/calculator_target.hpp:278: undefined reference to `ruckig::VelocityStep1::get_profile(ruckig::Profile const&, ruckig::Block&)'
include/ruckig/calculator_target.hpp:420: undefined reference to `ruckig::PositionStep2::PositionStep2(double, double, double, double, double, double, double, double, double, double, double, double)'
include/ruckig/calculator_target.hpp:421: undefined reference to `ruckig::PositionStep2::get_profile(ruckig::Profile&)'
include/ruckig/calculator_target.hpp:424: undefined reference to `ruckig::VelocityStep2::VelocityStep2(double, double, double, double, double, double, double, double)'
include/ruckig/calculator_target.hpp:425: undefined reference to `ruckig::VelocityStep2::get_profile(ruckig::Profile&)'
pantor commented 9 months ago

Are you sure that you are linking Ruckig when compiling your example, and that the library can be found?

Sunfury2333 commented 9 months ago

Yes, I am sure. When I initialized it with const int mdof = 6, there is no problem. But when I modify it as described above, it throws the error.

pantor commented 9 months ago

Can you provide a minimal example to reproduce this?

Note that all the examples, in particular https://github.com/pantor/ruckig/blob/master/examples/09_dynamic_dofs.cpp, compile just fine in CI.

Sunfury2333 commented 9 months ago

Thank you very much for your response. I believe I have identified the issue now. I apologize for bothering you and thank you for your time.