Skip to content
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

Open
wants to merge 4 commits into
base: gz-sim9
Choose a base branch
from

Conversation

scpeters
Copy link
Member

🎉 New feature

Demonstrate issues with joint control

Summary

I was struggling to use both JointVelocityCmd and JointVelocityReset components when controlling joints until I noticed the following comment in src/systems/physics/Physics.cc:

        // Only set joint velocity if joint force is not set.
        // If both the cmd and reset components are found, cmd is ignored.

To demonstrate this interaction I created two example plugins:

  • ResetJointVelocityNearPosition: this plugin sets the JointVelocityReset
    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 velocity
    commands as a square wave with a specified time period between pulses.

The example world includes three pendulum models:

  • On the far left, the pendulum has only the ResetJointVelocityNearPosition
    with a trigger position at the downward stable eqilibrium point. This exhibits
    a bouncing behavior.
  • On the far right, the pendulum has only the PulseJointVelocityCommand.
    It starts out stationary, then alternates between moving at constant velocity
    and swinging passively.
  • In the center, the pendulum has both plugins enabled and experiences pulses
    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 to 0 during the inactive portion of the pulse, the velocity controller remains active with a velocity command of 0.

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

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

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.

* Copyright year
* Example cmake project name
* Missing includes
* Typo in example cd command
* Whitespace

Signed-off-by: Steve Peters <[email protected]>
@j-rivero
Copy link
Contributor

@osrf-jenkins run tests

@j-rivero
Copy link
Contributor

@osrf-jenkins run tests

The CI for Windows is using the new Conda jobs, the -clowin postfix means that we are using the platfrom Conda Legacy Ogre23 (Conda with the legacy environment but using ogre-2.3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏛️ ionic Gazebo Ionic
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

4 participants