Cov txheej txheem:

Yuav Sau Li Cas Sau Yooj Yim Rau FRC (Java): 12 Cov Kauj Ruam (nrog Duab)
Yuav Sau Li Cas Sau Yooj Yim Rau FRC (Java): 12 Cov Kauj Ruam (nrog Duab)

Video: Yuav Sau Li Cas Sau Yooj Yim Rau FRC (Java): 12 Cov Kauj Ruam (nrog Duab)

Video: Yuav Sau Li Cas Sau Yooj Yim Rau FRC (Java): 12 Cov Kauj Ruam (nrog Duab)
Video: yuav coj li cas kom luag nyiam 2024, Kaum ib hlis
Anonim
Yuav Ua Li Cas Sau Yooj Yim Tsav Tsheb rau FRC (Java)
Yuav Ua Li Cas Sau Yooj Yim Tsav Tsheb rau FRC (Java)

Nov yog cov lus qhia yuav ua li cas thiaj ua tau yooj yim drivetrain rau FRC neeg hlau. Cov ntawv qhia no xav tias koj paub tias pib ntawm java, dab noj hnub thiab twb tau teeb tsa wpilib, ntxiv rau CTRE cov tsev qiv ntawv.

Kauj ruam 1:

Duab
Duab

Qhib dab noj hnub

Kauj Ruam 2: Tsim Txoj Haujlwm Neeg Hlau Tshiab

Tsim Txoj Haujlwm Neeg Hlau Tshiab
Tsim Txoj Haujlwm Neeg Hlau Tshiab
Tsim Txoj Haujlwm Neeg Hlau Tshiab
Tsim Txoj Haujlwm Neeg Hlau Tshiab
Tsim Txoj Haujlwm Neeg Hlau Tshiab
Tsim Txoj Haujlwm Neeg Hlau Tshiab
Tsim Txoj Haujlwm Neeg Hlau Tshiab
Tsim Txoj Haujlwm Neeg Hlau Tshiab
  1. Txoj nyem rau ntawm pob tshawb nrhiav, nyem tshiab, tom qab ntawd lwm yam.
  2. Nqes mus txog thaum koj pom WPILib Neeg Hlau Java Kev Txhim Kho (yog tias koj tsis pom nws koj tsis muaj wpilib cov peev txheej teeb tsa.)
  3. Nyem rau ntawm Robot Java Project
  4. Tom qab ntawd sau rau hauv qhov project lub npe thiab nyem qhov hais kom ua raws cov neeg hlau qhov project. (Pob yuav tsum tau ua tiav thiab zoo ib yam nrog simulation ntiaj teb.)

Kauj Ruam 3: Tsim/Sau rau RobotMap

Tsim/Sau hauv RobotMap
Tsim/Sau hauv RobotMap
Tsim/Sau hauv RobotMap
Tsim/Sau hauv RobotMap

Tsim qhov hloov pauv kawg uas muaj tus lej ntawm qhov sib txawv talon ports

Kauj Ruam 4: Rho Tawm Piv Txwv Cov Lus Qhia thiab Piv Txwv Subsystem

Rho tawm Piv txwv hais kom ua thiab piv txwv Subsystem
Rho tawm Piv txwv hais kom ua thiab piv txwv Subsystem
Rho tawm Piv txwv hais kom ua thiab piv txwv Subsystem
Rho tawm Piv txwv hais kom ua thiab piv txwv Subsystem

Kauj Ruam 5: Tsim DriveTrainSubSystem

Tsim DriveTrainSubSystem
Tsim DriveTrainSubSystem
Tsim DriveTrainSubSystem
Tsim DriveTrainSubSystem
Tsim DriveTrainSubSystem
Tsim DriveTrainSubSystem
  1. Tsim tus tsim tshiab hauv qhov tsim tshiab drivetrain subsystem. Tom qab ntawd tsim CANTalon cov khoom uas cuam tshuam nrog cov dab neeg ntawm lub tshuab tsav.
  2. Tsim RobotDrive hu ua Drive
  3. Instantiate Cov Hom Phiaj no hauv tus tsim (nco ntsoov siv qhov txiaj ntsig rau cov dab neeg uas peb tsim hauv daim ntawv qhia neeg hlau). Txog rau Robot Drive peb yuav siv tus tsim khoom uas siv 4 Tus Tswj Lub Cev (RobotDrive (SpeedController frontLeftMotor, SpeedController rearLeftMotor, SpeedController frontRightMotor, SpeedController rearRightMotor))
  4. Tom qab ntawd tsim qhov arcadeDrive () txoj hauv kev nrog ob qhov kev hloov pauv tau yog x yog rau pem hauv ntej thiab rov qab thiab y yog txoj cai thiab sab laug. Sab hauv koj yuav hu rau drive.arcade nrog rau pem hauv ntej thiab tig qhov tseem ceeb
  5. Tom qab ntawd hloov pauv initDefaultCommand () kom muaj kab setDefaultCommand (DriveTrainCommand tshiab ());.
  6. Tsis txhob txhawj xeeb txog txhua qhov ua tsis raug.

Kauj Ruam 6: Tsim DriveTrainCommand

Tsim DriveTrainCommand
Tsim DriveTrainCommand
Tsim DriveTrainCommand
Tsim DriveTrainCommand
Tsim DriveTrainCommand
Tsim DriveTrainCommand
Tsim DriveTrainCommand
Tsim DriveTrainCommand
  1. Thawj zaug pib los ntawm kev mus rau cov ntawv qhia zaub mov uas peb tau siv los tsim lub hauv paus thiab cov neeg hlau ua haujlwm nws tus kheej (qhov no yog zaum kawg kuv yuav qhia qhov no tiag tiag hauv cov kauj ruam yav tom ntej Kuv yuav hais tsuas yog ua kom hais kom ua lossis ua subsystem thiab koj yuav xav tias nws nyob hauv cov ntawv qhia zaub mov no.) Nyem qhov hais kom ua thiab sau cov npe hauv chav kawm nrog DriveTrainCommand (yog tias koj hloov cov npe ntawm cov ntawv no koj tsis tuaj yeem muaj lawv ib yam).
  2. Hauv DriveTrainCommand tshiab koj yuav pom tias muaj 6 txoj hauv kev ib tus yog tus tsim thiab lwm 5 yog ib feem ntawm cov cai uas neeg hlau yuav hu thaum cov lus txib ua haujlwm. Peb paub tias tus tsim khoom ua dab tsi thiaj li piav qhia Initialize, ua tiav, ua tiav, xaus, thiab cuam tshuam. Initialize yog hu ua ib zaug txhua lub sijhawm hais kom ua hu ua, txoj kev ua haujlwm raug hu ua txuas ntxiv mus txog thaum cov lus txib xaus, uas yog tshwm sim los ntawm kev ua tiav thaum isFinished txoj kev rov muaj tseeb cov lus txib yuav tsum tsis ua haujlwm, Txoj kev kawg yog hu ua ib zaug tom qab isFinished txoj kev raug hu, thiab kev cuam tshuam tau raug hu thaum cov lus txib cov peev txheej tau siv los ntawm lwm cov lus txib thiab cov lus txib yuav xaus (yam tsis tau hu txoj kev kawg).
  3. Ua ntej hauv DriveTrainCommand hauv tus tsim koj yuav tsum ntxiv kab uas xav tau (yuav tsum tau (Robot. DriveTrainSub)) ceeb toom tias DriveTrainSub tsis zoo ib yam li lub npe subsystem thiab uas yog lub hom phiaj.

Kauj Ruam 7: Dhia rau Neeg Hlau

Dhia mus rau Neeg Hlau
Dhia mus rau Neeg Hlau
Dhia mus rau Neeg Hlau
Dhia mus rau Neeg Hlau
Dhia mus rau Neeg Hlau
Dhia mus rau Neeg Hlau
Dhia mus rau Neeg Hlau
Dhia mus rau Neeg Hlau
  1. Tom ntej no peb yuav dhia mus rau Chav Kawm Neeg Hlau
  2. tom qab ntawd peb yuav hloov txoj kab (pej xeem zoo li qub piv txwvSubsystem piv txwvSubsystem = tshiab piv txwvSubsystem ();) mus rau (pej xeem zoo li qub DriveTrainSubsystem DriveTrainSub = tshiab DriveTrainSubsystem ();) pom thawj lub npe tom qab zaum kawg yog tib yam li lub npe subsystem thiab lub npe tom qab tshiab kuj pom tias DriveTrainSub zoo ib yam li lub npe uas peb muab tso rau hauv peb cov kauj ruam kawg thiab nws tsis zoo ib yam li lub npe subsystem (Koj YUAV TSUM muaj lub npe khoom (DriveTrainSub) uas tsis zoo ib yam li lub subsystem npe).
  3. Tom qab ntawv ntshuam peb DriveTrainSubSystem.
  4. Tom ntej no peb yuav tshem kab (chooser.addDefault ("Default Auto", Piv txwv tshiabCommand ());)
  5. Tom qab ntawd tshem tawm cov khoom siv uas tsis siv.
  6. Ces txuag.

Kauj Ruam 8: Rov Qab Mus rau DriveTrainCommand

Rov qab mus rau DriveTrainCommand
Rov qab mus rau DriveTrainCommand
  1. ntshuam neeg hlau (tus thib ob hauv daim duab)
  2. Ces Txuag

Kauj ruam 9: Mus rau DriveTrainSub

Mus rau DriveTrainSub
Mus rau DriveTrainSub
  1. Ntshuam DriveTrainCommand
  2. Ces txuag.

Kauj Ruam 10: Tom ntej no Peb Yuav Tsim OI Code

Tom ntej no Peb Yuav Tsim OI Code
Tom ntej no Peb Yuav Tsim OI Code
  1. Mus rau OI.
  2. Tsim cov khoom siv pej xeem joystick tshiab nrog qhov chaw nres nkoj 0.
  3. Thiab tshem tawm cov khoom siv uas tsis siv.
  4. Txuag.

Kauj ruam 11: Mus rau DriveTrainCommand

Mus rau DriveTrainCommand
Mus rau DriveTrainCommand
  1. Mus rau DriveTrainCommand.
  2. Tam sim no peb yuav ua ib feem uas coj tus joysticks thiab siv lawv txav tus neeg hlau. Sab hauv qhov ua tiav (vim nws ua tas li) ntxiv kab (Robot. DriveTrainSub.arcadeDrive (Robot.oi. Driver.getRawAxis (1), Robot.oi. Driver.getRawAxis (4));) qhov twg peb hu arcadeDrive hauv peb subsystem nrog qhov muaj nuj nqis ntawm Robot.io. Driver.getRawAxis (1) uas rov qab tus nqi ntawm tus joystick thiab qhov twg 1 yog txoj kab ntawm sab laug y axis thiab zoo ib yam rau tus nqi thib ob tshwj tsis yog 4 yog txoj cai x axis. yog li qhov no yuav txhais tau tias sab laug yuav mus rau tom ntej thiab thim rov qab thiab txoj cai lo yuav mus rau sab xis thiab sab laug. (yog tias koj xav tau koj tuaj yeem rov qab mus rau RobotMap thiab tsim qhov txiaj ntsig tshiab rau lub axis joystick ces hu lawv nrog RobotMap. (lub npe ntawm axis) thiab tsis txhob hnov qab ua lawv kawg yog tias koj ua li no.)
  3. Tom ntej tshem tawm cov khoom siv uas tsis siv los ntawm tag nrho txoj haujlwm.

Kauj Ruam 12: Thaum kawg Sau thiab Xa Cov Cai rau Tus Neeg Hlau

Pom zoo: