Skip to content
Snippets Groups Projects
Commit 7a036e9a authored by Felix Freiberger's avatar Felix Freiberger
Browse files

Merge branch 'saved' of ssh://liebe.cs.uni-saarland.de:2222/powver/draisine into saved

parents 81a17a5f 6b2a7801
No related branches found
No related tags found
1 merge request!1Added SAVED integration.
......@@ -151,14 +151,18 @@ class Control(object):
s = self.hallSpeed.read(t)
controllerInput = '{state}\n{a} {s}\n'.format(state = state, a = self.accelerationToByte(a), s = self.speedToByte(s))
controller = subprocess.Popen('/opt/draisine-hypro/tool/build/bin/controller', stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
controller = subprocess.Popen('./controller', stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdoutdata, stderrdata) = controller.communicate(input=controllerInput)
print stderrdata
assert not stderrdata, 'controller wrote to stderr'
d = 0.75 # TODO
b = max(0, min(254, int(254 * d)))
lines = stdoutdata.split('\n')
assert len(lines) >= 2, 'controller did not output two lines'
state = lines[0]
d = int(lines[1])
b = max(0, min(254, int(d)))
if human:
print 'accY = {v}'.format(v=self.accelerationToByte(a))
print 'speed = {s}'.format(s=self.speedToByte(s))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment