update: launch file working

This commit is contained in:
Björn Ellensohn 2023-04-18 11:04:28 +02:00
parent 3e18bfe87d
commit b6c3e18b0d
4 changed files with 87 additions and 24 deletions

81
launch/robot.launch.py Normal file
View File

@ -0,0 +1,81 @@
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.substitutions import LaunchConfiguration
from launch.actions import DeclareLaunchArgument
# def generate_launch_description():
# return LaunchDescription([
# Node(
# package='segwayrmp',
# #namespace='turtlesim1',
# executable='SmartCar',
# name='SmartCar',
# output='screen'
# ),
# Node(
# package='joy',
# #namespace='turtlesim2',
# executable='joy_node',
# name='joy_teleop',
# output='screen'
# ),
# Node(
# package='rmp220_teleop',
# executable='rmp220_teleop',
# name='rmp220_teleop',
# # remappings=[
# # ('/input/pose', '/turtlesim1/turtle1/pose'),
# # ('/output/cmd_vel', '/turtlesim2/turtle1/cmd_vel'),
# # ]
# output='screen'
# )
# ])
def generate_launch_description():
use_sim_time = LaunchConfiguration('use_sim_time')
#joy_params = os.path.join(get_package_share_directory('rmp220_teleop'))
joy_node = Node(
package='joy',
executable='joy_node',
#parameters=[joy_params, {'use_sim_time': use_sim_time}],
)
teleop_node = Node(
package='rmp220_teleop',
executable='rmp220_teleop',
name='rmp220_teleop',
#parameters=[joy_params, {'use_sim_time': use_sim_time}],
#remappings=[('/cmd_vel','/cmd_vel_joy')]
)
control_node = Node(
package='segwayrmp',
executable='SmartCar',
name='SmartCar',
#parameters=[joy_params, {'use_sim_time': use_sim_time}],
#remappings=[('/cmd_vel','/cmd_vel_joy')]
)
# twist_stamper = Node(
# package='twist_stamper',
# executable='twist_stamper',
# parameters=[{'use_sim_time': use_sim_time}],
# remappings=[('/cmd_vel_in','/diff_cont/cmd_vel_unstamped'),
# ('/cmd_vel_out','/diff_cont/cmd_vel')]
# )
return LaunchDescription([
DeclareLaunchArgument(
'use_sim_time',
default_value='false',
description='Use sim time if true'),
joy_node,
teleop_node,
control_node,
# twist_stamper
])

View File

@ -1,24 +0,0 @@
<launch>
<!-- Start the segwayrmp SmartCar node -->
<node
pkg="segwayrmp"
type="SmartCar"
name="SmartCar"
output="screen"/>
<!-- Start the joy_teleop node -->
<node
pkg="joy"
type="joy_teleop"
name="joy_teleop"
output="screen"/>
<!-- Start the rmp220_teleop.py node -->
<node
pkg="rmp220_teleop"
type="rmp220_teleop.py"
name="rmp220_teleop"
output="screen"/>
</launch>

View File

@ -10,6 +10,8 @@
<depend>rclpy</depend> <depend>rclpy</depend>
<depend>segway_msgs</depend> <depend>segway_msgs</depend>
<exec_depend>ros2launch</exec_depend>
<test_depend>ament_copyright</test_depend> <test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend> <test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend> <test_depend>ament_pep257</test_depend>

View File

@ -1,4 +1,6 @@
from setuptools import setup from setuptools import setup
import os
from glob import glob
package_name = 'rmp220_teleop' package_name = 'rmp220_teleop'
@ -10,6 +12,7 @@ setup(
('share/ament_index/resource_index/packages', ('share/ament_index/resource_index/packages',
['resource/' + package_name]), ['resource/' + package_name]),
('share/' + package_name, ['package.xml']), ('share/' + package_name, ['package.xml']),
(os.path.join('share', package_name), glob('launch/*.launch.py')),
], ],
install_requires=['setuptools'], install_requires=['setuptools'],
zip_safe=True, zip_safe=True,
@ -23,4 +26,5 @@ setup(
'rmp220_teleop = rmp220_teleop.rmp220_teleop:main' 'rmp220_teleop = rmp220_teleop.rmp220_teleop:main'
], ],
}, },
) )