Closed AndyZe closed 1 year ago
Vectors instead of arrays actually do compile. Again, I don't know if this will run:
size_t num_dof = 6; // for example. This is not known at compile time
std::vector<double> new_position(num_dof);
std::vector<double> new_velocity(num_dof);
std::vector<double> new_acceleration(num_dof);
ruckig_trajectory.at_time(time_from_start, new_position, new_velocity, new_acceleration);
OK, I got it working :)
size_t num_dof = 6; // for example. This is not known at compile time
ruckig::Trajectory<ruckig::DynamicDOFs, ruckig::StandardVector> ruckig_trajectory(num_dof);
ruckig_result = ruckig.calculate(ruckig_input, ruckig_trajectory);
...
std::vector<double> new_position(num_dof);
std::vector<double> new_velocity(num_dof);
std::vector<double> new_acceleration(num_dof);
ruckig_trajectory.at_time(time_from_start, new_position, new_velocity, new_acceleration);
Yes, this looks good. I've now added the sentence
This switches the default Vector from the
std::array
to the dynamicstd::vector
type.
to the Readme to clarify this.
I was playing with the offline trajectory planner, like in this example: https://github.com/pantor/ruckig/blob/master/examples/2_position_offline.cpp
It works great if the DOF can be hard-coded like in the example:
But with MoveIt, we don't know the num DOF until runtime.
This compiles, I'm not sure it will run, though:
ruckig::Trajectory<ruckig::DynamicDOFs, ruckig::StandardVector> ruckig_trajectory(ruckig::DynamicDOFs);
And I struggle with what to do here, since arrays can't be dynamically sized: