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

Example ROS bridge for electro-hydraulic PTO #13

Merged
merged 2 commits into from
Apr 25, 2022
Merged

Conversation

chapulina
Copy link
Contributor

Here's an example launch file that loads the electro-hydraulic PTO world and exposes all the Gazebo topics to ROS.

Try it out

Launch the world:

ros2 launch buoy_gazebo electrohydraulic_pto.launch.py

Check that topics are available with ROS:

$ ros2 topic list
/battcurr_HydraulicRam
/deltaP_HydraulicRam
/loadcurr_HydraulicRam
/model/Hydraulics_Test/joint/HydraulicRam/BiasCurrent
/model/Hydraulics_Test/joint/HydraulicRam/RetractFactor
/model/Hydraulics_Test/joint/HydraulicRam/ScaleFactor
/model/Hydraulics_Test/joint/HydraulicRam/UserCommandedCurr
/parameter_events
/pistonvel_HydraulicRam
/retractfactor_HydraulicRam
/rosout
/rpm_HydraulicRam
/scalefactor_HydraulicRam
/targwindcurr_HydraulicRam
/windcurr_HydraulicRam

Listen to a topic with ROS, for example:

$ ros2 topic echo /loadcurr_HydraulicRam                                              
data: 2.2142660968671457e-15                                                                                                                
---                                                                                                                                         
data: -4.370744217940814e-15                                                                                                                
---                                                                                                                                         
data: 8.880699994828767e-16                                                                                                                 
---                                                                                                                                         
data: 2.0216033708164716e-15                                                                                                                
---                                                                                                                                         
data: 4.3921030007387785e-16

Publish to a topic with ROS, for example:

$ ros2 topic pub --once /model/Hydraulics_Test/joint/HydraulicRam/UserCommandedCurr std_msgs/msg/Float64 "{data: 3}"
publisher: beginning loop
publishing #1: std_msgs.msg.Float64(data=3.0)

[parameter_bridge-2] [INFO] [1650325732.031830191] [ros_ign_bridge]: Passing message from ROS std_msgs/msg/Float64 to Ignition ignition.msgs.Double (showing msg only once per type)
[ign gazebo-1] ## Adjusting UserCommanded Current 3

Open question

I'm not sure if we're planning to expose the same topics for all worlds, or different worlds will expose different topics. Some things we may want to do:

  • compose a launch file of smaller ones - for example, we could have:
    • Launch file to bridge the electro-hydraulic PTO
    • Launch file to bridge the pneumatic spring
    • Other launch files for other components
    • A top-level launch file that includes the others based on parameters
  • make the model and joint names configurable as launch parameters

@chapulina chapulina requested a review from andermi April 18, 2022 23:53
@chapulina chapulina self-assigned this Apr 19, 2022
@andermi
Copy link
Collaborator

andermi commented Apr 21, 2022

I could see loading plugins a la carte for a general use, configurable product of which MBARI's is a specific implementation. It would be nice to easily launch individual plugins for testing in isolation (or superposition) when modeling.

Copy link
Collaborator

@andermi andermi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Signed-off-by: Louise Poubel <[email protected]>
@chapulina
Copy link
Contributor Author

It would be nice to easily launch individual plugins for testing in isolation (or superposition) when modeling.

I'll open a separate PR breaking this apart 👍🏽

@chapulina chapulina merged commit bef906d into main Apr 25, 2022
@chapulina chapulina deleted the chapulina/bridge branch April 25, 2022 22:31
@chapulina
Copy link
Contributor Author

It would be nice to easily launch individual plugins for testing in isolation (or superposition) when modeling.

andermi added a commit that referenced this pull request Jul 13, 2022
Signed-off-by: Michael Anderson <[email protected]>
andermi added a commit that referenced this pull request Jul 26, 2022
* Setup profiler

Signed-off-by: Louise Poubel <[email protected]>

* first pass at cleanup / optimization

Signed-off-by: Michael Anderson <[email protected]>

* colcon test

Signed-off-by: Michael Anderson <[email protected]>

* magic number

Signed-off-by: Michael Anderson <[email protected]>

* update documentation

Signed-off-by: Michael Anderson <[email protected]>

* documentation; whitespace tweaks; status todo

Signed-off-by: Michael Anderson <[email protected]>

* copy spring controller and ignore build for now

Signed-off-by: Michael Anderson <[email protected]>

* documentation

Signed-off-by: Michael Anderson <[email protected]>

* WIP; need to fix build; COLCON_IGNORE not being honored by cmake directory crawling

Signed-off-by: Michael Anderson <[email protected]>

* fixed compile

Signed-off-by: Michael Anderson <[email protected]>

* added PCRecord publishing; added PCWindCurrCommand service

Signed-off-by: Michael Anderson <[email protected]>

* added scale factor

Signed-off-by: Michael Anderson <[email protected]>

* colcon test

Signed-off-by: Michael Anderson <[email protected]>

* added retract and bias current

Signed-off-by: Michael Anderson <[email protected]>

* PR comments

Signed-off-by: Michael Anderson <[email protected]>

* remove status stuff in this PR

Signed-off-by: Michael Anderson <[email protected]>

* fix command timeouts

Signed-off-by: Michael Anderson <[email protected]>

* fix build

Signed-off-by: Michael Anderson <[email protected]>

* add noop controller

Signed-off-by: Michael Anderson <[email protected]>

* remove unused

Signed-off-by: Michael Anderson <[email protected]>

* colcon test

Signed-off-by: Michael Anderson <[email protected]>

* add pytest via launch

Signed-off-by: Michael Anderson <[email protected]>

* running gtest, gtest with ros and launch, gtest with pytest and launch

Signed-off-by: Michael Anderson <[email protected]>

* gitignore __pycache__

Signed-off-by: Michael Anderson <[email protected]>

* unit tests pass

Signed-off-by: Michael Anderson <[email protected]>

* putting the pytest in launch.py for now

Signed-off-by: Michael Anderson <[email protected]>

* start with valve

Signed-off-by: Michael Anderson <[email protected]>

* added launch; added bounds for valve; added pump test and tweaked sdf

Signed-off-by: Michael Anderson <[email protected]>

* use text fixture

Signed-off-by: Michael Anderson <[email protected]>

* fix pump test iterations; test status flags for valve

Signed-off-by: Michael Anderson <[email protected]>

* add pump status checking; add comments

Signed-off-by: Michael Anderson <[email protected]>

* fix for #13

Signed-off-by: Michael Anderson <[email protected]>

* tests pass; fix uncrustify

Signed-off-by: Michael Anderson <[email protected]>

* added pytest version of SC Pump command test

Signed-off-by: Michael Anderson <[email protected]>

* add dependencies

Signed-off-by: Michael Anderson <[email protected]>

* try to wait for /clock to complete before comparing sim and node clock

Signed-off-by: Michael Anderson <[email protected]>

* allow /clock to finish publish before compare

Signed-off-by: Michael Anderson <[email protected]>

* extending test timeout in CMakeLists.txt seems to let tests pass in CI

Signed-off-by: Michael Anderson <[email protected]>

* trying larger timeout

Signed-off-by: Michael Anderson <[email protected]>

* keep trying to fix timeouts

Signed-off-by: Michael Anderson <[email protected]>

* increase to absurd timeout

Signed-off-by: Michael Anderson <[email protected]>

* add minimal pytest for ignition.gazebo.TestFixture

Signed-off-by: Michael Anderson <[email protected]>

* put timeouts back to reasonable value

Signed-off-by: Michael Anderson <[email protected]>

* find a way around using ignition.gazebo.TestFixture for python tests

Signed-off-by: Michael Anderson <[email protected]>

* increase launch_test timeout for CI

Signed-off-by: Michael Anderson <[email protected]>

* CI computers are slow :(

Signed-off-by: Michael Anderson <[email protected]>

* adding valve launch_testing pytest; had to split test to re-run fixture_server

Signed-off-by: Michael Anderson <[email protected]>

* flake

Signed-off-by: Michael Anderson <[email protected]>

* Update sc_commands_ros_feedback.launch.py

Increase timeout

Co-authored-by: Louise Poubel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants