Skip to content

Commit

Permalink
added launch file to launch urdf model and thruster viz (#15)
Browse files Browse the repository at this point in the history
* added launch file to launch urdf model and thruster viz

* removed unused imports
  • Loading branch information
EirikKolas authored Apr 14, 2024
1 parent cdcad7d commit d8f2ac8
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 21 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
Repo for visualizing our various data streams.

Includes:
- [Thruster Visualization](./thruster-visualization/README.md) - Visualizes thruster data (for Freya) in Foxglove Studio
- [URDF Models](./urdf-models/README.md) - Collection of 3D models that can be seen in Foxglove Studio
- [Foxglove Studio Parameter Extension](./foxglove-extensions/parameter-slider-extension/README.md) - Extension for Foxglove that lets you change node parameters more easily
12 changes: 12 additions & 0 deletions freya-visualization/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.8)
project(freya_visualization)

find_package(ament_cmake REQUIRED)

install(DIRECTORY
launch
config
DESTINATION share/${PROJECT_NAME}/
)

ament_package()
Empty file.
25 changes: 25 additions & 0 deletions freya-visualization/launch/freya_viz.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription

from launch.launch_description_sources import PythonLaunchDescriptionSource

def generate_launch_description():

freya_model_launch = IncludeLaunchDescription(
launch_description_source=PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory('urdf_models'), 'launch', 'freya_urdf.launch.py')
),
)

thruster_viz_launch = IncludeLaunchDescription(
launch_description_source=PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory('thruster_visualization'), 'launch', 'thruster_visualization.launch.py')
),
)

return LaunchDescription([
freya_model_launch,
thruster_viz_launch,
])
19 changes: 19 additions & 0 deletions freya-visualization/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>freya_visualization</name>
<version>0.0.0</version>
<description>Launch files for visualizing Freya</description>
<maintainer email="[email protected]">Eirik Kolås</maintainer>
<license>MIT</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<exec_depend>thruster_visualization</exec_depend>
<exec_depend>urdf_models</exec_depend>
<exec_depend>ros2launch</exec_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 10 additions & 20 deletions urdf-models/launch/freya_urdf.launch.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
import math

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution, TextSubstitution
from launch.actions import IncludeLaunchDescription
from launch.substitutions import PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare
from launch_ros.actions import Node

def generate_launch_description():
ld = LaunchDescription()
package_name = 'urdf_models'
urdf_default_path = PathJoinSubstitution(['urdf', 'freya', 'ASV_MainAssembly.urdf'])
urdf_path = PathJoinSubstitution(['urdf', 'freya', 'ASV_MainAssembly.urdf'])

# Declare the launch arguments (for this launch file)
urdf_package_path_launch_arg = DeclareLaunchArgument(
name='model',
default_value=urdf_default_path,
description='Path to robot urdf file relative to package'
)

# Include the launch description for the urdf launch file
# Include the launch description for the urdf launch file (separate package. Find it using rosdep)
urdf_launch_path = PathJoinSubstitution([FindPackageShare('urdf_launch'), 'launch', 'description.launch.py'])
urdf_launch = IncludeLaunchDescription(
launch_description_source=urdf_launch_path,
launch_arguments={
'urdf_package': package_name,
'urdf_package_path': LaunchConfiguration('model')
'urdf_package': 'urdf_models',
'urdf_package_path': urdf_path
}.items()
)

# base_link (NED) to base_link (SEU) tf. TODO: Move to asv_setup tf.launch.py
tf_base_link_ned_to_base_link_enu = Node(
# base_link (NED) to freya_model
tf_base_link_to_freya_model = Node(
package='tf2_ros',
executable='static_transform_publisher',
arguments=['--x' , '0',
Expand All @@ -39,11 +30,10 @@ def generate_launch_description():
'--pitch' , str(math.pi),
'--yaw' , '0',
'--frame-id' , 'base_link',
'--child-frame-id', 'base_link_SEU']
'--child-frame-id', 'freya_model']
)

return LaunchDescription([
urdf_package_path_launch_arg,
urdf_launch,
tf_base_link_ned_to_base_link_enu
tf_base_link_to_freya_model
])
2 changes: 1 addition & 1 deletion urdf-models/urdf/freya/ASV_MainAssembly.urdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<robot
name="ASV_MainAssembly">
<link
name="base_link_SEU">
name="freya_model">
<visual>
<origin
xyz="0 0 0"
Expand Down

0 comments on commit d8f2ac8

Please sign in to comment.