Skip to content
Snippets Groups Projects
Commit aadaea57 authored by Tommy Persson's avatar Tommy Persson
Browse files

Work on ROS2

parent 00ae3dc7
No related branches found
No related tags found
No related merge requests found
# lrs_exec # lrs_exec
For now pu all exec related stuff here (Python3). For now put all exec related stuff here (Python3).
\ No newline at end of file \ No newline at end of file
...@@ -12,7 +12,7 @@ from lrs_msgs_common.srv import GetResponse ...@@ -12,7 +12,7 @@ from lrs_msgs_common.srv import GetResponse
from lrs_msgs_common.msg import DisplayRequest from lrs_msgs_common.msg import DisplayRequest
from lrs_srvs_tst.srv import TSTExpandTree, TSTAddConstraintsToTree from lrs_srvs_tst.srv import TSTExpandTree, TSTAddConstraintsToTree
from lrs_util.constraints import Constraints, as_constraint from lrs_util.constraints import TreeConstraints
class ExecTree(Node): class ExecTree(Node):
...@@ -192,27 +192,6 @@ class ExecTree(Node): ...@@ -192,27 +192,6 @@ class ExecTree(Node):
print("wait_for_response timeout:", waittime, resp) print("wait_for_response timeout:", waittime, resp)
return (False, "Timeout") return (False, "Timeout")
def check_cons(self, params, jsonstr):
cons = json.loads(jsonstr, object_hook=as_constraint)
if "speed" in params:
print("check_cons setting speed:", params["speed"])
cons.set_speed(params["speed"])
return cons.solve()
def check_constraints(self, jobj):
res = True
if "constraints" in jobj:
print("CHECK CONS")
subres = self.check_cons(jobj["params"], json.dumps(jobj["constraints"], indent = 4))
print("RES:", subres)
if not subres:
res = False
for children in jobj["children"]:
flag = self.check_constraints(children)
res &= flag
return res
def handle_tree(self, jobj, exectree=True, add_constraints=False, displaytype="exec"): def handle_tree(self, jobj, exectree=True, add_constraints=False, displaytype="exec"):
try: try:
...@@ -229,7 +208,9 @@ class ExecTree(Node): ...@@ -229,7 +208,9 @@ class ExecTree(Node):
# check constraints # check constraints
res = self.check_constraints(jobj) tc = TreeConstraints(jobj=jobj)
res = tc.check_constraints_isolated()
if not res: if not res:
print("CONSTRAINT CHECK FAILED") print("CONSTRAINT CHECK FAILED")
return (False, "CONSTRAINT CHECK FAILED") return (False, "CONSTRAINT CHECK FAILED")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment