-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SW-2049] ability to stream joint gains through hardware interface #588
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Pull Request Test Coverage Report for Build 13526106956Details
💛 - Coveralls |
04c33fc
to
a80e374
Compare
b9c0919
to
61b56f5
Compare
61b56f5
to
7390aab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks about right. Need a controller to test.
Signed-off-by: Katie Hughes <khughes-bdai@theaiinstitute.com>
Signed-off-by: Katie Hughes <khughes-bdai@theaiinstitute.com>
f2b6813
to
749ed00
Compare
merging this in now as i verified that the user interface stays the same, will keep working on the follow up controller separately |
for (size_t i = 0; i < njoints_; i++) { | ||
// copy over current position, velocity, and load from state to current command | ||
hw_commands_[command_interfaces_per_joint_ * i] = hw_states_[state_interfaces_per_joint_ * i]; | ||
hw_commands_[command_interfaces_per_joint_ * i + 1] = hw_states_[state_interfaces_per_joint_ * i + 1]; | ||
hw_commands_[command_interfaces_per_joint_ * i + 2] = hw_states_[state_interfaces_per_joint_ * i + 2]; | ||
// Fill in k_q_p and k_qd_p gains from the initial_value field from the URDF | ||
const auto& joint = info_.joints.at(i); | ||
hw_commands_[command_interfaces_per_joint_ * i + 3] = std::stof(joint.command_interfaces.at(3).initial_value); | ||
hw_commands_[command_interfaces_per_joint_ * i + 4] = std::stof(joint.command_interfaces.at(4).initial_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we could replace the hard-coded offsets with pos_offset = 0, vel_offset = 1, load_offset = 2, ...
to make it easier to parse and don't assume or rely on remembering a known order in the code.
joint_commands_.load.at(i) = hw_commands_[command_interfaces_per_joint_ * i + 2]; | ||
joint_commands_.k_q_p.at(i) = hw_commands_[command_interfaces_per_joint_ * i + 3]; | ||
joint_commands_.k_qd_p.at(i) = hw_commands_[command_interfaces_per_joint_ * i + 4]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the constants defined for the offsets, all these lines will not rely on a specific ordering.
Change Overview
Adds k_q_p and k_qd_p to the command interface of Spot's hardware interface.These get set to an initial value via the
initial_value
field from the URDF, so existing logic here in the hardware interface to parse this input has been removed in favor of this new method. Existing controllers will not need to change anything, as they simply don't claim the interface.The following PR in the stack will set up a controller to allow users to easily change this at runtime.
This PR also depends on the changes from bdaiinstitute/spot_description#3 to expose these new command interfaces in the URDF.
Testing Done
The default behavior from the user interface does not change with this PR.
\