-
Notifications
You must be signed in to change notification settings - Fork 280
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
Add example about using joint control components #2728
base: gz-sim9
Are you sure you want to change the base?
Conversation
Signed-off-by: Steve Peters <[email protected]>
@@ -0,0 +1,82 @@ | |||
/* | |||
* Copyright (C) 2024 Open Source Robotics Foundation |
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.
* Copyright (C) 2024 Open Source Robotics Foundation | |
* Copyright (C) 2025 Open Source Robotics Foundation |
## Build | ||
|
||
~~~ | ||
cd examples/plugin/reset_plugin |
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.
cd examples/plugin/reset_plugin | |
cd examples/plugin/joint_control_components |
<!-- This example uses the ResetJointVelocityNearPosition to reset the joint | ||
velocity to a positive value when it is near the stable equilibrium | ||
position. The joint appears to bounce upward near the bottom of its | ||
swing. |
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.
also mention PulseJointVelocityCommand
?
@@ -0,0 +1,19 @@ | |||
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) | |||
|
|||
project(BouncePlugins) |
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.
JointControlPlugins?
🎉 New feature
Demonstrate issues with joint control
Summary
I was struggling to use both
JointVelocityCmd
andJointVelocityReset
components when controlling joints until I noticed the following comment in src/systems/physics/Physics.cc:To demonstrate this interaction I created two example plugins:
ResetJointVelocityNearPosition
: this plugin sets theJointVelocityReset
component to a fixed value when the measured joint position is near a trigger
position. This can create a bouncing behavior of a pendulum if the trigger
position is the bottom stable equilibrium.
PulseJointVelocityCommand
: this plugin applies pulses of joint velocitycommands as a square wave with a specified time period between pulses.
The example world includes three pendulum models:
ResetJointVelocityNearPosition
with a trigger position at the downward stable eqilibrium point. This exhibits
a bouncing behavior.
PulseJointVelocityCommand
.It starts out stationary, then alternates between moving at constant velocity
and swinging passively.
of constant velocity alternating with passive swinging and bouncing at the
bottom.
Screen capture with dartsim:
example_joint_control_commands_dartsim.mov
Screen capture with dartsim without setting JointForceCmd
If you comment out PulseJointVelocityCommand.cc:67 which sets the
JointForceCmd
component to0
during the inactive portion of the pulse, the velocity controller remains active with a velocity command of0
.example_joint_control_commands_dartsim_without_force_cmd.mov
Bullet
There is an issue with bullet-featherstone; I will file that separately.
Test it
Follow the instructions in the example README to compile and run the examples
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.