Skip to content

Commit

Permalink
Python string format (ros-navigation#2466)
Browse files Browse the repository at this point in the history
* Convert to python format strings for readability

* Merge concatenated strings

* Revert converting generated files

* Single quotes for consistency

* Just print the exception
  • Loading branch information
Timple authored Jul 23, 2021
1 parent 7d56939 commit 4973e55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nav2_bringup/bringup/launch/multi_tb3_simulation_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def generate_launch_description():
# Define commands for launching the navigation instances
nav_instances_cmds = []
for robot in robots:
params_file = LaunchConfiguration(robot['name'] + '_params_file')
params_file = LaunchConfiguration(f"{robot['name']}_params_file")

group = GroupAction([
IncludeLaunchDescription(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def main():
if args.turtlebot_type is not None:
sdf_file_path = os.path.join(
get_package_share_directory('turtlebot3_gazebo'), 'models',
'turtlebot3_{}'.format(args.turtlebot_type), 'model.sdf')
f'turtlebot3_{args.turtlebot_type}', 'model.sdf')
else:
sdf_file_path = args.sdf

Expand All @@ -86,7 +86,7 @@ def main():
if args.robot_namespace:
ros_params = plugin.find('ros')
ros_tf_remap = ET.SubElement(ros_params, 'remapping')
ros_tf_remap.text = '/tf:=/' + args.robot_namespace + '/tf'
ros_tf_remap.text = f'/tf:=/{args.robot_namespace}/tf'

# Set data for request
request = SpawnEntity.Request()
Expand All @@ -101,10 +101,10 @@ def main():
future = client.call_async(request)
rclpy.spin_until_future_complete(node, future, timeout_sec=args.timeout)
if future.result() is not None:
print('response: %r' % future.result())
print(f'response: {future.result()!r}')
else:
raise RuntimeError(
'exception while calling service: %r' % future.exception())
f'exception while calling service: {future.exception()!r}')

node.get_logger().info('Done! Shutting down node.')
node.destroy_node()
Expand Down

0 comments on commit 4973e55

Please sign in to comment.