14
14
15
15
from typing import Dict , Text
16
16
17
- import yaml
18
- from launch .launch_context import LaunchContext
19
17
import launch
18
+ from launch .launch_context import LaunchContext
19
+ import yaml
20
20
21
21
22
22
class ParseMultiRobotPose (launch .Substitution ):
@@ -36,27 +36,25 @@ def describe(self) -> Text:
36
36
return ''
37
37
38
38
def perform (self , context : LaunchContext ) -> Dict :
39
- """
40
- Resolve and parse the robots argument string into a dictionary.
41
- """
39
+ """Resolve and parse the robots argument string into a dictionary."""
42
40
robots_str = self .__robots_argument .perform (context )
43
41
if not robots_str :
44
42
return {}
45
43
46
44
multirobots = {}
47
- for robot_entry in robots_str .split (";" ):
48
- key_val = robot_entry .strip ().split ("=" )
45
+ for robot_entry in robots_str .split (';' ):
46
+ key_val = robot_entry .strip ().split ('=' )
49
47
if len (key_val ) != 2 :
50
48
continue
51
49
52
50
robot_name , pose_str = key_val [0 ].strip (), key_val [1 ].strip ()
53
51
robot_pose = yaml .safe_load (pose_str )
54
52
# Set default values if not provided
55
- robot_pose .setdefault ("x" , 0.0 )
56
- robot_pose .setdefault ("y" , 0.0 )
57
- robot_pose .setdefault ("z" , 0.0 )
58
- robot_pose .setdefault (" roll" , 0.0 )
59
- robot_pose .setdefault (" pitch" , 0.0 )
60
- robot_pose .setdefault (" yaw" , 0.0 )
53
+ robot_pose .setdefault ('x' , 0.0 )
54
+ robot_pose .setdefault ('y' , 0.0 )
55
+ robot_pose .setdefault ('z' , 0.0 )
56
+ robot_pose .setdefault (' roll' , 0.0 )
57
+ robot_pose .setdefault (' pitch' , 0.0 )
58
+ robot_pose .setdefault (' yaw' , 0.0 )
61
59
multirobots [robot_name ] = robot_pose
62
60
return multirobots
0 commit comments