Closed hugols16 closed 3 years ago
Hi! The input state leads to an inevitable velocity violation of joint 3, as the limited jerk cannot decelerate fast enough. We can calculate the maximum velocity solely based on the current velocity, current acceleration and maximum jerk to
(3 a0^2)/(2 jMax) + v0 = 2.5914.
In general, jerk limited trajectories might violate velocity limits in the future, although all values are within bounds. Ruckig currently doesn't output an error in this case, it just calculates the time-optimal trajectory to get within the limits as fast as possible. Then, the usual time-optimal trajectory towards the target state is generated.
However, I'm not understanding the -100 result when using the next output as input. Doing a quick check on my system shows that it works fine, and that is what I expect Ruckig to do.
You're right, the next result isn't -100 because when validating the input, Ruckig only checks that the target is within bounds. However, violating bounds to reach a target can have negative consequences on a robotic system. The arm could either be lacking behind the trajectory, creating an increasing deviation, or the arm could simply reject the command throw a limits violation fault. Does this mean that with the current state of Ruckig, there is no way to guarantee that the output will always be within the limits as long as the result is either Working or Finished?
Yeah, this is a very fundamental problem of jerk-limited trajectory generation. For instance, when the current velocity and acceleration are both at their respective maxima, every jerk-constrained trajectory will violate the velocity in the future. For this reason it is the task of the user to make sure that the initial kinematic state is and will be within the bounds (in particular for online trajectory generation).
To make that easier, Ruckig should add a method to check and validate the current state for future violations. I'm thinking about a strict mode for the validate_input method, e.g. ruckig.validate_input(input, strict=true)
. As long as this method would return true, Ruckig is able to guarantee that the trajectory will be within the limits. What do you think of that solution?
Just to make sure: These inevitable velocity violations are only because of the initial state, and only happen during a time-optimal braking trajectory to get within the bounds as fast as possible. In particular, the Ruckig Community Version and Ruckig Pro do not violate any limits outside this braking-trajectory.
With the latest commit, this can now be checked using
ruckig.validate_input(input, true, true);
that checks both the input and target state for constraint violations. Please find more information in the updated Readme.
Given an InputParameter with current and target values within the kinematic limits, Ruckig seems to produce an OutputParameter with values that violate limits. Below are the values used for this simple test:
Joint 3 violates velocity limits with an output value of 2.5838 even though the input velocity is 2.58052 and the velocity limit is 2.58309. This may be due to an infeasible target, but shouldn't Ruckig fail in that case, instead of violating limits? When passing the output to the input, the next update will then raise a -100 result (InvalidInput).