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

gazebo_static_camera: use param instead of file #174

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
# and limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
import tempfile
from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, ExecuteProcess
from launch.substitutions import LaunchConfiguration
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration, Command
from launch.substitutions.path_join_substitution import PathJoinSubstitution

from launch_ros.actions import Node
Expand Down Expand Up @@ -53,14 +52,10 @@ def generate_launch_description():
update_rate = LaunchConfiguration('update_rate')
image_width = LaunchConfiguration('image_width')
image_height = LaunchConfiguration('image_height')
camera_sdf = tempfile.NamedTemporaryFile(prefix='gazebo_static_camera_', suffix='.sdf', delete=False)

x, y, z = LaunchConfiguration('x'), LaunchConfiguration('y'), LaunchConfiguration('z')
roll, pitch, yaw = LaunchConfiguration('roll'), LaunchConfiguration('pitch'), LaunchConfiguration('yaw')

camera_sdf_xacro = ExecuteProcess(
cmd=['xacro', '-o', camera_sdf.name, ['update_rate:=', update_rate], ['image_width:=', image_width], ['image_height:=', image_height], PathJoinSubstitution([gazebo_static_camera_dir, 'models', 'camera.sdf.xacro'])])

camera_bridge = Node(
package='ros_gz_bridge',
executable='parameter_bridge',
Expand Down Expand Up @@ -96,12 +91,13 @@ def generate_launch_description():
'-R', roll,
'-P', pitch,
'-Y', yaw,
'-file', camera_sdf.name],
'-param', 'robot_description'],
parameters=[{
'robot_description': Command(['xacro ', 'update_rate:=', update_rate, ' image_width:=', image_width, ' image_height:=', image_height, ' ', PathJoinSubstitution([gazebo_static_camera_dir, "models", "camera.sdf.xacro"])])}],
output='screen'
)

ld = LaunchDescription(ARGUMENTS)
ld.add_action(camera_sdf_xacro)
ld.add_action(camera_bridge)
ld.add_action(spawn_camera)
return ld