Add joint velocity readings (client-side differentiation) - #2
Draft
mmmarinho wants to merge 1 commit into
Draft
Conversation
FRI does not transmit joint velocities, so estimate them by differentiating the measured joint positions at the FRI send period (robotState().getSampleTime()). The differentiator keeps its own previous-position buffer, unwraps +-pi joint jumps, guards against non-finite samples, and applies a 1-pole low-pass (10 Hz) to damp finite-difference noise. Wiring respects the existing sas_robot_driver interface: - LBRJointCommandOverlayClient gains get_measured_joint_velocities() (mirrors get_measured_joint_torques()). - RobotDriverKuka overrides the base RobotDriver::get_joint_velocities() virtual (whose default throws) and delegates to the client. - The sas_robot_driver_ros control loop already calls get_joint_velocities() and send_joint_states() already fills JointState.velocity, so velocities now flow through the existing /joint_states topic without framework changes. This PR was created by an AI agent (OpenHands) on behalf of the user. Co-authored-by: openhands <openhands@all-hands.dev>
mmmarinho
commented
Aug 18, 2026
| previous_joint_values_for_velocity_ = q; | ||
|
|
||
| // First-order low-pass to tame the noise inherent in a finite difference. | ||
| const double alpha = 2.0 * M_PI * kFilterCutoffHz * dt / |
Contributor
Author
There was a problem hiding this comment.
Don’t think this filter makes much sense, will come back to this at some point.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FRI does not transmit joint velocities (the monitoring message carries only measured/commanded positions and torques). This PR adds joint velocity readings by differentiating the measured joint positions at the FRI send period, entirely on the driver/external-PC side. No cabinet/app changes required.
How it works
LBRJointCommandOverlayClientnow differentiatesgetMeasuredJointPosition()on eachcommand()call, usingrobotState().getSampleTime()(the configured FRI period, e.g. 1 ms) as Δt.command()updatingmeasured_joint_values_),get_measured_joint_velocities()mirrors the existingget_measured_joint_torques().Interface respected (sas_robot_driver)
No framework changes were needed:
RobotDriverKukaoverrides the baseRobotDriver::get_joint_velocities()virtual (whose default throws "Not implemented yet.") and delegates to the client.sas_robot_driver_roscontrol loop already callsget_joint_velocities()(in atry/catch) andRobotDriverServer::send_joint_states()already fillssensor_msgs/JointState.velocitywhen non-empty. So velocities now flow through the existing/joint_statestopic with no changes tosas_robot_driver.Verification
murilomarinho/sas:jazzy(colcon build, exit 0). Only pre-existing deprecation warnings (unrelated).nmthatsas::RobotDriverKuka::get_joint_velocities()override and the client getter are linked intolibsas_robot_driver_kuka.so.Notes / caveats
$SQregister (both require app-side work).This PR was created by an AI agent (OpenHands) on behalf of the user.