Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
b640df0
code for new intake with wrist (#58)
danielbrownmsm Mar 23, 2023
3dd924a
feat/field-oriented-scoring (#62)
danielbrownmsm Mar 24, 2023
9759771
fix arm offset
danielbrownmsm Mar 25, 2023
1a284b5
Feat/wrist intake (#63)
danielbrownmsm Mar 25, 2023
25d4aeb
Merge branch 'scoring-integration' of https://github.com/Team-OKC-Rob…
danielbrownmsm Mar 25, 2023
298a021
fix intake wrist tilt encoder port
danielbrownmsm Mar 26, 2023
48aaeed
log the intake tilt output, setpoint, and sensor reading
danielbrownmsm Mar 26, 2023
b6f74a7
field-oriented intake tilting commands
danielbrownmsm Mar 26, 2023
0050fb7
wrap the tilt encoder because the zero-point is in a really annoying …
danielbrownmsm Mar 26, 2023
c7245a3
log the intake wrist values, and show them on shuffleboard,
danielbrownmsm Mar 26, 2023
917d674
if arm is close to 0 and trying to go to 0 then prevent it from oscil…
danielbrownmsm Mar 26, 2023
e5f1f32
reset gyro command bound to A-button
danielbrownmsm Mar 26, 2023
04c215f
added wrist setpoint to shuffleboard
danielbrownmsm Mar 26, 2023
e8aad74
made intake faster
danielbrownmsm Mar 26, 2023
5a33808
Merge branch 'master' into scoring-integration
danielbrownmsm Mar 26, 2023
895e017
started work on a command to pause auton execution for the arm
danielbrownmsm Mar 26, 2023
df3645d
Merge branch 'scoring-integration' of https://github.com/Team-OKC-Rob…
danielbrownmsm Mar 26, 2023
0408639
wrist setpoint on shuffleboard
danielbrownmsm Mar 27, 2023
fb8667c
fix extend thresholds/setpoints because we replaced the gearboxes
danielbrownmsm Mar 27, 2023
7b05742
intake wrist tilt tuning and fixing
danielbrownmsm Mar 27, 2023
3e82c1b
code no workey tilt then move claw arm thingy
danielbrownmsm Mar 27, 2023
563bdf3
Improved and Tuned Arm and Added ff to arm control
deadlyvortex Mar 28, 2023
7342a3c
fix arm setpoint, fix some intake setpoints, make the intake a little…
danielbrownmsm Mar 28, 2023
f466b8c
don't have the intake tilt to a 0 position inside the robot because w…
danielbrownmsm Mar 28, 2023
3cf9026
fix that last commit
danielbrownmsm Mar 28, 2023
cf670b0
log
danielbrownmsm Mar 28, 2023
61d5a25
make rhe a button have field-oriented human player station presets (t…
danielbrownmsm Mar 29, 2023
9e2d332
start work on a python arm vizualization script
danielbrownmsm Mar 30, 2023
24f12b4
Merge branch 'master' into Arm-Improvement-and-Tuning
danielbrownmsm Mar 30, 2023
53fa082
Merge branch 'feat/gyro-reset-button' into feat/GKC
danielbrownmsm Mar 30, 2023
5dd0f70
Merge branch 'Arm-Improvement-and-Tuning' into feat/GKC
danielbrownmsm Mar 30, 2023
deb2258
Merge branch 'feat/arm_viz' into feat/GKC
danielbrownmsm Mar 30, 2023
a0e9de3
made log-processing script only display the graphs if it's being run …
danielbrownmsm Mar 30, 2023
83f834e
expanded the arm-viz script so now we can actually visualize the arm …
danielbrownmsm Mar 30, 2023
ed4e7fc
add drawing the arm setpoint to the arm-viz script
danielbrownmsm Mar 30, 2023
fd3791f
fixed auton making the wrist go the wrong way
danielbrownmsm Mar 30, 2023
53faa18
raised intake power
danielbrownmsm Mar 30, 2023
c3c07dd
don't build unit tests at competition for faster deploy times
danielbrownmsm Mar 30, 2023
40a6894
fix setpoints
danielbrownmsm Mar 30, 2023
c924468
raise intake power, lower driving speed
danielbrownmsm Mar 30, 2023
ed27019
fix all the autos to use intake position
danielbrownmsm Mar 30, 2023
2804388
current limiting for intake
danielbrownmsm Mar 30, 2023
b81cee9
invert drive stick because it's going the wrong way
danielbrownmsm Mar 30, 2023
f5b2440
parameter tuning
danielbrownmsm Mar 30, 2023
0a8add1
palm the cube instead of intake it (we can't pick up cones from the g…
danielbrownmsm Mar 30, 2023
f61fdfa
actually use the length setpoint instead of moving both with the enco…
danielbrownmsm Mar 31, 2023
757c9c3
auto-balance tuning, invert strafing too, don't break our tilt at the…
danielbrownmsm Mar 31, 2023
d71c212
practice match logs
danielbrownmsm Mar 31, 2023
a00ebe4
competition logs
danielbrownmsm Mar 31, 2023
b9ecff9
honeslty not sure what I changed, don't care, also removed a bunch of…
danielbrownmsm Mar 31, 2023
b80ed3b
brought some of the old parameters back for old intake
danielbrownmsm Mar 31, 2023
50dd18c
drive forward auto actually
danielbrownmsm Mar 31, 2023
67e5ba6
draw the joystick values as well in the arm_viz script
danielbrownmsm Apr 3, 2023
f9fc4f3
decrease acceleration, and add the drive forwards auto to the chooser
danielbrownmsm Apr 3, 2023
c5a126b
modules are not in a square
danielbrownmsm Apr 3, 2023
c2fac6c
change limit switch port on RIO trying to troubleshoot
danielbrownmsm Apr 3, 2023
ed93eb7
make calibration faster
danielbrownmsm Apr 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __pycache__/process_wpilib_logs.cpython-311.pyc
Binary file not shown.
107 changes: 107 additions & 0 deletions arm_viz.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import pygame, time
from math import sin, cos, radians
import process_wpilib_logs

BASE_ARM_LENGTH = 200
WIDTH = 800
HEIGHT = 800
HEIGHT_OFFSET = 0
WIDTH_OFFSET = 150
WHEEL_LENGTH = 100

# state variables
arm_length_ = 0
arm_tilt_ = 0
intake_tilt_ = 0

pygame.init()

# R, G, B
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
BLUE = (0, 0, 255)
LIGHT_BLUE = (100, 100, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)

# create our hardware surface object
screen = pygame.display.set_mode((WIDTH, HEIGHT))

# set the title for the window
pygame.display.set_caption("ArmViz v 0.2")

# go ahead and clear window
screen.fill(WHITE)

# make ourselves a font for displaying text
font = pygame.font.Font(None, 48)

# make ourselves a clock as well
clock = pygame.time.Clock()

print(len(process_wpilib_logs.liftEncLog[1]))

index = 0
frame = 0
advance = False

# search for where the setpoint changes (where things actually start to happen)
for idx, setpoint in enumerate(process_wpilib_logs.liftSetpointLog[1]):
if setpoint != 0:
index = idx
break

# for idx, val in enumerate(process_wpilib_logs.joystickTurnLog[1]):
# if val != 0:
# index = idx
# break

# main loop
while True:
screen.fill(WHITE)

for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
raise SystemExit
elif event.type == pygame.KEYDOWN:
pass

length_setpoint_ = BASE_ARM_LENGTH + process_wpilib_logs.extendSetpointLog[1][index]
arm_length_ = BASE_ARM_LENGTH + process_wpilib_logs.extendEncLog[1][index]

# draw the setpoint
setpoint_x = sin(radians(process_wpilib_logs.liftSetpointLog[1][index])) * length_setpoint_ + WIDTH//2 + WIDTH_OFFSET
setpoint_y = cos(radians(process_wpilib_logs.liftSetpointLog[1][index])) * length_setpoint_ + HEIGHT//2 + HEIGHT_OFFSET
pygame.draw.line(screen, LIGHT_BLUE, (WIDTH//2 + WIDTH_OFFSET, HEIGHT//2 + HEIGHT_OFFSET), (setpoint_x, setpoint_y), 20)

# draw the current arm tilt from the middle of the window with a length of BASE_ARM_LENGTH, and a width of 10
x = sin(radians(process_wpilib_logs.liftEncLog[1][index])) * arm_length_ + WIDTH//2 + WIDTH_OFFSET
y = cos(radians(process_wpilib_logs.liftEncLog[1][index])) * arm_length_ + HEIGHT//2 + HEIGHT_OFFSET
pygame.draw.line(screen, BLUE, (WIDTH//2 + WIDTH_OFFSET, HEIGHT//2 - HEIGHT_OFFSET), (x, y), 15)

# draw the non-arm swerve drive stuff (for the heck of it, otherwise watching this is too boring)
# |\
# y | \
# | \
# | \
# ====== x
steer_x = sin(radians(process_wpilib_logs.steerEncLog[1][index])) * WHEEL_LENGTH + WIDTH//2 - WIDTH_OFFSET
steer_y = cos(radians(process_wpilib_logs.steerEncLog[1][index])) * WHEEL_LENGTH + HEIGHT//2 - HEIGHT_OFFSET
pygame.draw.line(screen, GREEN, (WIDTH//2 - WIDTH_OFFSET, HEIGHT//2 - HEIGHT_OFFSET), (steer_x, steer_y), 15)
pygame.draw.line(screen, GREEN, (steer_x, steer_y), (WIDTH//2 - WIDTH_OFFSET, HEIGHT//2 - HEIGHT_OFFSET), 15)

# draw the joystick values as well
# turn is simply a horizontal line back and forth
pygame.draw.line(screen, GREEN, (WIDTH//2 + WIDTH_OFFSET, HEIGHT//4 - HEIGHT_OFFSET*2), (WIDTH//2 + WIDTH_OFFSET + process_wpilib_logs.joystickTurnLog[1][index] * 25, HEIGHT//4 - HEIGHT_OFFSET*2), 10)

# and then we'll make the drive+strafe a vector. actually, I might not need to do anything fancy here
pygame.draw.line(screen, RED, (WIDTH//2 - WIDTH_OFFSET, HEIGHT//4 - HEIGHT_OFFSET*2), (WIDTH//2 - WIDTH_OFFSET + process_wpilib_logs.joystickStrafeLog[1][index] * 100, HEIGHT//4 - HEIGHT_OFFSET*2 + process_wpilib_logs.joystickDriveLog[1][index] * 40), 15)

pygame.display.flip()

# calculate time difference
if index > 1:
delta_t = process_wpilib_logs.driveOutputLog[0][index] - process_wpilib_logs.driveOutputLog[0][index - 1]
time.sleep(delta_t)
index += 1
Binary file added logs/FRC_20230330_183315_MOKC_P4.wpilog
Binary file not shown.
Binary file added logs/FRC_20230330_191637_MOKC_P8.wpilog
Binary file not shown.
Binary file added logs/FRC_20230331_140811_MOKC_Q2.wpilog
Binary file not shown.
Binary file added logs/FRC_20230331_150043_MOKC_Q8.wpilog
Binary file not shown.
Binary file added logs/FRC_20230331_160108_MOKC_Q13.wpilog
Binary file not shown.
Binary file added logs/FRC_20230331_181809_MOKC_Q23.wpilog
Binary file not shown.
Loading