Skip to content

Commit

Permalink
add ability for user to specify their own motion capture yaml file
Browse files Browse the repository at this point in the history
  • Loading branch information
llanesc committed Jun 28, 2024
1 parent 62e69b1 commit ee46445
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions crazyflie/launch/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

def parse_yaml(context):
# Load the crazyflies YAML file
crazyflies_yaml_file = LaunchConfiguration('crazyflies_yaml_file').perform(context)
with open(crazyflies_yaml_file, 'r') as file:
crazyflies_yaml = LaunchConfiguration('crazyflies_yaml_file').perform(context)
with open(crazyflies_yaml, 'r') as file:
crazyflies = yaml.safe_load(file)

# server params
Expand All @@ -36,11 +36,7 @@ def parse_yaml(context):
server_params[1]['robot_description'] = robot_desc

# construct motion_capture_configuration
motion_capture_yaml = os.path.join(
get_package_share_directory('crazyflie'),
'config',
'motion_capture.yaml')

motion_capture_yaml = LaunchConfiguration('motion_capture_yaml_file').perform(context)
with open(motion_capture_yaml, 'r') as ymlfile:
motion_capture_content = yaml.safe_load(ymlfile)

Expand Down Expand Up @@ -99,6 +95,11 @@ def generate_launch_description():
get_package_share_directory('crazyflie'),
'config',
'crazyflies.yaml')

default_motion_capture_yaml_path = os.path.join(
get_package_share_directory('crazyflie'),
'config',
'motion_capture.yaml')

telop_yaml_path = os.path.join(
get_package_share_directory('crazyflie'),
Expand All @@ -108,6 +109,8 @@ def generate_launch_description():
return LaunchDescription([
DeclareLaunchArgument('crazyflies_yaml_file',
default_value=default_crazyflies_yaml_path),
DeclareLaunchArgument('motion_capture_yaml_file',
default_value=default_motion_capture_yaml_path),
DeclareLaunchArgument('backend', default_value='cpp'),
DeclareLaunchArgument('debug', default_value='False'),
DeclareLaunchArgument('rviz', default_value='False'),
Expand Down

0 comments on commit ee46445

Please sign in to comment.