gz-sim icon indicating copy to clipboard operation
gz-sim copied to clipboard

Write a tutorial about using transport parameters with systems

Open scpeters opened this issue 1 year ago • 1 comments

Desired behavior

A new feature was added in https://github.com/gazebosim/gz-transport/pull/305 to declare and use parameters. An interface to this functionality was added for gz-sim systems in https://github.com/gazebosim/gz-sim/pull/1431, with a demo in the parameters-component-wheel-slip-demo6 branch and https://github.com/gazebosim/gz-msgs/commit/e19f8e5dddd27106ef874cccd38590b65acd81f0. This demo should be merged to a release branch along with a tutorial.

Alternatives considered

Implementation suggestion

Demo instructions from #305:

Steps to run the demo:

  • Build from source ignition fortress checking out the two branches specified above (I can provide PRs for another version if needed).
  • Launch the trisphere cycle world:
    ign gazebo trisphere_cycle_wheel_slip.sdf
    
  • In another terminal with the workspace sourced:
    • List available parameters:

      ign param -r /world/wheel_slip -l
      
      Expected output

      systems.wheel_slip.trisphere_cycle1.wheel_front [ignition.msgs.WheelSlipParameters] systems.wheel_slip.trisphere_cycle1.wheel_rear_right [ignition.msgs.WheelSlipParameters] systems.wheel_slip.trisphere_cycle0.wheel_rear_right [ignition.msgs.WheelSlipParameters] systems.wheel_slip.trisphere_cycle1.wheel_rear_left [ignition.msgs.WheelSlipParameters] systems.wheel_slip.trisphere_cycle0.wheel_rear_left [ignition.msgs.WheelSlipParameters] systems.wheel_slip.trisphere_cycle0.wheel_front [ignition.msgs.WheelSlipParameters]

    • Get the systems.wheel_slip.trisphere_cycle1.wheel_front parameter:

      ign param -r /world/wheel_slip -g -n systems.wheel_slip.trisphere_cycle1.wheel_front
      
      Expected output

      Getting parameter [systems.wheel_slip.trisphere_cycle1.wheel_front] for registry namespace [/world/wheel_slip]... Parameter type [ign_msgs.WheelSlipParameters]


      slip_compliance_lateral: 1 slip_compliance_longitudinal: 1

    • Set the systems.wheel_slip.trisphere_cycle1.wheel_front parameter to a different value:

      ign param -r /world/wheel_slip -s -n systems.wheel_slip.trisphere_cycle1.wheel_front -t ign_msgs.WheelSlipParameters -m "
        slip_compliance_lateral: 1
        slip_compliance_longitudinal: 2"
      
      Expected output

      Setting parameter [systems.wheel_slip.trisphere_cycle1.wheel_front] for world [wheel_slip]...

      Parameter successfully set!

    • Get the systems.wheel_slip.trisphere_cycle1.wheel_front parameter again, its value should have changed:

      ign param -r /world/wheel_slip -g -n systems.wheel_slip.trisphere_cycle1.wheel_front
      
      Expected output

      Getting parameter [systems.wheel_slip.trisphere_cycle1.wheel_front] for registry namespace [/world/wheel_slip]... Parameter type [ign_msgs.WheelSlipParameters]


      slip_compliance_lateral: 1 slip_compliance_longitudinal: 2

Additional context

scpeters avatar Dec 21 '22 21:12 scpeters