forked from Field-Robotics-Lab/dave
-
Notifications
You must be signed in to change notification settings - Fork 2
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
[GSOC-95] Custom ros_gz bridge for DVL plugin #14
Merged
Changes from 10 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
16e7a5d
add dvl sensor example
hmoyen 58beeb6
fix material issues
hmoyen 58f5708
fix material issues
hmoyen 6c3b0b1
Added a custom ros-gz bridge for DVL messages
rakeshv24 95c7eb0
Moved DVLBridge plugin to model.sdf and added a feature of importing …
rakeshv24 803a43e
added dvl plugin to nortek500. TODO: fix water_tracking
rakeshv24 18e0cf1
Added multiple dvl sensors and modified top-level launch files
rakeshv24 4c347aa
added mutex lock
rakeshv24 66e20f7
1. Fixed reference frame conversion: East-North-Up -> Forward-Starboa…
rakeshv24 8da8463
precommit changes
rakeshv24 1c073e1
Update roll, pitch, yaw arguements and DVL types in the code
rakeshv24 4c2c9dc
Updated DVL to stay static in the environment
rakeshv24 07cc5fa
updated example in README
rakeshv24 f3b7176
adjust initial camera position
woensug-choi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
std_msgs/Header header | ||
string type | ||
DVLTarget target | ||
geometry_msgs/TwistWithCovariance velocity | ||
DVLBeam[] beams |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
int64 id | ||
string reference | ||
float64 range | ||
bool locked | ||
geometry_msgs/TwistWithCovariance velocity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
string type | ||
float64 range |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
from launch import LaunchDescription | ||
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, OpaqueFunction | ||
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution, TextSubstitution | ||
from launch.launch_description_sources import PythonLaunchDescriptionSource | ||
from launch.conditions import IfCondition | ||
from launch_ros.substitutions import FindPackageShare | ||
|
||
|
||
def launch_setup(context, *args, **kwargs): | ||
paused = LaunchConfiguration("paused").perform(context) | ||
gui = LaunchConfiguration("gui").perform(context) | ||
use_sim_time = LaunchConfiguration("use_sim_time").perform(context) | ||
headless = LaunchConfiguration("headless").perform(context) | ||
verbose = LaunchConfiguration("verbose").perform(context) | ||
namespace = LaunchConfiguration("namespace").perform(context) | ||
world_name = LaunchConfiguration("world_name").perform(context) | ||
x = LaunchConfiguration("x").perform(context) | ||
y = LaunchConfiguration("y").perform(context) | ||
z = LaunchConfiguration("z").perform(context) | ||
roll = LaunchConfiguration("roll").perform(context) | ||
pitch = LaunchConfiguration("pitch").perform(context) | ||
yaw = LaunchConfiguration("yaw").perform(context) | ||
use_ned_frame = LaunchConfiguration("use_ned_frame").perform(context) | ||
|
||
if world_name != "empty.sdf": | ||
world_filename = f"{world_name}.world" | ||
world_filepath = PathJoinSubstitution( | ||
[FindPackageShare("dave_worlds"), "worlds", world_filename] | ||
).perform(context) | ||
gz_args = [world_filepath] | ||
else: | ||
gz_args = [world_name] | ||
|
||
if headless == "true": | ||
gz_args.append("-s") | ||
if paused == "false": | ||
gz_args.append("-r") | ||
if verbose == "true": | ||
gz_args.append("--verbose") | ||
|
||
gz_args_str = " ".join(gz_args) | ||
|
||
gz_sim_launch = IncludeLaunchDescription( | ||
PythonLaunchDescriptionSource( | ||
[ | ||
PathJoinSubstitution( | ||
[ | ||
FindPackageShare("ros_gz_sim"), | ||
"launch", | ||
"gz_sim.launch.py", | ||
] | ||
) | ||
] | ||
), | ||
launch_arguments=[ | ||
("gz_args", TextSubstitution(text=gz_args_str)), | ||
], | ||
condition=IfCondition(gui), | ||
) | ||
|
||
object_launch = IncludeLaunchDescription( | ||
PythonLaunchDescriptionSource( | ||
[ | ||
PathJoinSubstitution( | ||
[ | ||
FindPackageShare("dave_object_models"), | ||
"launch", | ||
"upload_object.launch.py", | ||
] | ||
) | ||
] | ||
), | ||
launch_arguments={ | ||
"gui": gui, | ||
"use_sim_time": use_sim_time, | ||
"namespace": namespace, | ||
"x": x, | ||
"y": y, | ||
"z": z, | ||
"roll": roll, | ||
"pitch": pitch, | ||
"yaw": yaw, | ||
"use_ned_frame": use_ned_frame, | ||
}.items(), | ||
) | ||
|
||
return [gz_sim_launch, object_launch] | ||
|
||
|
||
def generate_launch_description(): | ||
|
||
args = [ | ||
DeclareLaunchArgument( | ||
"paused", | ||
default_value="true", | ||
description="Start the simulation paused", | ||
), | ||
DeclareLaunchArgument( | ||
"gui", | ||
default_value="true", | ||
description="Flag to enable the gazebo gui", | ||
), | ||
DeclareLaunchArgument( | ||
"use_sim_time", | ||
default_value="true", | ||
description="Flag to indicate whether to use simulation time", | ||
), | ||
DeclareLaunchArgument( | ||
"headless", | ||
default_value="false", | ||
description="Flag to enable the gazebo headless mode", | ||
), | ||
DeclareLaunchArgument( | ||
"verbose", | ||
default_value="false", | ||
description="Enable verbose mode for Gazebo simulation", | ||
), | ||
DeclareLaunchArgument( | ||
"world_name", | ||
default_value="empty.sdf", | ||
description="Gazebo world file to launch", | ||
), | ||
DeclareLaunchArgument( | ||
"namespace", | ||
default_value="", | ||
description="Namespace", | ||
), | ||
DeclareLaunchArgument( | ||
"x", | ||
default_value="0.0", | ||
description="Initial x position", | ||
), | ||
DeclareLaunchArgument( | ||
"y", | ||
default_value="0.0", | ||
description="Initial y position", | ||
), | ||
DeclareLaunchArgument( | ||
"z", | ||
default_value="0.0", | ||
description="Initial z position", | ||
), | ||
DeclareLaunchArgument( | ||
"roll", | ||
default_value="0.0", | ||
description="Initial roll angle", | ||
), | ||
DeclareLaunchArgument( | ||
"pitch", | ||
default_value="0.0", | ||
description="Initial pitch angle", | ||
), | ||
DeclareLaunchArgument( | ||
"yaw", | ||
default_value="0.0", | ||
description="Initial yaw angle", | ||
), | ||
DeclareLaunchArgument( | ||
"use_ned_frame", | ||
default_value="false", | ||
description="Flag to indicate whether to use the north-east-down frame", | ||
), | ||
] | ||
|
||
return LaunchDescription(args + [OpaqueFunction(function=launch_setup)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
from launch import LaunchDescription | ||
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, OpaqueFunction | ||
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution, TextSubstitution | ||
from launch.launch_description_sources import PythonLaunchDescriptionSource | ||
from launch.conditions import IfCondition | ||
from launch_ros.substitutions import FindPackageShare | ||
|
||
|
||
def launch_setup(context, *args, **kwargs): | ||
paused = LaunchConfiguration("paused").perform(context) | ||
gui = LaunchConfiguration("gui").perform(context) | ||
use_sim_time = LaunchConfiguration("use_sim_time").perform(context) | ||
headless = LaunchConfiguration("headless").perform(context) | ||
verbose = LaunchConfiguration("verbose").perform(context) | ||
namespace = LaunchConfiguration("namespace").perform(context) | ||
world_name = LaunchConfiguration("world_name").perform(context) | ||
x = LaunchConfiguration("x").perform(context) | ||
y = LaunchConfiguration("y").perform(context) | ||
z = LaunchConfiguration("z").perform(context) | ||
roll = LaunchConfiguration("roll").perform(context) | ||
pitch = LaunchConfiguration("pitch").perform(context) | ||
yaw = LaunchConfiguration("yaw").perform(context) | ||
use_ned_frame = LaunchConfiguration("use_ned_frame").perform(context) | ||
|
||
if world_name != "empty.sdf": | ||
world_filename = f"{world_name}.world" | ||
world_filepath = PathJoinSubstitution( | ||
[FindPackageShare("dave_worlds"), "worlds", world_filename] | ||
).perform(context) | ||
gz_args = [world_filepath] | ||
else: | ||
gz_args = [world_name] | ||
|
||
if headless == "true": | ||
gz_args.append("-s") | ||
if paused == "false": | ||
gz_args.append("-r") | ||
if verbose == "true": | ||
gz_args.append("--verbose") | ||
|
||
gz_args_str = " ".join(gz_args) | ||
|
||
gz_sim_launch = IncludeLaunchDescription( | ||
PythonLaunchDescriptionSource( | ||
[ | ||
PathJoinSubstitution( | ||
[ | ||
FindPackageShare("ros_gz_sim"), | ||
"launch", | ||
"gz_sim.launch.py", | ||
] | ||
) | ||
] | ||
), | ||
launch_arguments=[ | ||
("gz_args", TextSubstitution(text=gz_args_str)), | ||
], | ||
condition=IfCondition(gui), | ||
) | ||
|
||
sensor_launch = IncludeLaunchDescription( | ||
PythonLaunchDescriptionSource( | ||
[ | ||
PathJoinSubstitution( | ||
[ | ||
FindPackageShare("dave_sensor_models"), | ||
"launch", | ||
"upload_sensor.launch.py", | ||
] | ||
) | ||
] | ||
), | ||
launch_arguments={ | ||
"gui": gui, | ||
"use_sim_time": use_sim_time, | ||
"namespace": namespace, | ||
"x": x, | ||
"y": y, | ||
"z": z, | ||
"roll": roll, | ||
woensug-choi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"pitch": pitch, | ||
"yaw": yaw, | ||
"use_ned_frame": use_ned_frame, | ||
}.items(), | ||
) | ||
|
||
return [gz_sim_launch, sensor_launch] | ||
|
||
|
||
def generate_launch_description(): | ||
|
||
args = [ | ||
DeclareLaunchArgument( | ||
"paused", | ||
default_value="true", | ||
description="Start the simulation paused", | ||
), | ||
DeclareLaunchArgument( | ||
"gui", | ||
default_value="true", | ||
description="Flag to enable the gazebo gui", | ||
), | ||
DeclareLaunchArgument( | ||
"use_sim_time", | ||
default_value="true", | ||
description="Flag to indicate whether to use simulation time", | ||
), | ||
DeclareLaunchArgument( | ||
"headless", | ||
default_value="false", | ||
description="Flag to enable the gazebo headless mode", | ||
), | ||
DeclareLaunchArgument( | ||
"verbose", | ||
default_value="false", | ||
description="Enable verbose mode for Gazebo simulation", | ||
), | ||
DeclareLaunchArgument( | ||
"world_name", | ||
default_value="empty.sdf", | ||
description="Gazebo world file to launch", | ||
), | ||
DeclareLaunchArgument( | ||
"namespace", | ||
default_value="", | ||
description="Namespace", | ||
), | ||
DeclareLaunchArgument( | ||
"x", | ||
default_value="0.0", | ||
description="Initial x position", | ||
), | ||
DeclareLaunchArgument( | ||
"y", | ||
default_value="0.0", | ||
description="Initial y position", | ||
), | ||
DeclareLaunchArgument( | ||
"z", | ||
default_value="0.0", | ||
description="Initial z position", | ||
), | ||
DeclareLaunchArgument( | ||
"roll", | ||
default_value="0.0", | ||
description="Initial roll angle", | ||
), | ||
DeclareLaunchArgument( | ||
"pitch", | ||
default_value="0.0", | ||
description="Initial pitch angle", | ||
), | ||
DeclareLaunchArgument( | ||
"yaw", | ||
default_value="0.0", | ||
description="Initial yaw angle", | ||
), | ||
DeclareLaunchArgument( | ||
"use_ned_frame", | ||
default_value="false", | ||
description="Flag to indicate whether to use the north-east-down frame", | ||
), | ||
] | ||
|
||
return LaunchDescription(args + [OpaqueFunction(function=launch_setup)]) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just found out that the launch argument
roll
,pitch
,yaw
does not work. It has to beR
,P
,Y
. We should modify from line 80-82, 20-22, and any other launch.py that uses this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@woensug-choi I just tried launching with all the arguements and seems to work fine. I used the following command:
ros2 launch dave_demos dave_sensor.launch.py namespace:=nortek_dvl500_300 world_name:=dvl_world paused:=false x:=0 y:=1.2 z:=-20 roll:=1.57 pitch:=0.0 yaw:=0.0 headless:=false gui:=true verbose:=true paused:=false
roll
,pitch
, andyaw
are in radians.I'm not sure why it does not work for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it worked for you. never mind for this PR (as it is not critically related to this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, you are right. It should be R, R, Y.
I'll make the changes! Thanks for pointing that out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange!
ros2 launch dave_demos dave_sensor.launch.py namespace:=nortek_dvl500_300 world_name:=dvl_world paused:=false x:=0 y:=1.2 z:=-20 roll:=1.57 pitch:=0.0 yaw:=0.0 headless:=false gui:=true verbose:=true paused:=false
works find on ubuntu native install machine but causes context error in Mac. (again, if it's only mac problem. ignore for sake of this PR).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange! It works fine for me both on ubuntu native and mac.
@woensug-choi do you think the problem could be coming from here?
I have committed some changes. Please check if the error still occurs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rakeshv24 Yes it seems... but don't know why...!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@woensug-choi it seems that the problem can be resolved by properly shutting down the node. But since this actually does not hinder with the functionality of the code, we can maybe resolve it later. What do you think?