UT-Austin-RPL / deoxys_control

A modular, real-time controller library for Franka Emika Panda robots
Apache License 2.0
140 stars 20 forks source link

How to combine this controller with motion planner? #9

Closed xwinks closed 10 months ago

xwinks commented 10 months ago

How do I combine the controller with some motion planner? When I use the osc controller to move the robot to a far point, it would be inaccuracy. However, when I apply the generated trajectory with the joint controller, although this motion is accurate, the control is not smooth, I wonder how to solve this problem.

I would appreciate it if you could help me.

zhuyifengzju commented 10 months ago

Hi, If you are using motion planning, I suggest using a joint impedance controller (with rigid configuration instead of the compliant version), which will make robots follow a sequence of joints. But also make sure that you compute a sequence of joints that respect the smoothness (for example, the computed trajectory should be at least smooth in its second derivatives).

xwinks commented 10 months ago

Thank you for your response. I've experimented with the joint impedance controller and observed that while it results in a smooth trajectory, it introduces an end-effector error of at least 2cm in the z-axis, potentially due to gravitational effects. The reason our trajectory isn't smooth when using the joint controller is that it brings the velocity to zero at the desired joint position, which is incompatible with the joint position sequences generated by our motion planner. We've had success using the jointVelController in libfranka, but unfortunately, there doesn't seem to be an option to control the joint velocity in Deoxys(

zhuyifengzju commented 10 months ago

Thanks for the information. I won't be available to implement a new wrapper for the jointVelController callback since I am full with other ongoing projects. If you would like to implement a new control loop and make a PR before I have time to do this, it would be super appreciated. Anyway, in case you want to quickly include jointVelController in deoxys (whether you want to make PR or not), here is a note I made myself (didn't get a chance to update the documentation) about places to make changes:

1. add header file of your controller to include/controllers/
2. add the source file of your controller to Src/controllers/
3. CMakeLists (Find the line with comment “  # Add your new controller files here”
4. Add protobuf message for the controller, following convention to other c ontroller.
5. Add a new controller_type in franka_interface.py
6. Add a controller_config for your own controller.
7. Update the control node (`franka_control_node.py`)
    a. function GetTrajInterpolatorType
    b. function GetControllerType 
    c. Add the new controller and the new interpolator in `control_msg_sub` 
    d. Update switch-case about resetting trajctory interpolator
    e. Update main_loop to decide which control loop to use given specified controller type
xwinks commented 10 months ago

Thanks for this guidance. You are so kind to provide such detailed suggestions. I would try this way recently.

zhuyifengzju commented 10 months ago

Re-open the issue if any further discussions are needed.