Skip to content

Commit

Permalink
Python linting
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcalderon03 committed Jan 21, 2024
1 parent eb71656 commit c2b42e5
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 36 deletions.
79 changes: 47 additions & 32 deletions urc_bringup/launch/bringup.launch.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription, SetEnvironmentVariable, TimerAction
from launch.actions import IncludeLaunchDescription, SetEnvironmentVariable
from launch.actions import DeclareLaunchArgument, ExecuteProcess
from launch_ros.actions import Node
from launch.substitutions import LaunchConfiguration, Command
from launch.substitutions import PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.actions import ExecuteProcess, RegisterEventHandler
from launch.event_handlers import OnProcessExit
from ament_index_python.packages import get_package_share_directory
import os
import yaml
Expand All @@ -16,15 +15,14 @@

def generate_launch_description():

pkg_gazebo_ros = FindPackageShare("gazebo_ros").find("gazebo_ros")
pkg_urc_gazebo = FindPackageShare("urc_gazebo").find("urc_gazebo")
pkg_urc_bringup = FindPackageShare("urc_bringup").find("urc_bringup")
pkg_urc_navigation = FindPackageShare("urc_navigation").find("urc_navigation")
pkg_urc_bringup = FindPackageShare("urc_bringup").find
("urc_bringup")
pkg_urc_navigation = FindPackageShare("urc_navigation").find
("urc_navigation")

world_path = os.path.join(pkg_urc_bringup, 'world/world.sdf')
default_model_path= os.path.join(get_package_share_directory('urc_hw_description'), "urdf/robot.xacro")


default_model_path = os.path.join
(get_package_share_directory('urc_hw_description'), "urdf/robot.xacro")

hardware_config_file_dir = os.path.join(
pkg_urc_bringup, 'config', 'hardware_config.yaml')
Expand All @@ -33,13 +31,12 @@ def generate_launch_description():
use_simulation = hardware_config['hardware_config']['use_simulation']

controller_config_file_dir = os.path.join(
pkg_urc_bringup,
'config', 'ros2_control_simple.yaml'
pkg_urc_bringup, 'config', 'ros2_control_simple.yaml'
)

pkg_share = launch_ros.substitutions.FindPackageShare(package='urc_bringup').find('urc_bringup')
default_rviz_config_path = os.path.join(pkg_share, 'rviz/urdf_config.rviz')

default_rviz_config_path = os.path.join(
pkg_urc_bringup, 'rviz/urdf_config.rviz'
)

# gazebo = IncludeLaunchDescription(
# PythonLaunchDescriptionSource(
Expand All @@ -48,8 +45,6 @@ def generate_launch_description():
# launch_arguments={"world": world_path}.items()
# )



navigation_nodes = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_urc_navigation, "launch", "navigation.launch.py")
Expand All @@ -71,8 +66,9 @@ def generate_launch_description():
executable='urc_perception_ArucoDetector',
output='screen',
parameters=[
PathJoinSubstitution([FindPackageShare('urc_perception'), 'config',
'aruco_detector_params.yaml'])
PathJoinSubstitution([
FindPackageShare('urc_perception'),
'config', 'aruco_detector_params.yaml'])
],
remappings=[
("/aruco_detector/aruco_detection", "/aruco_detection")
Expand All @@ -89,8 +85,9 @@ def generate_launch_description():
spawn_robot = Node(
package='gazebo_ros',
executable='spawn_entity.py',
arguments=['-entity', 'walli',
'-x', '0', '-y', '0', '-z', '0.4', '-R', '0', '-P', '0', '-Y', '0',
arguments=['-entity', 'walli',
'-x', '0', '-y', '0', '-z', '0.4',
'-R', '0', '-P', '0', '-Y', '0',
'-topic', '/robot_description'],
output='screen'
)
Expand All @@ -100,8 +97,8 @@ def generate_launch_description():
name='robot_state_publisher',
parameters=[
# {"use_sim_time": LaunchConfiguration('use_sim_time')},
{"robot_description": Command(['xacro ', LaunchConfiguration('model')])}
],
{"robot_description": Command(
['xacro ', LaunchConfiguration('model')])}],
output='screen'
)
joint_state_publisher_node = launch_ros.actions.Node(
Expand Down Expand Up @@ -153,15 +150,33 @@ def generate_launch_description():
if use_simulation:
print("USING SIMULATION MODE")
return LaunchDescription([
launch.actions.DeclareLaunchArgument(name='rvizconfig', default_value=default_rviz_config_path,
description='Absolute path to rviz config file'),
launch.actions.DeclareLaunchArgument(name='model', default_value=default_model_path,
description='Absolute path to robot urdf file'),
launch.actions.DeclareLaunchArgument(name='use_sim_time', default_value='True',
description='Flag to enable use_sim_time'),
launch.actions.DeclareLaunchArgument(name='gui', default_value='True',
description='Flag to enable joint_state_publisher_gui'),
launch.actions.ExecuteProcess(cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_init.so', '-s', 'libgazebo_ros_factory.so', world_path], output='screen'),
DeclareLaunchArgument(
name='rvizconfig',
default_value=default_rviz_config_path,
description='Absolute path to rviz config file'
),
DeclareLaunchArgument(
name='model',
default_value=default_model_path,
description='Absolute path to robot urdf file'
),
DeclareLaunchArgument(
name='use_sim_time',
default_value='True',
description='Flag to enable use_sim_time'
),
DeclareLaunchArgument(
name='gui',
default_value='True',
description='Flag to enable joint_state_publisher_gui'
),
ExecuteProcess(cmd=[
'gazebo', '--verbose', '-s',
'libgazebo_ros_init.so', '-s',
'libgazebo_ros_factory.so', world_path
],
output='screen'
),

enable_color,
# gazebo,
Expand Down
6 changes: 2 additions & 4 deletions urc_navigation/launch/navigation.launch.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from launch import LaunchDescription
from launch.substitutions import PathJoinSubstitution
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")

robot_localization_node = Node(
package='robot_localization',
Expand All @@ -21,7 +20,6 @@ def generate_launch_description():
]
)


return LaunchDescription([
robot_localization_node
])

0 comments on commit c2b42e5

Please sign in to comment.