pbio/trajectory_ext: wrapper around patch
The patch function for angle based commands is nearly identical, so add a wrapper that allows its code to be shared.
#include <pbio/math.h>
#include <pbio/trajectory.h>
-pbio_error_t pbio_trajectory_make_time_based_patched(pbio_trajectory_t *ref, bool forever, int32_t t0, int32_t t3, int32_t wt, int32_t wmax, int32_t a) {
+static pbio_error_t pbio_trajectory_patch(pbio_trajectory_t *ref, bool time_based, bool forever, int32_t t0, int32_t t3, int32_t th3, int32_t wt, int32_t wmax, int32_t a) {
// Get current reference point and acceleration, which will be the 0-point for the new trajectory
int32_t th0;
@@ -68,3 +68,7 @@ pbio_error_t pbio_trajectory_make_time_based_patched(pbio_trajectory_t *ref, boo
return PBIO_SUCCESS;
}
}
+
+pbio_error_t pbio_trajectory_make_time_based_patched(pbio_trajectory_t *ref, bool forever, int32_t t0, int32_t t3, int32_t wt, int32_t wmax, int32_t a) {
+ return pbio_trajectory_patch(ref, true, forever, t0, t3, 0, wt, wmax, a);
+}
