From 7574b565efbefb6dac1e3e4083c1607bf6b3e140 Mon Sep 17 00:00:00 2001 From: Naci Dai Date: Thu, 13 Oct 2022 20:32:18 +0300 Subject: [PATCH] Surrounded stack kill with try catch --- README.md | 7 +++++++ src/launch_plugin.py | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7967b0a..5fc73cf 100644 --- a/README.md +++ b/README.md @@ -162,3 +162,10 @@ You can use any open-source mqtt client to issue these commands and monitor vari mosquitto_pub -d -h sandbox.composiv.ai -p 1883 -t "ai.composiv.sandbox.f1tenth:simulator-monster-01/stack/commands/active" -m '{"name":"Composiv Learning Simulator with Gap Follwer","context":"eteration_office","stackId":"ai.composiv.sandbox.f1tenth:composiv_simulator_gf.launch","stack":[{"thingId":"ai.composiv.sandbox.f1tenth:composiv_simulator.launch"}],"node":[{"name":"cass_gap_follower","pkg":"cass_gap_follower","exec":"cass_gap_follower","param":[{"from":"$(find cass_gap_follower)/params.yaml"}]}]}' ``` + + +## Controlling the F1Tenth Car (navigate on/off) + +```bash +rostopic pub --once /mux std_msgs/Int32MultiArray "{layout: { dim: [], data_offset: 0}, data: [0, 0, 0, 0, 1 , 0] }" +``` diff --git a/src/launch_plugin.py b/src/launch_plugin.py index f09fe48..da36565 100755 --- a/src/launch_plugin.py +++ b/src/launch_plugin.py @@ -116,9 +116,12 @@ def handle_kill(self,req): if plan.planned: # context = json.loads(msg.context) # self.bootstrap(context) - stack = json.loads(plan.planned.stack) - #Apply is different than start kill etc. It will use the node "action" - self.device.kill(stack) + try: + stack = json.loads(plan.planned.stack) + #Apply is different than start kill etc. It will use the node "action" + self.device.kill(stack) + except Exception as error: + print('Cannot parse stack: {}'.format(error)) result = PluginResponse(resultCode=0, errorMessage="", errorDescription="") plan.result = result