0
$\begingroup$

Rosanswers logo

Hello there,

I am not able to decrease the speed of my real robot. If I am decreasing the speed from RVIZ by setting Velecoty Scaling and Accel Scaling then it is working fine. If I am giving the robot a trajectory from python code then it very fast does anyone have an idea of how can I be able to solve this issue?

I have tried few things:

  1. By using set_max_velocity_scaling_factor and set_max_acceleration_scaling_factor function as maintained in following post.

    move_group = moveit_commander.MoveGroupCommander(group_name) move_group.set_max_velocity_scaling_factor(0.01) move_group.set_max_acceleration_scaling_factor(0.01)

  2. I have updated default_velocity_scaling_factor and default_acceleration_scaling_factor to 0.01 in joint_limits.yaml file.


Originally posted by Ranjit Kathiriya on ROS Answers with karma: 1622 on 2021-04-15

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

in case of computeCartesianPath(..) there is no support for scaling velocities/accelerations. You can control the speed by using retime_trajectory(..):

        waypoints = getMyWaypoints()

        (plan, fraction) = group.compute_cartesian_path(
            waypoints,
            0.01,
            0.0
        )
        plan = group.retime_trajectory(moveit_commander.RobotCommander().get_current_state(), 
                                       plan, 
                                       velocity_scaling_factor)
        group.execute(plan, wait=True)

Originally posted by crnewton with karma: 71 on 2021-04-15

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by Ranjit Kathiriya on 2021-04-15:
Thanks! it works

Comment by lorepieri on 2021-05-27:
moveit_robot_state = moveit_commander.RobotCommander().get_current_state()

Comment by lorepieri on 2021-05-27:
Also speed is actually the speed scaling factor.

Comment by crnewton on 2021-05-31:
Updated my answer to be more generic. as @lorepieri commented.

Comment by robra on 2023-02-28:
Hi, do you know how to implement this in c++? I looked into the MoveGroupInterface class here here but couldn't find a retime_trajectory function

Comment by Jiang Zizhen on 2023-04-18:
retime_trajectory is only available in rospy, no corresponding function in cpp

Comment by robra on 2023-04-19:
Thanks, but just for reference, time parameterization can be implemented in c++ using the corresponding classes here and therefore the retime_trajectory is not needed in c++

Comment by Jiang Zizhen on 2023-04-19:
hi, how to use it, could you please give a template code!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.