Skip to content

Resolved acceleration controller, second itr#469

Draft
urrsk wants to merge 3 commits intoUniversalRobots:masterfrom
urrsk:resolved_acceleration_controller_rsk
Draft

Resolved acceleration controller, second itr#469
urrsk wants to merge 3 commits intoUniversalRobots:masterfrom
urrsk:resolved_acceleration_controller_rsk

Conversation

@urrsk
Copy link
Copy Markdown
Member

@urrsk urrsk commented Mar 23, 2026

Restructured version of #450

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.97%. Comparing base (9c89565) to head (9f26a84).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #469      +/-   ##
==========================================
+ Coverage   76.89%   76.97%   +0.08%     
==========================================
  Files         110      110              
  Lines        5821     5820       -1     
  Branches     2576     2576              
==========================================
+ Hits         4476     4480       +4     
+ Misses       1006      998       -8     
- Partials      339      342       +3     
Flag Coverage Δ
start_ursim 83.08% <ø> (-1.53%) ⬇️
ur20-latest 72.27% <ø> (ø)
ur5-3.14.3 72.17% <ø> (-0.04%) ⬇️
ur5e-10.11.0 65.82% <ø> (-0.06%) ⬇️
ur5e-10.12.0 67.26% <ø> (+0.09%) ⬆️
ur5e-10.7.0 65.32% <ø> (ø)
ur5e-5.9.4 70.20% <ø> (-2.56%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@urrsk
Copy link
Copy Markdown
Member Author

urrsk commented Mar 23, 2026

@FilipposSot I have restructure your code. Please review and test this.

@urrsk urrsk force-pushed the resolved_acceleration_controller_rsk branch 3 times, most recently from 04301a8 to be9c3c1 Compare March 25, 2026 15:22
urrsk and others added 3 commits March 26, 2026 10:42
Extract the version-dependent direct_torque call logic from
torqueThread() into a standalone directTorqueControlCall(tau)
function. This allows reuse of the same logic in other control
threads without code duplication.
@urrsk urrsk force-pushed the resolved_acceleration_controller_rsk branch from be9c3c1 to 9f26a84 Compare March 26, 2026 09:43
Copy link
Copy Markdown

@FilipposSot FilipposSot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for incorporating this. I left my thoughts on the transformations which you added since my understanding is that these should not be necessary.

textmsg("ExternalControl: Starting resolved acceleration thread")
while control_mode == MODE_RESOLVED_ACCELERATION:
# We do the transformation in the tool flange frame.
local external_torque = transpose(get_jacobian(tcp=p[0,0,0,0,0,0])) * get_flange_wrench()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have taken a look at this and want to clarify a bit on the coordinate conventions since I am not sure this additional rotation is necessary from my understanding.

In my initial PR (#450) I am calculating external_torque = J_flange_in_base_frame^T * F_flange_in_base_frame

I have looked at the documentation and for each of J_flange_in_base_frame and F_flange_in_base_frame here is what I can conclude for each of the terms. There may be some misunderstanding on my end potentially.

J_flange_in_base_frame: get_jacobian is used but tcp should be specified as the identity (all zeros) so no offset from the robot flange. I had originally missed this detail. This is by default calculated with respect to the robot base frame (ie velocities measured in the robot base frame).

F_flange_in_base_frame: Here it seems to me that no additional rotation of the wrench is necessary from the output from get_tcp_force(). In particular reading the documentation I see “...the forces: Fx, Fy, and Fz in Newtons and the torques: TRx, TRy and TRz … are all measured at the tool flange with the orientation of the robot base coordinate system.” In other words it seems to me we don’t need to rotate the wrench.

This was both the J and F terms are both defined in the same frame.

In fact based on this assumption my original PR worked properly during my testing. In particular the controller was exerting forces opposing external disturbances (poking the tool, moving into contact).

while control_mode == MODE_RESOLVED_ACCELERATION:
# We do the transformation in the tool flange frame.
local external_torque = transpose(get_jacobian(tcp=p[0,0,0,0,0,0])) * get_flange_wrench()
local tau = get_mass_matrix(include_rotor_inertia=True) * cmd_acceleration + get_coriolis_and_centrifugal_torques() + external_torque
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sign of the external_torque term here should be negative. We need to cancel the external disturbances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants