Skip to content

Commit

Permalink
Surrounded stack kill with try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Naci Dai committed Oct 13, 2022
1 parent e69217b commit 7574b56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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] }"
```
9 changes: 6 additions & 3 deletions src/launch_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7574b56

Please sign in to comment.