From 20204c73e28686415c4ab4de1dadb54c6b9daec3 Mon Sep 17 00:00:00 2001 From: hell0w0rld2 <43834630+hell0w0rld2@users.noreply.github.com> Date: Tue, 13 Nov 2018 19:51:28 -0700 Subject: [PATCH 1/4] created file to test pull requests --- pygame/myfile.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 pygame/myfile.txt diff --git a/pygame/myfile.txt b/pygame/myfile.txt new file mode 100644 index 0000000..5ab2f8a --- /dev/null +++ b/pygame/myfile.txt @@ -0,0 +1 @@ +Hello \ No newline at end of file From a4252a4372671bf1e16a4ee76569d01be8985849 Mon Sep 17 00:00:00 2001 From: hell0w0rld2 <43834630+hell0w0rld2@users.noreply.github.com> Date: Wed, 28 Nov 2018 20:17:36 -0700 Subject: [PATCH 2/4] Created spinning robot --- robot/robot/__pycache__/physics.cpython-37.pyc | Bin 0 -> 1454 bytes robot/robot/robot.py | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 robot/robot/__pycache__/physics.cpython-37.pyc diff --git a/robot/robot/__pycache__/physics.cpython-37.pyc b/robot/robot/__pycache__/physics.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a282469b1b1841ef242a0233b44e00ca505b52e8 GIT binary patch literal 1454 zcmZux&5j&35VreoCYub3R#8Z9K5&@>BR~kj3PlMMl$=(eT?8~EIbPen)4SdF#CB&j ztKJiNkj*i#!DIB5Q|_ENQFixi(tt-*W0zf@tG+7tceB|Zg7MWKfBklpA@rwT>_!5U z#~_w~5=h_*)i}o(JwqZA@oOYv8T}sTu}F^4JbeeJ&>VNSg(+W2XIQB$_qN@LVDcCw z;7OEYf$~UT@DFHtA`+3lMtLeSz?*clAJ$u2a{IkHEtS0dagX%lsH~fcIcW(aUw(SA zma-zX0_eGRMlv3Dtlz!w13oK@r_lH#b zaxHd8xWCnR77P3knh7L+h;E~+WUwSRmeiqZ+$L@MCR#;T+0~>)XVG=s zX6>Yn-^3XGjMOI>`JYG zkEjlnmJY}wg*IV#WAv#nzmnhsMLLlqux2BmTw*aYjuu1vD1C82j^R4q7z6YZSJsj+ z-_k{;*|<*zA6HXR7DeyJYTbaFE_zS5W{#}Ef5WVW(BJ`Z86vKj9i#ob-NMbm->pl? zv{BsoM!Nts9>}>#po^DJ4&MQTs7qh5s*%Re59f*TJ&@mX7n;`EX+z(C148$8X)w&E zCiTwKHLEBv#kv@X=q5vE`K0RI^NHyvU1~SLbQc@#LjU$^;z9O$vMIcck6~@^fo5B;j6aNGL C0(UO} literal 0 HcmV?d00001 diff --git a/robot/robot/robot.py b/robot/robot/robot.py index d11cc62..a22eec7 100644 --- a/robot/robot/robot.py +++ b/robot/robot/robot.py @@ -6,16 +6,28 @@ import wpilib import commandbased - +import ctre #main robot + + class MyRobot(commandbased.CommandBasedRobot): - pass + def robotInit(self): + self.motors = {} + self.motors['leftMotor'] = ctre.WPI_TalonSRX(0) + self.motors['rightMotor'] = ctre.WPI_TalonSRX(1) + def testInit(self): + print("Test Mode") + while self.isTest(): + self.motors['leftMotor'].set(10) + self.motors['rightMotor'].set(10) + print("Test Done") + From 621ea2c63d568091261b99403acd134b3412a680 Mon Sep 17 00:00:00 2001 From: hell0w0rld2 <43834630+hell0w0rld2@users.noreply.github.com> Date: Wed, 12 Dec 2018 18:35:29 -0700 Subject: [PATCH 3/4] Got robot moving again --- .../robot/__pycache__/physics.cpython-37.pyc | Bin 1454 -> 1568 bytes robot/robot/__pycache__/robot.cpython-37.pyc | Bin 0 -> 1148 bytes .../__pycache__/joystickDrive.cpython-37.pyc | Bin 0 -> 1035 bytes robot/robot/commands/joystickDrive.py | 22 +++++++++++ robot/robot/physics.py | 15 +++++-- robot/robot/robot.py | 37 +++++++++--------- .../__pycache__/driveTrain.cpython-37.pyc | Bin 0 -> 1650 bytes robot/robot/subsystems/driveTrain.py | 34 ++++++++++++++++ 8 files changed, 86 insertions(+), 22 deletions(-) create mode 100644 robot/robot/__pycache__/robot.cpython-37.pyc create mode 100644 robot/robot/commands/__pycache__/joystickDrive.cpython-37.pyc create mode 100644 robot/robot/commands/joystickDrive.py create mode 100644 robot/robot/subsystems/__pycache__/driveTrain.cpython-37.pyc create mode 100644 robot/robot/subsystems/driveTrain.py diff --git a/robot/robot/__pycache__/physics.cpython-37.pyc b/robot/robot/__pycache__/physics.cpython-37.pyc index a282469b1b1841ef242a0233b44e00ca505b52e8..d9c92316acc8a5bea9074fff5691f837a7294495 100644 GIT binary patch delta 293 zcmZ3-y?}?$iIQavq&;c2tzG%3Bv-$8kQQ?g_GAXDJiqE04)GYGGs9=U`}C80V-R_%*YVQkjE6k zkis6!pvkfMBa(fErWng$lO9E_81utYElPc~$&1ppojKB@o! delta 170 zcmZ3$vyPk3iIAtdoB*X)Cj^0Oe{~YZ$Va7BHulmg&2icCVR0)FbYjx%vuWo DAu1%n diff --git a/robot/robot/__pycache__/robot.cpython-37.pyc b/robot/robot/__pycache__/robot.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0ebde78ac3d1e0cc3931cb0ad96cc494d8504faf GIT binary patch literal 1148 zcmZWnO>fgc5Z(1h?3jkOftIT!B&1v-;8dZis+vj#qy~u=Q6h_#?cFv`{SkK8ZIf#& z(F6R4a^x@Vl@osfabR}S&_Xxanc4OD&AfTuYPA9c>-QHwT5}Nkp%3%bfM650n1Z2b zfGDO`jtAIyYhW2~51buDZR%Vg>M(2Mp4)>4b!p=Q4Ls&k@7UrelQwHIJPJnlM&3Eb z=shY|G15Qg&F+c!0hQJPg3|(PP@guxS{PAl4|Rg+#~_5YKg>i3|2U+qsKPO?j(A*z zVpyGKv@&Nx!8bUmfgXo|4x(Z@hSg^Ni!f7h&mAyAz2|*K=tTN zebq7@ns~2HluM;{jni?KXNkIhkW^>AnS?pxYSFxTa{=XCsAK5QWBtvl=HDKd;VASS z!b{eDJYBxSq7Op)gp_f?2vGqcMMdje#|wmfs^fh2gf9VxsdUR|U_*5g0--tkmO0;1 zu%{EWf<|ZDzwTKzIFl!F{vW1t*jXl@%s~<6D-i283s8-aeNcXJJe-Iu6@-;>k~7+A zDUT3ZrG)U7&R$5XqKHeH#DY<^a-%@^MgZQ_najOd=9bPhf*BH~DAyBI?wDt#R4&Pi vajqQQg|c~F-s)R_gWOEtU!RR|LyIF;!8n$WecN~1k9^0+7H;DPUc!F>=T97} literal 0 HcmV?d00001 diff --git a/robot/robot/commands/__pycache__/joystickDrive.cpython-37.pyc b/robot/robot/commands/__pycache__/joystickDrive.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..077404a22dcd2714704815fc07895a6b586d05c9 GIT binary patch literal 1035 zcmY*Y&2G~`5Z+zei5n8&0G#*00bi=Z2_b}lR4U?7Bw8-U(#r8}Tc?iQ?ymb2xffcg zw?0F9Drn%@jK$nHUIc($yssc+fb|HI@ijyfwVjIBx0>^RI#UfP!4Ec6Cx{8V}$rget#doNxm7S zO)^chL!EpnmCK)OR#`n$r8UV`Za>wN`_Rdnm+lofe&^FNCZzAsmtV304|)!^>1rfa7l;5!Lwr)Yy*3jUdXyLWWWAf3#)Wjwf4S}f3*RnVd*}8QV~6YyAAApB literal 0 HcmV?d00001 diff --git a/robot/robot/commands/joystickDrive.py b/robot/robot/commands/joystickDrive.py new file mode 100644 index 0000000..972525a --- /dev/null +++ b/robot/robot/commands/joystickDrive.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +from wpilib.command import Command + +class JoystickDrive(Command): + """ + This command will reaad the joystick values that are used + to ocntrol the robot drive train and then set the drivetrain subsystem + """ + + def __init__(self, robot): + super().__init__("Joystick Drive") + self.robot = robot + self.requires(self.robot.dtSub) + + def execute(self): + dc = self.robot.driveController + leftSide = dc.getRawAxis(0) + rightSide = dc.getRawAxis(1) + + self.robot.dtSub.setTankDrive(leftSide, rightSide) + \ No newline at end of file diff --git a/robot/robot/physics.py b/robot/robot/physics.py index 7d4fae6..01115aa 100644 --- a/robot/robot/physics.py +++ b/robot/robot/physics.py @@ -33,12 +33,19 @@ def update_sim(self, hal_data, now, tm_diff): # Simulate the drivetrain # -> Remember, in the constructor we inverted the left motors, so # invert the motor values here too! - try: - l_motor = -hal_data['CAN'][1]['value'] - r_motor = -hal_data['CAN'][0]['value'] + try: + if hal_data['CAN'][1]['inverted']: + l_motor = -hal_data['CAN'][1]['value'] + else: + l_motor = hal_data['CAN'][1]['value'] - #print(hal_data['CAN']) + if hal_data['CAN'][0]['inverted']: + r_motor = -hal_data['CAN'][0]['value'] + else: + r_motor = hal_data['CAN'][0]['value'] + #print(hal_data['CAN']) + tm_diff = tm_diff * 0.5 speed,rot = drivetrains.two_motor_drivetrain(l_motor,r_motor) self.physics_controller.drive(speed,rot, tm_diff) except: diff --git a/robot/robot/robot.py b/robot/robot/robot.py index a22eec7..93a737c 100644 --- a/robot/robot/robot.py +++ b/robot/robot/robot.py @@ -6,29 +6,30 @@ import wpilib import commandbased -import ctre -#main robot - -class MyRobot(commandbased.CommandBasedRobot): - def robotInit(self): - self.motors = {} - self.motors['leftMotor'] = ctre.WPI_TalonSRX(0) - self.motors['rightMotor'] = ctre.WPI_TalonSRX(1) - +import subsystems.driveTrain - - def testInit(self): - print("Test Mode") - while self.isTest(): - self.motors['leftMotor'].set(10) - self.motors['rightMotor'].set(10) - print("Test Done") - - +class MyRobot(commandbased.CommandBasedRobot): + + def robotInit(self): + MyRobot.getRobot = lambda x=0:self + + self.dtSub = subsystems.driveTrain.DriveTrainSub(self) + self.driveController = wpilib.XboxController(0) + +# def teleopInit(self): +# print("Test Mode") +# dc = self.driveController +# while self.isOperatorControl(): +# leftSide = dc.getRawAxis(0) +# rightSide = dc.getRawAxis(1) +# +# self.dtSub.setTankDrive(leftSide, rightSide) +# +# print("Test Done") #code to help run the robot diff --git a/robot/robot/subsystems/__pycache__/driveTrain.cpython-37.pyc b/robot/robot/subsystems/__pycache__/driveTrain.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8305f48c5f73618c84979f00a7b421b48de04aeb GIT binary patch literal 1650 zcmbVMOK;pZ5GJX|YS-Ezc8eeg(m=OjfnbsL6cjC~32{Z{;qBxW715Z|`u{sE0Y*!4&jN5`#VcQQ1dTAT=J zf;24vLz)`TM#5~^E3KU}Zmy*;;jeqo(}S#R>iwU7GmLYyxl_z$LW)`!S!qLWM%K<| zV8V>6L^+elMkGU;=4GZ-n*L4xjkmu_epW)NWS-?OW%6S!>;=hAlP@Z`Q6FZFpj+kYOQg1g^mDOBg@H?*9XkLf6g$%uF z6M;z|zUV5%n}>nzK=V4Q1kikxrd7iiCC_oi_<`fHFbtf)vHHo__^(c&)(_*m?KsWb_fJ=RmPm;B zLATAZwx@ip(yYdK?XY=cM Date: Wed, 12 Dec 2018 18:53:31 -0700 Subject: [PATCH 4/4] IDK --- .../robot/__pycache__/physics.cpython-37.pyc | Bin 1568 -> 0 bytes .../__pycache__/joystickDrive.cpython-37.pyc | Bin 1035 -> 0 bytes robot/robot/commands/empty | 0 robot/robot/commands/joystickDrive.py | 22 ------- robot/robot/motorHelper.py | 0 robot/robot/physics.py | 55 ------------------ .../__pycache__/driveTrain.cpython-37.pyc | Bin 1650 -> 1650 bytes 7 files changed, 77 deletions(-) delete mode 100644 robot/robot/__pycache__/physics.cpython-37.pyc delete mode 100644 robot/robot/commands/__pycache__/joystickDrive.cpython-37.pyc delete mode 100644 robot/robot/commands/empty delete mode 100644 robot/robot/commands/joystickDrive.py delete mode 100644 robot/robot/motorHelper.py delete mode 100644 robot/robot/physics.py diff --git a/robot/robot/__pycache__/physics.cpython-37.pyc b/robot/robot/__pycache__/physics.cpython-37.pyc deleted file mode 100644 index d9c92316acc8a5bea9074fff5691f837a7294495..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1568 zcmZux&2A($5Vreodb2wyVk01&d_YKZV8kL0Y=mGTiAfilcd7H|yu-dYy%h{w-S7V`w`O}gnf%e5&B^MyPurMUWbhxFrVSvM84!VpG2 zeD888L`7;*Fxk{Zs}p5OV@i2Sj+s0skDW8*Os$PAi*r&aX|<||w^cZg+;D$Khd{;w z(&83Th#33`uCBKi`|A%@OtYG-df(_^uoC)!JX@_7x|k1J^FnDcA7Xe$)XAAB?8wv* z&;R|b0$1z0k!1mq64QrVDoMm*0d@?r>c-X)p#J)Q9hwDQWJI;lE|I?>oxtz!uMQ9L z?~KqUKV!wY&cBwzLzF*OMNux}}S z%^~OEOs?J-V(#-c-ySKP8*Zcnd9;6r#roG4bG#2#1r+Wh{qC)Gw2$thO(b{6vQ0Fs z<3T68weEG|8y$BBWSh7Rd9sH#p+(oYjoSD{kO!M&GilLTa2>WuJ88ogAx7UL`3^?z z<8cJHgQh>hV-7ali64;+en5Nz6_T=t7@?bNxO5(}suG+)ZAxO7qx|{u5f(B)7E1fw zl~$*&rlbHJ$oz>I8EaM?YJks2!qH-=NvSRm$T3`3G+IL{i7jhEnCp{8rP#Rm1|3^d zUM?2B9;;OYYHHDI+9k7O3HmE$47dheRS55K#mv~+ziZgv?Dg%kgh(4%SXaH5V6E`r z+yu~tho2q21O!o+mhwVqh_#C^Sk(yaq^CeI{`~Z47HL;v*`B>rv{qJW`s%ImRo=y3 zFiUj|2fK91DhlASE(C14$q;Ndse1KnqWeh~n-zfHg<4tPCq07~5p_E~{uFxfO<0?^ zfuU)Dcky1Z8+ab3ZiN$^;;XmD)&ENQXqLEsk*pS!b~_Yq=1t}1_bC0TVb!oRp_HqF zQtkRg-*?P)?k(or(jl-rK*nvRVHBiyybMsvrlW_*gVrVe1LV)#vgJ+tIMa`Nhdyy4 J-^=&He*lbVjpqOW diff --git a/robot/robot/commands/__pycache__/joystickDrive.cpython-37.pyc b/robot/robot/commands/__pycache__/joystickDrive.cpython-37.pyc deleted file mode 100644 index 077404a22dcd2714704815fc07895a6b586d05c9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1035 zcmY*Y&2G~`5Z+zei5n8&0G#*00bi=Z2_b}lR4U?7Bw8-U(#r8}Tc?iQ?ymb2xffcg zw?0F9Drn%@jK$nHUIc($yssc+fb|HI@ijyfwVjIBx0>^RI#UfP!4Ec6Cx{8V}$rget#doNxm7S zO)^chL!EpnmCK)OR#`n$r8UV`Za>wN`_Rdnm+lofe&^FNCZzAsmtV304|)!^>1rfa7l;5!Lwr)Yy*3jUdXyLWWWAf3#)Wjwf4S}f3*RnVd*}8QV~6YyAAApB diff --git a/robot/robot/commands/empty b/robot/robot/commands/empty deleted file mode 100644 index e69de29..0000000 diff --git a/robot/robot/commands/joystickDrive.py b/robot/robot/commands/joystickDrive.py deleted file mode 100644 index 972525a..0000000 --- a/robot/robot/commands/joystickDrive.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- - -from wpilib.command import Command - -class JoystickDrive(Command): - """ - This command will reaad the joystick values that are used - to ocntrol the robot drive train and then set the drivetrain subsystem - """ - - def __init__(self, robot): - super().__init__("Joystick Drive") - self.robot = robot - self.requires(self.robot.dtSub) - - def execute(self): - dc = self.robot.driveController - leftSide = dc.getRawAxis(0) - rightSide = dc.getRawAxis(1) - - self.robot.dtSub.setTankDrive(leftSide, rightSide) - \ No newline at end of file diff --git a/robot/robot/motorHelper.py b/robot/robot/motorHelper.py deleted file mode 100644 index e69de29..0000000 diff --git a/robot/robot/physics.py b/robot/robot/physics.py deleted file mode 100644 index 01115aa..0000000 --- a/robot/robot/physics.py +++ /dev/null @@ -1,55 +0,0 @@ -# -# See the notes for the other physics sample -# - - -from pyfrc.physics import drivetrains - - -class PhysicsEngine(object): - ''' - Simulates a 4-wheel mecanum robot using Tank Drive joystick control - ''' - - def __init__(self, physics_controller): - ''' - :param physics_controller: `pyfrc.physics.core.Physics` object - to communicate simulation effects to - ''' - - self.physics_controller = physics_controller - - - def update_sim(self, hal_data, now, tm_diff): - ''' - Called when the simulation parameters for the program need to be - updated. - - :param now: The current time as a float - :param tm_diff: The amount of time that has passed since the last - time that this function was called - ''' - - # Simulate the drivetrain - # -> Remember, in the constructor we inverted the left motors, so - # invert the motor values here too! - try: - if hal_data['CAN'][1]['inverted']: - l_motor = -hal_data['CAN'][1]['value'] - else: - l_motor = hal_data['CAN'][1]['value'] - - if hal_data['CAN'][0]['inverted']: - r_motor = -hal_data['CAN'][0]['value'] - else: - r_motor = hal_data['CAN'][0]['value'] - - #print(hal_data['CAN']) - tm_diff = tm_diff * 0.5 - speed,rot = drivetrains.two_motor_drivetrain(l_motor,r_motor) - self.physics_controller.drive(speed,rot, tm_diff) - except: - l_motor = r_motor = 0 - self.physics_controller.drive(0,0, tm_diff) - - #.mecanum_drivetrain(lr_motor, rr_motor, lf_motor, rf_motor,speed = 0.01) \ No newline at end of file diff --git a/robot/robot/subsystems/__pycache__/driveTrain.cpython-37.pyc b/robot/robot/subsystems/__pycache__/driveTrain.cpython-37.pyc index 8305f48c5f73618c84979f00a7b421b48de04aeb..0e456248411ca29d20c5eb3bd5e63bae7d50f295 100644 GIT binary patch delta 325 zcmeyw^NEMsiI4R7IRU435q6DmVN<{@hE~qYO)-gk^sUJV3y$I05&B6RAN*3 delta 325 zcmeyw^NEMsiIx1wh852wq{SG>`xZ%76$t zAaRQ~K0Y}ovA8%nH76%N9-&&3u}BD{NMv#?Yk}b{!IaFjwA7;1ypqhs9I%gz_(0M; mAOaL1w|I*3lk!Uf5|gtN(^GFvmSa;AKzIVo5}6#prUU?kh*)g^