SLHS-Robotics / SLHS-Offseason-2024

BSD 3-Clause Clear License
0 stars 0 forks source link

Create basic drive #3

Closed sevenbitscience closed 1 month ago

sevenbitscience commented 3 months ago

Make some basic controls that can drive the robot forwards and backward, as well as rotating to turn left and right

sevenbitscience commented 3 months ago

Basics of Tele-Op control

Control will happen within the while (opModeIsActive()) loop

Moving stuff

Servos move when you call the setPosition, and motors move when you call the setPower

Both of those functions take a double (decimal number) as input

Getting input

FTC SDK provides two variable for input from the gamepads

gamepad1 and gamepad2

You get input from the user from variables inside of those things

We can get:

You get one of these values by calling something like this

gamepad1.a

If you keep track of how the inputs are changing over time, you can do edge detection

Control

You can use logic stuff to control how you move the stuff based on what input you are getting

You probably want to make sure that when you're pressing nothing, the stuff is not moving

darthchicken4 commented 3 months ago

I created some basic stuff, probably needs heavy adjusting. When Joey is back I think he'll help review code and then I can commit it.

sevenbitscience commented 3 months ago

You could commit it to your branch, I can probably take a look sometime tonight (till like 2 AM your time)

darthchicken4 commented 2 months ago

Oh my bad, didn't see this till now 😅😅

darthchicken4 commented 2 months ago

I found some things to revise and I am going to rewrite some of it

darthchicken4 commented 2 months ago

I think I committed it, let me know if it didn't work

sevenbitscience commented 2 months ago

We tested the drive, and it needs some improvements. The first change is that it currently rotates in the opposite direction that we want it. It also currently does not have any speed control, so we would like to add that. It could also be beneficial to improve the control flow for the driving code.