Replace C++ Ruckig with pure C cruckig to fix RTAI builds#3884
Replace C++ Ruckig with pure C cruckig to fix RTAI builds#3884grandixximo wants to merge 1 commit intoLinuxCNC:masterfrom
Conversation
|
Fast review... You can not use standard libc includes (like f.ex. stddef and stdbool) or calls in your code. They only work in userland. You must use the RTAPI library because that was specifically created to work in both kernelland and userspace. BTW, have you tested whether you need to have the includes almost everywhere? F.ex. you include cruckig/profile.h, which includes stddef and stdbool and that gets included may other places that also include stddef and stdbool. I think you need to review whether or not includes are necessary or implicit by the use of other includes. Your include spec using Function Your diversion in include/cruckig/cruckig_compat.h is wrong. You must always thunk to Are you sure no memory allocations/frees are called dynamically? I see a lot of Thats it for a first glance... ;-) |
The C++ Ruckig library cannot compile in RTAI kernel space (no C++ in kernel modules). Replace it with cruckig, a pure C99 port that produces identical trajectories (validated to 5.9e-12 position error). - Vendor cruckig source (MIT license) from github.com/mika4128/cruckig - Rewrite ruckig_wrapper.c to use cruckig API (same ruckig_wrapper.h interface, zero changes needed in tp.c, tc.c, sp_scurve.c) - Add cruckig_compat.h for RTAPI kernel/userspace portability (rtapi_slab.h for malloc/free, rtapi_math.h for math functions) - Update Makefile and motion-logger Submakefile for C-only build - Remove C++ Ruckig source tree and ruckig_wrapper.cc Fixes: LinuxCNC#3875
Fixed. All handled through a single
Cleaned up. Removed redundant
Done. Flattened
Fixed.
Fixed. Removed the
Verified. The allocation pattern is init-only, not per-cycle:
The waypoint code path does have dynamic allocations, but LinuxCNC only uses single-segment planning, so those paths are never hit.
Thanks for the review! Force-pushed with all fixes applied. Build passes clean. |
|
Lets continue review then... Just a comment, you flattened the directory structure one level more than I suggested... This also works, so no prob. The double inclusion protection in cruckig.h is different from the others. You need to use You include cruckig_compat.h in both headers and c-files. That is double inclusion by definition and you should choose on cmethod consistently. So, you need to review your includes (again). Also, you'd normally include such a file as the first in the C-file followed by the include for the C-files. The alternative is to include the compat header consistently in the includes. You need to pick a method. You also need to consider what internal headers describe and what interface headers describe for linking against the code. You need to make a clean split and I'm not sure I'm seeing it. Or maybe I just cannot see the trees through the forest ;-) BTW, if cruckig_config.h is such an important universal include, then why is it not part of cruckig_compat.h? Then the name suffix "compat" is also a misnomer. Compatibility to what exactly is this code pretending to be? Maybe you don't need two include files? Just thinking out loud (well, writing out loud). That thought would result in a more natural split that (cleanly) exposes your API in cruckig.h and does your (dirty) internals in cruckig_internal.h (and then your local internal per-file headers). Why do you define In cruckig_compat.h you make distinction using In cruckig_config.h you have a comment at the beginning about optimization that makes no sense and has no actual content to go with the comment. Also, does anybody suggest that a test for You have a define for M_PI in roots.c (and In trajectory.c you have a conditional if 16 DOF to do allocation (line 206). If that is never hit, then why is there code to support it? Wouldn't it be simply safer to say that DOF <= 16 is the implementation limit? So far my second look. |
The C++ Ruckig library cannot compile in RTAI kernel space (no C++ in kernel modules). Replace it with cruckig, a pure C99 port that produces identical trajectories (validated to 5.9e-12 position error).
Fixes: #3875
Can someone try and see if it builds and work on RTAI?