Skip to content

Commit

Permalink
Initial Draft
Browse files Browse the repository at this point in the history
  • Loading branch information
martintaraz committed Apr 10, 2024
0 parents commit bd55d75
Show file tree
Hide file tree
Showing 133 changed files with 9,861 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/dualpanto-testing.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions 01 debug_panto_heartbeats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import serial
import binascii

com = "/dev/cu.usbserial-0001"

con = serial.Serial(com, baudrate=115200, timeout=5)
while True:
header = con.read(size=2)
print(binascii.hexlify(header))

msg_type = con.read(size=1)
print(binascii.hexlify(msg_type))

package_id = con.read(size=1)
print(binascii.hexlify(package_id))

message_size = con.read(size=2)
print(binascii.hexlify(message_size))

body = con.read(size=int.from_bytes(message_size, byteorder="big"))
print(binascii.hexlify(body))

if msg_type == bytes.fromhex("20"):
print("received debug message:")
print(body)

con.close()
75 changes: 75 additions & 0 deletions 02 debug_panto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import serial
import binascii
import logging

com = "/dev/cu.usbserial-0001"

logging.basicConfig(level=logging.INFO)

con = serial.Serial(com, baudrate=115200, timeout=5)

while True:
header = con.read(size=2)

msg_type = con.read(size=1)

package_id = con.read(size=1)


message_size = con.read(size=2)


body = con.read(size=int.from_bytes(message_size, byteorder="big"))


if msg_type == bytes.fromhex("20"):
logging.info("received debug message:")
logging.info(body)

elif msg_type == bytes.fromhex("00"):
logging.info("receive sync")
con.write(bytes.fromhex("445080000000"))
elif msg_type == bytes.fromhex("01"):
logging.info("receive heartbeat")
con.write(bytes.fromhex("445081000000"))
elif msg_type == bytes.fromhex("10"):
logging.info("receive position")
"""
4450 // magic number
10 // message type: position
00 // packet ID: not utilized
0028 // payload length: 2 handles, 5 values each, 4 bytes each - 2*5*4 = 40 = 0x28
FFFFFFFF // x position of first handle
FFFFFFFF // y position of first handle
FFFFFFFF // rotation of first handle
FFFFFFFF // x position of first handle's god object
FFFFFFFF // y position of first handle's god object
FFFFFFFF // x position of second handle
FFFFFFFF // y position of second handle
FFFFFFFF // rotation of second handle
FFFFFFFF // x position of second handle's god object
FFFFFFFF // y position of second handle's god object
"""
x_1 = int.from_bytes(body[:4], byteorder='big', signed=False)
y_1 = int.from_bytes(body[4:8], byteorder='big', signed=False)
r_1 = int.from_bytes(body[8:12], byteorder='big', signed=False)
g_x1 = int.from_bytes(body[12:16], byteorder='big', signed=False)
g_y1 = int.from_bytes(body[16:20], byteorder='big', signed=False)
x_2 = int.from_bytes(body[20:24], byteorder='big', signed=False)
y_2 = int.from_bytes(body[24:28], byteorder='big', signed=False)
r_2 = int.from_bytes(body[28:32], byteorder='big', signed=False)
g_x2 = int.from_bytes(body[32:36], byteorder='big', signed=False)
g_y2 = int.from_bytes(body[36:40], byteorder='big', signed=False)


logging.info(f"{x_1} {y_1} {r_1} {g_x1} {g_y1} {x_2} {y_2} {r_2} {g_x2} {g_y2}")
else:
logging.warning(binascii.hexlify(header))

logging.warning((binascii.hexlify(msg_type)))

logging.warning(binascii.hexlify(package_id))
logging.warning(binascii.hexlify(message_size))
logging.warning(binascii.hexlify(body))

con.close()
36 changes: 36 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Dualpanto Testing

Goal of this repository is to provide some (semi) automatic testing for the dualpanto platform.

This involves basic functionality checks of the hardware, the firmware and potentially the unity integration

## Levels of Testing and Repository structure

### Hardware

On a hardware level we need to test that the dualpanto can

- show up as a serial device
- receive uploaded (mini) firmware
- read encoders
- actuate motors
- move two handles in sync

### Firmware

On a firmware level we need to test that the dualpanto can
- perform the handshake
- keep the connection alive
- move the handles if instructed
- report the handle position
- accept obstacles
- render obstacles

### Unity

TODO


This project is currenty under developement

For questions, please reach out to [email protected]
1 change: 1 addition & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COM_PORT = "/dev/tty.SLAB_USBtoUART"
1 change: 1 addition & 0 deletions firmware/00 template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.pio
12 changes: 12 additions & 0 deletions firmware/00 template/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[platformio]
description = Dual Panto firmware

[env:esp32dev]
platform = [email protected]
framework = arduino
board = esp32dev
monitor_speed = 115200

# On OSX you need to use the following USB port
# On Windows outcomment this line‚
# upload_port = /dev/cu.SLAB_USBtoUART
26 changes: 26 additions & 0 deletions firmware/00 template/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "Arduino.h"

#ifndef LED_BUILTIN
#define LED_BUILTIN 13
#endif

void setup()
{
// initialize LED digital pin as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
// turn the LED on (HIGH is the voltage level)
digitalWrite(LED_BUILTIN, HIGH);

// wait for a second
delay(1000);

// turn the LED off by making the voltage LOW
digitalWrite(LED_BUILTIN, LOW);

// wait for a second
delay(1000);
}
1 change: 1 addition & 0 deletions firmware/01 hello world/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.pio
12 changes: 12 additions & 0 deletions firmware/01 hello world/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[platformio]
description = Dual Panto firmware

[env:esp32dev]
platform = [email protected]
framework = arduino
board = esp32dev
monitor_speed = 115200

# On OSX you need to use the following USB port
# On Windows outcomment this line‚
# upload_port = /dev/cu.SLAB_USBtoUART
26 changes: 26 additions & 0 deletions firmware/01 hello world/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "Arduino.h"

#ifndef LED_BUILTIN
#define LED_BUILTIN 13
#endif

void setup()
{
// initialize LED digital pin as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
// turn the LED on (HIGH is the voltage level)
digitalWrite(LED_BUILTIN, HIGH);

// wait for a second
delay(1000);

// turn the LED off by making the voltage LOW
digitalWrite(LED_BUILTIN, LOW);

// wait for a second
delay(1000);
}
1 change: 1 addition & 0 deletions firmware/02 echo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.pio
12 changes: 12 additions & 0 deletions firmware/02 echo/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[platformio]
description = Dual Panto firmware

[env:esp32dev]
platform = [email protected]
framework = arduino
board = esp32dev
monitor_speed = 115200

# On OSX you need to use the following USB port
# On Windows outcomment this line‚
# upload_port = /dev/cu.SLAB_USBtoUART
20 changes: 20 additions & 0 deletions firmware/02 echo/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "Arduino.h"

int incomingByte = 0; // for incoming serial data


void setup()
{
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}

void loop()
{
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
Serial.write(incomingByte);
}
}
1 change: 1 addition & 0 deletions firmware/03 panto firmware/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text eol=lf
Loading

0 comments on commit bd55d75

Please sign in to comment.