pantor / ruckig

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

How to use Ruckig in C++11 #28

Closed personal-fork-robot closed 3 years ago

personal-fork-robot commented 3 years ago

I want to use Ruckig in C++11,and when i build the package,some error occurs.Here are some questions and solutions.

I've done the following:

  1. Using std::optional in a C++11 context:use this header: optional .It is the equivalent of std::optional.When I finished this, it don 't make any mistakes about "std::optional"

  2. lambda auto parameters. https://github.com/pantor/ruckig/blob/5ad83c019b35960294efd04387b8ed3cd9210763/include/ruckig/block.hpp#L89 I replaced [](auto& a, auto& b)with [](const Profile& a, const Profile& b), and it successfully passed.

If it have any unknown questions and hidden errors, please let me know.Thx!

pantor commented 3 years ago

Hi @personal-fork-robot,

Ruckig makes use of several C++17 features, but I don't think that there would be some hidden errors. If it compiles in C++11, it should be fine! Please note that I really recommend a compiler supporting C++17, so perhaps it's easier to update the compiler before downgrading Ruckig?

Following steps come to my mind:

Feel free to complement this list if I forgot something.

personal-fork-robot commented 3 years ago

Thank you for your quick feedback @pantor . Those are the only two problems I've had for the time being,and if constexpr just results in some warnnings in C++11 but not error. Maybe I'll deal with those warnings later, but for now it doesn't affect the program very much.

pantor commented 3 years ago

Just one remark: if constexpr is a C++17 feature. However, as with all modern C++ features, its support depends on the exact compiler version.

pantor commented 3 years ago

There is now a script for patching Ruckig for C++11.

personal-fork-robot commented 3 years ago

Thx a lot:)