Skip to content

Commit

Permalink
Add the posture feedback channel
Browse files Browse the repository at this point in the history
  • Loading branch information
buschbapti committed Feb 6, 2017
1 parent c68987f commit 623e490
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/tools/udp_link.py
Original file line number Diff line number Diff line change
@@ -12,6 +12,19 @@ def _send_data(self, data):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
sock.sendto(data, (self.ip, self.port))

def send_string(self, channel, string_value):
self._send_data(channel)
self._send_data(string_value)

def send_string_vector(self, channel, vect):
# concatenate the list in one string
string_value = ""
for s in vect:
string_value += (s + "|")
# remove last delimiter
string_value = string_value[:-1]
self.send_string(channel, string_value)

def send_int(self, channel, int_value):
# send channel
self._send_data(channel)
3 changes: 3 additions & 0 deletions src/tools/unity_bridge.py
Original file line number Diff line number Diff line change
@@ -137,3 +137,6 @@ def activate_camera(self, cam_id):

def activate_model(self, model_id):
self.udp.send_int('/model', model_id)

def activate_risk_frames(self, frame_list):
self.udp.send_string_vector('/risk', frame_list)

0 comments on commit 623e490

Please sign in to comment.