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

WorldControl service bridge error in 2.2 #666

Closed
alexdrc00 opened this issue May 31, 2023 · 5 comments · Fixed by #668
Closed

WorldControl service bridge error in 2.2 #666

alexdrc00 opened this issue May 31, 2023 · 5 comments · Fixed by #668

Comments

@alexdrc00
Copy link

Hello this is more of a call for help, in version 2.1 in order to work with the step, pause and set entity pose function I wanted to bridge the world control and set entity pose services and managed to do it with the same approach as in the following SpawnEntity, DeleteEntity, SetPose Services #363 issue in the ros_gz git (I believe WorldControl has already been incorporated to ros_gz main so only set pose would be required now) and modifying as follows the last lines of code in vrx_gz/src/vrx_gz/launch.py (not the most elegant solution I know but got the job done):

arguments = [bridge.argument() for bridge in bridges]
remaps = [bridge.remapping() for bridge in bridges]

arguments.append('/world/sydney_regatta/control@ros_gz_interfaces/srv/ControlWorld')
remaps.append(('/world/sydney_regatta/control', '/world/sydney_regatta/control'))

arguments.append('/world/sydney_regatta/set_pose@ros_gz_interfaces/srv/SetEntityPose')
remaps.append(('/world/sydney_regatta/set_pose', '/world/sydney_regatta/set_pose'))

nodes = []
nodes.append(Node(
    package='ros_gz_bridge',
    executable='parameter_bridge',
    output='screen',
    arguments=arguments,
    remappings=remaps,
))
return nodes`

The thing is now that I have pulled the latest version 2.2 of vrx I am facing an issue not being able to call the service more than once since it crashes in the second call. I have no idea what could be causing this so I would appreciate greatly anyone's help! Attached below are the logs right after the second call of the service:

image

@alexdrc00
Copy link
Author

Closing. I noticed by echoing with the sim stopped the /vrx/debug/wind/speed topic that it was the new implementation of USVWInd.cc what was causing the physics engine to crash. It was outputting nan in the topic when the simulation was stopped as it was obtaining a dT (delta time) of zero and trying to calculate new values generating a division by zero. A simple if statement to skip the new calculations when dT is very low or zero seems to fix the problem for now.

@M1chaelM
Copy link
Collaborator

M1chaelM commented Jun 5, 2023

@j-herman FYI. Does the USVWind plugin know to respect the "pause" state?

@j-herman
Copy link
Collaborator

j-herman commented Jun 5, 2023

@j-herman FYI. Does the USVWind plugin know to respect the "pause" state?

Whoops, missing a line! See PR 668

@M1chaelM M1chaelM reopened this Jun 5, 2023
@M1chaelM
Copy link
Collaborator

M1chaelM commented Jun 5, 2023

@alexdrc00 Could you test PR #668 and see whether this change eliminates the crash that you are currently working around?

@alexdrc00
Copy link
Author

@alexdrc00 Could you test PR #668 and see whether this change eliminates the crash that you are currently working around?

Yep, no crash so far with that approach everything good!

@M1chaelM M1chaelM linked a pull request Jun 20, 2023 that will close this issue
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 a pull request may close this issue.

3 participants