@@ -201,6 +201,28 @@ def test_set_io(self):
201201 time .sleep (1 )
202202 self .set_digout_checked (0 , False )
203203
204+ self .io_msg = None
205+ self .io_states_sub = self .node .create_subscription (
206+ IOStates ,
207+ "/io_and_status_controller/io_states" ,
208+ self .io_msg_cb ,
209+ rclpy .qos .qos_profile_system_default ,
210+ )
211+
212+ script_msg = StringMsg (
213+ data = "sec my_program():\n set_digital_out(0, False)\n set_digital_out(1,True)\n end"
214+ )
215+ self .urscript_pub .publish (script_msg )
216+ self .check_pin_states ([0 , 1 ], [False , True ])
217+
218+ time .sleep (1 )
219+
220+ script_msg = StringMsg (
221+ data = "sec my_program():\n set_digital_out(0, True)\n set_digital_out(1,False)\n end"
222+ )
223+ self .urscript_pub .publish (script_msg )
224+ self .check_pin_states ([0 , 1 ], [True , False ])
225+
204226 def io_msg_cb (self , msg ):
205227 self .io_msg = msg
206228
@@ -222,28 +244,6 @@ def check_pin_states(self, pins, states):
222244 pin_states [i ] = self .io_msg .digital_out_states [pin_id ].state
223245 self .assertEqual (pin_states , states )
224246
225- def test_multiline_script (self ):
226- """Tests sending a multiline script as secondary program."""
227- self .io_msg = None
228- self .io_states_sub = self .node .create_subscription (
229- IOStates ,
230- "/io_and_status_controller/io_states" ,
231- self .io_msg_cb ,
232- rclpy .qos .qos_profile_system_default ,
233- )
234-
235- script_msg = StringMsg (
236- data = "sec my_program():\n set_digital_out(0, False)\n set_digital_out(1,True)\n end"
237- )
238- self .urscript_pub .publish (script_msg )
239- self .check_pin_states ([0 , 1 ], [False , True ])
240-
241- script_msg = StringMsg (
242- data = "sec my_program():\n set_digital_out(0, True)\n set_digital_out(1,False)\n end"
243- )
244- self .urscript_pub .publish (script_msg )
245- self .check_pin_states ([0 , 1 ], [True , False ])
246-
247247 def dashboard_call (self , srv_name , request ):
248248 self .node .get_logger ().info (f"Calling service '{ srv_name } ' with request { request } " )
249249 future = self .dashboard_clients [srv_name ].call_async (request )
0 commit comments