petercorke / robotics-toolbox-python

Robotics Toolbox for Python
MIT License
1.97k stars 418 forks source link

Inquiry about Tau Calculation in Robotics Control using CasADi #432

Open tommasoandina1 opened 2 months ago

tommasoandina1 commented 2 months ago

Hi everyone,

I hope you're all doing well. I'm currently working on a robotics control project using Python and the CasADi library. I have some doubts regarding the calculation of tau, especially in determining the actual joint positions compared to the desired ones.

I'm wondering if anyone could provide some guidance on how to approach this challenge. Specifically, I'm unsure whether it's more appropriate to use a forward kinematics law to estimate the real joint positions or if I should opt for more complex simulations. My goal is to strike a balance between computational efficiency and control precision.

Additionally, I'm unsure how to determine the values of ( q_{\text{des}} ) (desired joint position) and ( q ) (actual joint position). Should I use trajectory planning algorithms or rely on sensor feedback for ( q )?

I'm using the following equations in my project:

  1. The equation to solve for joint acceleration (ddq) is:

    ddq = M^-1(tau - h)

    Where:

    • M is the mass matrix,
    • h are the bias forces, and
    • tau are the joint torques.
  2. The joint torques (tau) are calculated using a proportional-derivative (PD) control law:

    tau = Kp(q_des - q) - Kd*dq

    Where:

    • Kp and Kd are the proportional and derivative gains respectively,
    • q_des is the desired joint position,
    • q is the actual joint position, and
    • dq is the actual joint velocity.

I would greatly appreciate any insights, suggestions, or references to relevant resources that could help me tackle this issue effectively.

Thank you very much in advance for your assistance!

https://github.com/tommasoandina1/Doosan_h2515/edit/main/doosan_h25215.py

tommasoandina1 commented 2 months ago

and I know that q_next = q + dt dq dq_next = dq + dt ddq