Skip to content

Commit

Permalink
C++ and Python Reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcalderon03 committed Jan 27, 2024
1 parent cc89987 commit c96c284
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 59 deletions.
24 changes: 15 additions & 9 deletions urc_bringup/launch/bringup.launch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription, SetEnvironmentVariable, DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration, Command, FindExecutable, PathJoinSubstitution
from launch.actions import IncludeLaunchDescription
from launch.actions import SetEnvironmentVariable
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration, Command, FindExecutable
from launch.substitutions import PathJoinSubstitution
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
from launch.launch_description_sources import PythonLaunchDescriptionSource
Expand All @@ -10,12 +13,14 @@

def generate_launch_description():

pkg_urc_bringup = FindPackageShare("urc_bringup").find("urc_bringup")
pkg_urc_navigation = FindPackageShare("urc_navigation").find("urc_navigation")
pkg_urc_hw_description = FindPackageShare("urc_hw_description").find("urc_hw_description")
pkg_urc_bringup = FindPackageShare(
"urc_bringup").find("urc_bringup")
pkg_urc_navigation = FindPackageShare(
"urc_navigation").find("urc_navigation")
pkg_urc_hw_description = FindPackageShare(
"urc_hw_description").find("urc_hw_description")
world_path = os.path.join(pkg_urc_hw_description, "world/world.sdf")


robot_description_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
Expand All @@ -26,7 +31,8 @@ def generate_launch_description():
]
)

hardware_config_filepath = os.path.join(pkg_urc_bringup, 'config', 'hardware_config.yaml')
hardware_config_filepath = os.path.join(
pkg_urc_bringup, 'config', 'hardware_config.yaml')
with open(hardware_config_filepath) as f:
hardware_config = yaml.safe_load(f)

Expand All @@ -42,12 +48,12 @@ def generate_launch_description():

gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[PathJoinSubstitution([FindPackageShare("gazebo_ros"), "launch", "gazebo.launch.py"])]
[PathJoinSubstitution([FindPackageShare(
"gazebo_ros"), "launch", "gazebo.launch.py"])]
),
launch_arguments={"verbose": "false", "world": world_path}.items()
)


launch_navigation = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_urc_navigation, "launch", "navigation.launch.py")
Expand Down
19 changes: 8 additions & 11 deletions urc_navigation/launch/localization.launch.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from launch import LaunchDescription
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
from launch.substitutions import LaunchConfiguration
import os


def generate_launch_description():
pkg_urc_navigation = FindPackageShare("urc_navigation").find("urc_navigation")
pkg_urc_navigation = FindPackageShare(
"urc_navigation").find("urc_navigation")

ekf_local = Node(
package='robot_localization',
Expand All @@ -17,8 +17,7 @@ def generate_launch_description():
os.path.join(pkg_urc_navigation, 'config/ekf.yaml')
# {'use_sim_time': LaunchConfiguration('use_sim_time')}
],
remappings=[('odometry/filtered', 'odometry/local')]

remappings=[('odometry/filtered', 'odometry/local')]
)

ekf_global = Node(
Expand All @@ -30,8 +29,7 @@ def generate_launch_description():
os.path.join(pkg_urc_navigation, 'config/ekf.yaml')
],
remappings=[
('odometry/filtered', 'odometry/global')]

('odometry/filtered', 'odometry/global')]
)

navsat_node = Node(
Expand All @@ -43,11 +41,10 @@ def generate_launch_description():
os.path.join(pkg_urc_navigation, 'config/ekf.yaml')
],
remappings=[('/imu', 'imu/data'),
('gps/fix', 'gps/data'),
('gps/filtered', 'gps/filtered'),
('odometry/gps', 'odometry/gps'),
('odometry/filtered', 'odometry/global')]

('gps/fix', 'gps/data'),
('gps/filtered', 'gps/filtered'),
('odometry/gps', 'odometry/gps'),
('odometry/filtered', 'odometry/global')]
)

return LaunchDescription([
Expand Down
75 changes: 36 additions & 39 deletions urc_navigation/launch/navigation.launch.py
Original file line number Diff line number Diff line change
@@ -1,75 +1,72 @@
import os
import xacro
# import xacro
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node
from launch.actions import (IncludeLaunchDescription, DeclareLaunchArgument, EmitEvent, ExecuteProcess,
LogInfo, RegisterEventHandler, TimerAction)
from launch.conditions import IfCondition
from launch.event_handlers import (OnExecutionComplete, OnProcessExit,
OnProcessIO, OnProcessStart, OnShutdown)
from launch.events import Shutdown
from launch.substitutions import (EnvironmentVariable, FindExecutable,
LaunchConfiguration, LocalSubstitution,
PythonExpression)
# from launch_ros.actions import Node
from launch.actions import IncludeLaunchDescription


def generate_launch_description():

pkg_urc_navigation = get_package_share_directory('urc_navigation')
pkg_hw_description = get_package_share_directory('urc_hw_description')
nav2_bringup = os.path.join(get_package_share_directory('nav2_bringup'))
slam_toolbox = os.path.join(get_package_share_directory('slam_toolbox'))
# pkg_hw_description = get_package_share_directory('urc_hw_description')
# nav2_bringup = os.path.join(get_package_share_directory('nav2_bringup'))
# slam_toolbox = os.path.join(get_package_share_directory('slam_toolbox'))

# Process the URDF xacro file
xacro_file = os.path.join(pkg_hw_description,'urdf/simplified_model/','simplified_model.xacro')
urdf = xacro.process_file(xacro_file)
# xacro_file = os.path.join(pkg_hw_description,
# 'urdf/simplified_model/',
# 'simplified_model.xacro'
# )
# urdf = xacro.process_file(xacro_file)

launch_localization = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_urc_navigation, "launch", "localization.launch.py")
os.path.join(pkg_urc_navigation,
"launch", "localization.launch.py")
)
)

# Load SLAM parameters from yaml file and add node to launch description
# slam_params_file = os.path.join(pkg_pathfinder,'params', 'mapper_params_online_async.yaml')
# slam_params_file = os.path.join(pkg_pathfinder,'params',
# 'mapper_params_online_async.yaml')
# slam = IncludeLaunchDescription(
# PythonLaunchDescriptionSource([os.path.join(slam_toolbox,'launch','online_async_launch.py')]),
# launch_arguments={'slam_params_file': slam_params_file}.items()
# PythonLaunchDescriptionSource([os.path.join(slam_toolbox,'launch',
# 'online_async_launch.py')]),
# launch_arguments={'slam_params_file': slam_params_file
# }.items()
# )

# Load nav2 parameters from yaml file and add nav2 bringup to launch description
nav2_params_file = os.path.join(pkg_urc_navigation, 'config/', 'nav2_params.yaml')
nav2 = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[os.path.join(nav2_bringup,'launch','navigation_launch.py')]
),
launch_arguments={'params_file': nav2_params_file}.items()
)
# Load nav2 params from yaml file, add nav2 bringup to launch description
# nav2_params_file = os.path.join(pkg_urc_navigation,
# 'config/', 'nav2_params.yaml')
# nav2 = IncludeLaunchDescription(
# PythonLaunchDescriptionSource(
# [os.path.join(nav2_bringup,'launch','navigation_launch.py')]
# ),
# launch_arguments={'params_file': nav2_params_file}.items()
# )

# Delay the launch of nav2 by 5 seconds to give the SLAM node time to initialize and publish the map
delayed_nav2_launch = TimerAction(
period=8.0,
actions=[nav2])
# Delay launch of nav2 to give the SLAM node time to initialize/publish map
# delayed_nav2_launch = TimerAction(
# period=8.0,
# actions=[nav2])

# Load explore_lite parameters from yaml file and add node to launch description
# explore_params_file = os.path.join(pkg_pathfinder, 'params', 'explore_params.yaml')
# Load explore_lite parameters from yaml file, add node to launch desc
# explore_params_file = os.path.join(pkg_pathfinder,
# 'params', 'explore_params.yaml')
# frontier_explore_node = Node(
# package='explore_lite',
# executable='explore',
# output='screen',
# parameters=[explore_params_file]
# )




# Launch everything!
return LaunchDescription([
# slam,
# delayed_nav2_launch,
launch_localization
# delayed_rviz2_launch,
# frontier_explore_node # Uncomment this line to enable the explore_lite node to start mapping the environment
# frontier_explore_node
])

0 comments on commit c96c284

Please sign in to comment.