edited colors and checked, that serial code works
This commit is contained in:
@@ -6,8 +6,8 @@ from matplotlib.animation import FuncAnimation
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
# Serial settings (change COM port and baud rate as needed)
|
# Serial settings (change COM port and baud rate as needed)
|
||||||
SERIAL_PORT = 'COM3' # e.g., 'COM3' on Windows or '/dev/ttyUSB0' on Linux/Mac
|
SERIAL_PORT = '/dev/ttyACM0' # e.g., 'COM3' on Windows or '/dev/ttyUSB0' on Linux/Mac
|
||||||
BAUD_RATE = 9600
|
BAUD_RATE = 115200
|
||||||
|
|
||||||
# Open serial connection
|
# Open serial connection
|
||||||
ser = serial.Serial(SERIAL_PORT, BAUD_RATE, timeout=1)
|
ser = serial.Serial(SERIAL_PORT, BAUD_RATE, timeout=1)
|
||||||
@@ -68,7 +68,8 @@ def get_faces(vertices):
|
|||||||
fig = plt.figure()
|
fig = plt.figure()
|
||||||
ax = fig.add_subplot(111, projection='3d')
|
ax = fig.add_subplot(111, projection='3d')
|
||||||
box = create_box()
|
box = create_box()
|
||||||
collection = Poly3DCollection([], facecolors='skyblue', edgecolors='black', alpha=0.8)
|
c = ['C0'] * 1 + ['C3'] + ['C0'] * 4
|
||||||
|
collection = Poly3DCollection([], facecolors=c, edgecolors='black', alpha=0.90) #facecolors='skyblue',edgecolors='black', alpha=0.8
|
||||||
ax.add_collection3d(collection)
|
ax.add_collection3d(collection)
|
||||||
|
|
||||||
ax.set_xlim([-1, 1])
|
ax.set_xlim([-1, 1])
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ def plot_box(roll, pitch, yaw):
|
|||||||
ax = fig.add_subplot(111, projection='3d')
|
ax = fig.add_subplot(111, projection='3d')
|
||||||
|
|
||||||
# Draw box
|
# Draw box
|
||||||
ax.add_collection3d(Poly3DCollection(faces, facecolors='skyblue', edgecolors='black', linewidths=1, alpha=0.9))
|
c = ['C0'] * 1 + ['C3'] + ['C0'] * 4
|
||||||
|
ax.add_collection3d(Poly3DCollection(faces, facecolors=c, edgecolors='black', alpha=0.90))
|
||||||
|
|
||||||
# Axis setup
|
# Axis setup
|
||||||
ax.set_xlim([-1, 1])
|
ax.set_xlim([-1, 1])
|
||||||
|
|||||||
Reference in New Issue
Block a user