@@ -40,16 +40,16 @@ def rosservice_find(ros, type, **kwargs):
40
40
41
41
def rossrv_info (ros , type , ** kwargs ):
42
42
_print_type (ros .get_service_request_details (type ))
43
- print (' ---' )
43
+ print (" ---" )
44
44
_print_type (ros .get_service_response_details (type ))
45
45
46
46
47
47
def rosservice_info (ros , service , ** kwargs ):
48
48
type_name = ros .get_service_type (service )
49
49
50
- print (' Type: %s\n ' % type_name )
51
- print (' Message definition' )
52
- print (' ------------------' )
50
+ print (" Type: %s\n " % type_name )
51
+ print (" Message definition" )
52
+ print (" ------------------" )
53
53
54
54
rossrv_info (ros , type_name )
55
55
@@ -73,117 +73,117 @@ def rosparam_delete(ros, param, **kwargs):
73
73
74
74
def _print_typedef (typedef , def_map , level ):
75
75
defs = def_map [typedef ]
76
- for fname , ftype , flen in zip (defs [' fieldnames' ], defs [' fieldtypes' ], defs [' fieldarraylen' ]):
76
+ for fname , ftype , flen in zip (defs [" fieldnames" ], defs [" fieldtypes" ], defs [" fieldarraylen" ]):
77
77
if flen == - 1 :
78
78
ftype_info = ftype
79
79
elif flen == 0 :
80
- ftype_info = ftype + '[]'
80
+ ftype_info = ftype + "[]"
81
81
else :
82
- ftype_info = ' %s[%d]' % (ftype , flen )
82
+ ftype_info = " %s[%d]" % (ftype , flen )
83
83
84
- print (' %s%s %s' % (' ' * level , ftype_info , fname ))
84
+ print (" %s%s %s" % (" " * level , ftype_info , fname ))
85
85
if ftype in def_map :
86
86
_print_typedef (ftype , def_map , level + 1 )
87
87
88
88
89
89
def _print_type (typedata ):
90
- if len (typedata [' typedefs' ]) == 0 :
90
+ if len (typedata [" typedefs" ]) == 0 :
91
91
return
92
92
93
- main_type = typedata [' typedefs' ][0 ][' type' ]
94
- def_map = {typedef [' type' ]: typedef for typedef in typedata [' typedefs' ]}
93
+ main_type = typedata [" typedefs" ][0 ][" type" ]
94
+ def_map = {typedef [" type" ]: typedef for typedef in typedata [" typedefs" ]}
95
95
_print_typedef (main_type , def_map , 0 )
96
96
97
97
98
98
def main ():
99
99
import argparse
100
100
101
- parser = argparse .ArgumentParser (description = ' roslibpy command-line utility' )
102
- parser .add_argument ('-r' , ' --ros-host' , type = str , help = ' ROS host name or IP address' , default = ' localhost' )
103
- parser .add_argument ('-p' , ' --ros-port' , type = int , help = ' ROS bridge port' , default = 9090 )
101
+ parser = argparse .ArgumentParser (description = " roslibpy command-line utility" )
102
+ parser .add_argument ("-r" , " --ros-host" , type = str , help = " ROS host name or IP address" , default = " localhost" )
103
+ parser .add_argument ("-p" , " --ros-port" , type = int , help = " ROS bridge port" , default = 9090 )
104
104
105
- commands = parser .add_subparsers (help = ' commands' )
106
- commands .dest = ' command'
105
+ commands = parser .add_subparsers (help = " commands" )
106
+ commands .dest = " command"
107
107
commands .required = True
108
108
109
109
# Command: topic
110
- topic_command = commands .add_parser (' topic' , help = ' ROS Topics' )
111
- topic_subcommands = topic_command .add_subparsers (help = ' ROS topic commands' )
112
- topic_subcommands .dest = ' subcommand'
110
+ topic_command = commands .add_parser (" topic" , help = " ROS Topics" )
111
+ topic_subcommands = topic_command .add_subparsers (help = " ROS topic commands" )
112
+ topic_subcommands .dest = " subcommand"
113
113
topic_subcommands .required = True
114
114
115
- topic_list_parser = topic_subcommands .add_parser (' list' , help = ' List available ROS topics' )
115
+ topic_list_parser = topic_subcommands .add_parser (" list" , help = " List available ROS topics" )
116
116
topic_list_parser .set_defaults (func = rostopic_list )
117
117
118
- topic_type_parser = topic_subcommands .add_parser (' type' , help = ' ROS topic type' )
119
- topic_type_parser .add_argument (' topic' , action = ' store' , type = str , help = ' Topic name' )
118
+ topic_type_parser = topic_subcommands .add_parser (" type" , help = " ROS topic type" )
119
+ topic_type_parser .add_argument (" topic" , action = " store" , type = str , help = " Topic name" )
120
120
topic_type_parser .set_defaults (func = rostopic_type )
121
121
122
- topic_find_parser = topic_subcommands .add_parser (' find' , help = ' ROS topics by type' )
123
- topic_find_parser .add_argument (' type' , action = ' store' , type = str , help = ' Type name' )
122
+ topic_find_parser = topic_subcommands .add_parser (" find" , help = " ROS topics by type" )
123
+ topic_find_parser .add_argument (" type" , action = " store" , type = str , help = " Type name" )
124
124
topic_find_parser .set_defaults (func = rostopic_find )
125
125
126
126
# Command: msg
127
- msg_command = commands .add_parser (' msg' , help = ' ROS Message type information' )
128
- msg_subcommands = msg_command .add_subparsers (help = ' ROS Message type commands' )
129
- msg_subcommands .dest = ' subcommand'
127
+ msg_command = commands .add_parser (" msg" , help = " ROS Message type information" )
128
+ msg_subcommands = msg_command .add_subparsers (help = " ROS Message type commands" )
129
+ msg_subcommands .dest = " subcommand"
130
130
msg_subcommands .required = True
131
131
132
- msg_info_parser = msg_subcommands .add_parser (' info' , help = ' ROS message type information' )
133
- msg_info_parser .add_argument (' type' , action = ' store' , type = str , help = ' Message type' )
132
+ msg_info_parser = msg_subcommands .add_parser (" info" , help = " ROS message type information" )
133
+ msg_info_parser .add_argument (" type" , action = " store" , type = str , help = " Message type" )
134
134
msg_info_parser .set_defaults (func = rosmsg_info )
135
135
136
136
# Command: service
137
- service_command = commands .add_parser (' service' , help = ' ROS Services' )
138
- service_subcommands = service_command .add_subparsers (help = ' ROS service commands' )
139
- service_subcommands .dest = ' subcommand'
137
+ service_command = commands .add_parser (" service" , help = " ROS Services" )
138
+ service_subcommands = service_command .add_subparsers (help = " ROS service commands" )
139
+ service_subcommands .dest = " subcommand"
140
140
service_subcommands .required = True
141
141
142
- service_list_parser = service_subcommands .add_parser (' list' , help = ' List available ROS services' )
142
+ service_list_parser = service_subcommands .add_parser (" list" , help = " List available ROS services" )
143
143
service_list_parser .set_defaults (func = rosservice_list )
144
144
145
- service_type_parser = service_subcommands .add_parser (' type' , help = ' ROS service type' )
146
- service_type_parser .add_argument (' service' , action = ' store' , type = str , help = ' Service name' )
145
+ service_type_parser = service_subcommands .add_parser (" type" , help = " ROS service type" )
146
+ service_type_parser .add_argument (" service" , action = " store" , type = str , help = " Service name" )
147
147
service_type_parser .set_defaults (func = rosservice_type )
148
148
149
- service_find_parser = service_subcommands .add_parser (' find' , help = ' ROS services by type' )
150
- service_find_parser .add_argument (' type' , action = ' store' , type = str , help = ' Type name' )
149
+ service_find_parser = service_subcommands .add_parser (" find" , help = " ROS services by type" )
150
+ service_find_parser .add_argument (" type" , action = " store" , type = str , help = " Type name" )
151
151
service_find_parser .set_defaults (func = rosservice_find )
152
152
153
- service_info_parser = service_subcommands .add_parser (' info' , help = ' ROS service information' )
154
- service_info_parser .add_argument (' service' , action = ' store' , type = str , help = ' Service name' )
153
+ service_info_parser = service_subcommands .add_parser (" info" , help = " ROS service information" )
154
+ service_info_parser .add_argument (" service" , action = " store" , type = str , help = " Service name" )
155
155
service_info_parser .set_defaults (func = rosservice_info )
156
156
157
157
# Command: srv
158
- srv_command = commands .add_parser (' srv' , help = ' ROS Service type information' )
159
- srv_subcommands = srv_command .add_subparsers (help = ' ROS service type commands' )
160
- srv_subcommands .dest = ' subcommand'
158
+ srv_command = commands .add_parser (" srv" , help = " ROS Service type information" )
159
+ srv_subcommands = srv_command .add_subparsers (help = " ROS service type commands" )
160
+ srv_subcommands .dest = " subcommand"
161
161
srv_subcommands .required = True
162
162
163
- srv_info_parser = srv_subcommands .add_parser (' info' , help = ' ROS service type information' )
164
- srv_info_parser .add_argument (' type' , action = ' store' , type = str , help = ' Service type' )
163
+ srv_info_parser = srv_subcommands .add_parser (" info" , help = " ROS service type information" )
164
+ srv_info_parser .add_argument (" type" , action = " store" , type = str , help = " Service type" )
165
165
srv_info_parser .set_defaults (func = rossrv_info )
166
166
167
167
# Command: param
168
- param_command = commands .add_parser (' param' , help = ' ROS Params' )
169
- param_subcommands = param_command .add_subparsers (help = ' ROS parameter commands' )
170
- param_subcommands .dest = ' subcommand'
168
+ param_command = commands .add_parser (" param" , help = " ROS Params" )
169
+ param_subcommands = param_command .add_subparsers (help = " ROS parameter commands" )
170
+ param_subcommands .dest = " subcommand"
171
171
param_subcommands .required = True
172
172
173
- param_list_parser = param_subcommands .add_parser (' list' , help = ' List available ROS parameters' )
173
+ param_list_parser = param_subcommands .add_parser (" list" , help = " List available ROS parameters" )
174
174
param_list_parser .set_defaults (func = rosparam_list )
175
175
176
- param_set_parser = param_subcommands .add_parser (' set' , help = ' Set ROS param value' )
177
- param_set_parser .add_argument (' param' , action = ' store' , type = str , help = ' Param name' )
178
- param_set_parser .add_argument (' value' , action = ' store' , type = str , help = ' Param value' )
176
+ param_set_parser = param_subcommands .add_parser (" set" , help = " Set ROS param value" )
177
+ param_set_parser .add_argument (" param" , action = " store" , type = str , help = " Param name" )
178
+ param_set_parser .add_argument (" value" , action = " store" , type = str , help = " Param value" )
179
179
param_set_parser .set_defaults (func = rosparam_set )
180
180
181
- param_get_parser = param_subcommands .add_parser (' get' , help = ' Get ROS param value' )
182
- param_get_parser .add_argument (' param' , action = ' store' , type = str , help = ' Param name' )
181
+ param_get_parser = param_subcommands .add_parser (" get" , help = " Get ROS param value" )
182
+ param_get_parser .add_argument (" param" , action = " store" , type = str , help = " Param name" )
183
183
param_get_parser .set_defaults (func = rosparam_get )
184
184
185
- param_delete_parser = param_subcommands .add_parser (' delete' , help = ' Delete ROS param' )
186
- param_delete_parser .add_argument (' param' , action = ' store' , type = str , help = ' Param name' )
185
+ param_delete_parser = param_subcommands .add_parser (" delete" , help = " Delete ROS param" )
186
+ param_delete_parser .add_argument (" param" , action = " store" , type = str , help = " Param name" )
187
187
param_delete_parser .set_defaults (func = rosparam_delete )
188
188
189
189
# Invoke
@@ -197,5 +197,5 @@ def main():
197
197
ros .terminate ()
198
198
199
199
200
- if __name__ == ' __main__' :
200
+ if __name__ == " __main__" :
201
201
main ()
0 commit comments