-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from launch import LaunchDescription | ||
from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument | ||
from launch.launch_description_sources import PythonLaunchDescriptionSource | ||
from launch.substitutions import ThisLaunchFileDir, LaunchConfiguration | ||
from launch_ros.actions import Node | ||
|
||
def generate_launch_description(): | ||
# Declare launch arguments for the serial port and baud rate | ||
declare_serial_port_arg = DeclareLaunchArgument( | ||
'serial_port', | ||
default_value='//dev/ttySERIAL', # Default value, replace if needed | ||
description='Serial port for micro-ROS agent' | ||
) | ||
|
||
declare_serial_baudrate_arg = DeclareLaunchArgument( | ||
'serial_baudrate', | ||
default_value='576000', # Default baud rate, replace if needed | ||
description='Baud rate for serial communication' | ||
) | ||
|
||
# Retrieve launch configurations | ||
serial_port = LaunchConfiguration('serial_port') | ||
serial_baudrate = LaunchConfiguration('serial_baudrate') | ||
|
||
# Node configuration for micro-ROS agent | ||
microros_agent_node = Node( | ||
package='micro_ros_agent', | ||
executable='micro_ros_agent', | ||
arguments=['serial', '-D', serial_port, '-b', serial_baudrate], | ||
output='screen' | ||
) | ||
|
||
# Include bringup.launch.py | ||
bringup_launch = IncludeLaunchDescription( | ||
PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/bringup.launch.py']) | ||
) | ||
|
||
return LaunchDescription([ | ||
declare_serial_port_arg, | ||
declare_serial_baudrate_arg, | ||
microros_agent_node, | ||
bringup_launch | ||
]) |