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

Use a global synchronized wavefield #598

Merged
merged 11 commits into from
Mar 9, 2023
Merged

Use a global synchronized wavefield #598

merged 11 commits into from
Mar 9, 2023

Conversation

caguero
Copy link
Contributor

@caguero caguero commented Feb 27, 2023

Fixes #564 using Gazebo Transport.

Before this patch, all the plugins using a wave field needed to have the same <wavefield> SDF parameter block in its SDF plugin definition. This pull request changes this behavior by:

  • Setting one of the plugins to operate as the primary. The primary plugin requires to specify all the <wavefield> parameters as usual. Then, it should periodically publish the wavefield parameters via Transport.
  • The rest of the plugins should be set to operate as secondary. This means passing only one parameters inside the <wavefield> block. This parameters is the topic name where the wave field parameters are sent. When received, the wavefield can be populated with a new helper function.

Our WaveVisual plugin is set to operate as the primary. All the instances of Surface and PolyhedreaBuoyancyDrag plugins are set to operate as secondary.

How to test it?

  • You can run the simulation as usual:
ros2 launch vrx_gz competition.launch.py world:=stationkeeping_task

and verify that the buoys and the WAM-V move a bit up and down.

  • You can modify vrx_gz/worlds/stationkeeping_task.sdf:
    <!-- The wave field -->
    <plugin filename="libPublisherPlugin.so" name="vrx::PublisherPlugin">
      <message type="gz.msgs.Param" topic="/vrx/wavefield/parameters"
               every="2.0">
...
        params {
          key: "gain"
          value {
            type: DOUBLE
            double_value: 0.1
          }
        }
...
      </message>
    </plugin>

Recompile and launch the simulation again. You should verify now that the WAM-V and the buoys stay flat at the water surface.
[Edit: updated test instructions]

Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
@caguero caguero requested a review from M1chaelM February 27, 2023 21:36
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
@caguero
Copy link
Contributor Author

caguero commented Mar 8, 2023

@M1chaelM , as we discussed offline, I've created a PublishPlugin to publish the wave field parameters every 2 seconds. All worlds in this PR use this plugin now. This is good to go for a review.

caguero added 2 commits March 8, 2023 21:24
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
@caguero caguero merged commit 6363e56 into main Mar 9, 2023
@caguero caguero deleted the caguero/global_wavefield branch March 9, 2023 21:17
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.

Wavefield parameters are set in too many places
2 participants