ros-controls / ros_controllers

Generic robotic controllers to accompany ros_control
http://wiki.ros.org/ros_control
BSD 3-Clause "New" or "Revised" License
557 stars 527 forks source link

Unexpected behavior in desired accelerations #578

Open mrunaljsarvaiya opened 2 years ago

mrunaljsarvaiya commented 2 years ago

We have a forked version of the joint_trajectory_controller that's modified to use the accelerations in the incoming joint trajectory. The desired trajectory looks fine (visualized via /state topic exposed by the controller) when the input trajectory is generated using moveit's trajectory generator. However, when we use another off the shelf trajectory generator, I see oscillations in the desired accelerations sampled by the trajectory controller. Below are pictures of the input to the trajectory controller and the desired accelerations picked up by the trajectory controller. Any idea what might be causing these oscillations? I've been looking through the code that samples the trajectory through quintic splines but I haven't caught anything yet.

Input Acceleration input_acc_profile

Desired accelerations sampled by the trajectory controller joint_trajectory_desired_acc

Hugal31 commented 2 years ago

I have the same issue using MoveIt! and the joint_trajectory_controller sampler (the QuinticSplineSegment). It seems the issue is more evident with MoveIt! trajectories trying to synchronize multiple joints. Note: the used Time parametrization in MoveIt! is the IterativeSplineParametrization.

I have attached the MoveIt! trajectory as a CSV, the resampled trajectory as a CSV, and a sample of C++ code I did to thinker with the sampler.

The following figure shows the MoveIt! pos, vel and acceleration trajectory for two joints (the smooth curves) and the resample trajectory.

sampled

The original trajectory: moveit_traj.csv The resampled trajectory: moveit_sampled.csv The code to resample it (build and run a.out movei_traj.csv): resample_code.zip

EDIT: I found the issue, it came from a custom time parametrization which modified incorrectly the original time parametrization.