Skip to content

[BUG] The compute_setpoint_control_signal() is throwing a runtime error when using the DQ_DifferentialDriveRobot #23

Open
@marcos-pereira

Description

@marcos-pereira

Bug description

  • The DQ_ClassicQPController compute_setpoint_control_signal() is throwing a runtime error when it is used with the DQ_DifferentialDriveRobot.

To Reproduce

Code

import numpy as np
from dqrobotics import *
from dqrobotics.robot_modeling import DQ_DifferentialDriveRobot
from dqrobotics.solvers import DQ_QuadprogSolver
from dqrobotics.robot_control import DQ_ClassicQPController, ControlObjective

def main():
    mobile_base = DQ_DifferentialDriveRobot(1, 1)

    qp_solver = DQ_QuadprogSolver()
    mobile_base_controller = DQ_ClassicQPController(mobile_base, qp_solver)
    mobile_base_controller.set_control_objective(ControlObjective.Pose)
    control_gain = 10.0
    mobile_base_controller.set_gain(control_gain)
    control_damping = 0.001
    mobile_base_controller.set_damping(control_damping)

    q = np.array([0.12, 0.0, 0.0])
    J = mobile_base.pose_jacobian(q)

    x_reference = 1.0
    y_reference = 1.0
    phi_reference = 0.0
    q_reference = np.array([x_reference, y_reference, phi_reference])
    print("q_reference")
    print(q_reference)
    task_reference = mobile_base.fkm(q_reference)

    u_qdot = mobile_base_controller.compute_setpoint_control_signal(q, vec8(task_reference))


if __name__ == '__main__':

    main()

Output

q_reference
[1. 1. 0.]
Traceback (most recent call last):
  File "issues.py", line 36, in <module>
    main()
  File "issues.py", line 31, in main
    u_qdot = mobile_base_controller.compute_setpoint_control_signal(q, vec8(task_reference))
RuntimeError: DQ_DifferentialDriveRobot::pose_jacobian(q,to_link) only accepts to_link in {0,1}.

Expected behavior

  • The compute_setpoint_control_signal() should return an array containing the control signal.

Environment:

  • OS: Ubuntu 18.04
  • dqrobotics version 20.4.0.26
  • Python version 3.6.9

Additional context

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions