mirror of
https://github.com/modelec/modelec-marcel-ROS.git
synced 2026-01-18 16:47:43 +01:00
up to last odo version
This commit is contained in:
@@ -122,7 +122,7 @@ class SimulatedPCB:
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description="Simulated PCB")
|
||||
parser.add_argument('--port', type=str, default='/dev/pts/6', help='Serial port to use')
|
||||
parser.add_argument('--port', type=str, default='/tmp/USB_ACTION_SIM', help='Serial port to use')
|
||||
args = parser.parse_args()
|
||||
|
||||
sim = None
|
||||
@@ -132,3 +132,8 @@ if __name__ == '__main__':
|
||||
if sim:
|
||||
sim.stop()
|
||||
print("Simulation stopped")
|
||||
|
||||
# socat -d -d pty,raw,echo=0,link=/tmp/MARCEL_ACTION_SIM pty,raw,echo=0,link=/tmp/MARCEL_ACTION
|
||||
# python3 simulated_pcb/action.py --port /tmp/MARCEL_ACTION_SIM
|
||||
# socat -d -d pty,raw,echo=0,link=/tmp/ENEMY_ACTION_SIM pty,raw,echo=0,link=/tmp/ENEMY_ACTION
|
||||
# python3 simulated_pcb/action.py --port /tmp/ENEMY_ACTION_SIM
|
||||
@@ -124,20 +124,24 @@ class SimulatedPCB:
|
||||
print(f'[TX] OK;START;1')
|
||||
self.ser.write(f'OK;START;1\n'.encode())
|
||||
|
||||
elif msg.startswith("SET;WAYPOINT"):
|
||||
elif msg.startswith("SET;WAYPOINTS;"):
|
||||
parts = msg.split(';')
|
||||
if len(parts) >= 7:
|
||||
wp = {
|
||||
'id': int(parts[2]),
|
||||
'type': int(parts[3]),
|
||||
'x': float(parts[4]),
|
||||
'y': float(parts[5]),
|
||||
'theta': float(parts[6])
|
||||
}
|
||||
self.waypoints[wp['id']] = wp
|
||||
if wp['id'] not in self.waypoint_order:
|
||||
self.waypoint_order.append(wp['id'])
|
||||
self.ser.write(f'OK;WAYPOINT;{wp["id"]}\n'.encode())
|
||||
if len(parts) / 7 >= 1:
|
||||
self.waypoints.clear()
|
||||
self.waypoint_order.clear()
|
||||
for i in range(2, len(parts), 5):
|
||||
wp = {
|
||||
'id': int(parts[i]),
|
||||
'type': int(parts[i + 1]),
|
||||
'x': float(parts[i + 2]),
|
||||
'y': float(parts[i + 3]),
|
||||
'theta': float(parts[i + 4])
|
||||
}
|
||||
self.waypoints[wp['id']] = wp
|
||||
if wp['id'] not in self.waypoint_order:
|
||||
self.waypoint_order.append(wp['id'])
|
||||
self.ser.write(f'OK;WAYPOINT;{wp["id"]}\n'.encode())
|
||||
self.ser.write(b'OK;WAYPOINTS;1\n')
|
||||
|
||||
elif msg.startswith("SET;POS"):
|
||||
parts = msg.split(';')
|
||||
|
||||
Reference in New Issue
Block a user