Compare commits

...

335 Commits

Author SHA1 Message Date
Patrick Plenefisch
46dc99a115 Adding SFX to tools zip
Change-Id: I09a04506682a5d0ccbe8e556285de587915f7383
2014-12-19 09:52:25 -08:00
Brad Miller (WPI)
91d714d2e9 Merge "Single line bug in CanTalonSRX::GetAnalogInVel(). return value was not being sign-extended." 2014-12-19 07:02:09 -08:00
Brad Miller (WPI)
9a28aaaa7c Merge "Change expected voltage on CAN tests" 2014-12-19 07:01:20 -08:00
Omar Zrien
96a76ba89e Single line bug in CanTalonSRX::GetAnalogInVel(). return value was not being sign-extended.
Change-Id: I44271726ece9aaa7b94f35e611f24a18dbb53825
2014-12-19 03:27:29 -05:00
Brad Miller
d26059a4fb Change expected voltage on CAN tests
Change-Id: I8c4533c7bcc81e7904d10792316382d4c01a840a
2014-12-18 21:22:31 -05:00
Brad Miller
ee0d835304 Remove an extra constructor from a bad merge
Change-Id: I0475eef143814ebf8ee4ec71a019872420442c4f
2014-12-18 18:28:15 -05:00
James Kuszmaul
6080a3b186 Duplicate of gerrit 739; changed method from public to private.
Change-Id: Ib15210ff0e5d8d99a649397499bab4737a1a489e
2014-12-18 16:08:46 -05:00
Omar Zrien
3d06a763a2 CanTalon : Adding config routines for limit switch normally open vs normally closed.
They already existed in Labview, so this will keep parity
New C++/Java funcs
ConfigFwdLimitSwitchNormallyOpen
ConfigRevLimitSwitchNormallyOpen

Change-Id: Ifd65ead827838e7158f7261c67adc3738c72eabf
2014-12-18 15:57:26 -05:00
Omar Zrien
e1480ec798 Noticed that if changeControlMode() is called every teleop loop, it causes motor to stutter as it enters and immediately leaves kDisabled.
A simple improvement was to only perform the disable-before-next-set strategy if the caller's request mode is not equal to the current mode.

To keep things simple, SetControlMode was renamed to private method ApplyControlMode so we can still invoke it from c'tor.
Then, the new impl'n of SetControlMode() just calls ApplyControlMode() when caller's request mode is different.  That takes care of direct-calls from team source, and indirect calls through enableControl().

Applied to both c++ and java.
Tested in java so far...

Change-Id: I934c06c5339d933918470659acd635e12eb4d113
2014-12-18 15:54:47 -05:00
Omar Zrien
a5d9ba412c Second pass through all the HAL functions and cpp/java API. Filled in some parity holes between java and cpp.
Java...
added setStatusFrameRateMs() to modify the frame rate for status frames
added missing func that already exists in c++
	isFwdLimitSwitchClosed()
	isRevLimitSwitchClosed()
	getNumberOfQuadIdxRises()
	getPinStateQuadA()
	getPinStateQuadB()
	getPinStateQuadIdx()
added getAnalogInRaw() that doesn't count overflows (for potentiometers).
added setStatusFrameRateMs() to modify the frame rate for status frames
added getBrakeEnableDuringNeutral()

C++...
added GetAnalogInRaw() that doesn't count overflows (for potentiometers).
added SetStatusFrameRateMs() to modify the frame rate for status frames
added GetBrakeEnableDuringNeutral()
added kLimitMode_SrxDisableSwitchInputs to CANSpeedController::LimitMode

Patch set 2: Joe Ross, fixed two javadoc errors

Change-Id: I0bf871e138953de60eeacb547dc359f2125b1327
2014-12-18 15:51:47 -05:00
Omar Zrien
2434515d41 artf3913
Increased wait delay to 4ms to cover worst case delays for solicted signal getters.
Specifically....
-Get firmware vers
-Get P,I,D,F gains
-Get IZone, Get CloseLoopRampRate
-Get IAccum (integral accumulator)

Change-Id: I313ea984832cce5182af8e5af5e775837fd54fdc
2014-12-18 15:49:29 -05:00
Brad Miller (WPI)
741618250b Merge "C++ CANTalon was missing SetIzone. Added SetIzone to match java, and made the set/get Izone integral." 2014-12-18 12:45:34 -08:00
Omar Zrien
8b8d7e77cd C++ CANTalon was missing SetIzone. Added SetIzone to match java, and made the set/get Izone integral.
Change-Id: I264ac8faaab0ebd208062923f6da2094e7e28b0a
2014-12-18 15:16:10 -05:00
Omar Zrien
c093a553ee changed variable type of closeLoopRampRate in setpid to double from int. It's represents V per sec since it calls setCloseLoopRampRate() underneath.
The other remaining closeloopramprate changes are also merged into this commit, so they may be redundant on gerrit.

Change-Id: Ic3108bb3669e487009b8f52412da3c2f44c42f6f
2014-12-18 15:11:39 -05:00
Fred Silberberg (WPI)
a1375e58cd Merge "Don't fail silently if DIO or PWM allocation fails" 2014-12-18 11:25:39 -08:00
Brad Miller (WPI)
15ff7f5038 Merge "Added the getButtons method back that reads all the buttons at the same time" 2014-12-18 10:33:11 -08:00
Brad Miller
c17ba98f72 Added the getButtons method back that reads all the buttons at the same time
Change-Id: I0f7f35b6a70f861911166de7be3802547ff4b2eb
2014-12-18 10:57:11 -05:00
Brad Miller (WPI)
dee755ab19 Merge "renamed param to match function name." 2014-12-18 07:06:20 -08:00
Brad Miller (WPI)
92c54f5f5d Merge "Image v23" 2014-12-17 15:10:36 -08:00
Fred Silberberg (WPI)
1fde00643f Merge "Fixed post4066 bug: Prestart() inaccessible." 2014-12-17 14:19:03 -08:00
Colby Skeggs
47443b4e1e Fixed post4066 bug: Prestart() inaccessible.
Change-Id: Ie179453b038458e77257c1b2d0acba7a4224f6c4
2014-12-17 13:39:54 -08:00
PetaroMitaro
f01e5b5570 fixed robotCommand in src
Change-Id: I591939301da4427e9139b824b016bb00d4b24485
2014-12-17 16:11:48 -05:00
Fredric Silberberg
22c4207553 Image v23
This updates the image version to version 23. It also moves the vision libraries
to follow the same conventions as the rest of the ni libraries.

Change-Id: I39e6fb3d8bbd2fd3141c2a43a5bae2fd15149003
2014-12-17 11:04:21 -05:00
Omar Zrien
bea9eb0efa renamed param to match function name.
Change-Id: I89c483691e0f99a6d20bed1271209a8141e71c0e
2014-12-16 20:05:30 -05:00
Brad Miller (WPI)
b72eb4b812 Merge "added Java vision example programs" 2014-12-16 11:43:02 -08:00
Dustin Spicuzza
0d8c454727 Don't fail silently if DIO or PWM allocation fails
Change-Id: I800c429507c3436c2d49561ba279700ad52569fe
2014-12-16 14:24:14 -05:00
PetaroMitaro
d61d491a02 added Java vision example programs
Change-Id: Icd99f53cc544c2609a333f0a86f4eac064d565bd
2014-12-16 11:14:37 -05:00
Brad Miller (WPI)
786e844a9f Merge "Fix ControllerPower 5v faults and add javadocs. Fixes artf3918." 2014-12-16 08:07:30 -08:00
Joe Ross
170b5860ee Fix javadoc compile errors that broke build.
Change-Id: Ie110743154f842dc3a2e756f7917e3aa131c87bd
2014-12-15 19:03:27 -08:00
PetaroMitaro
26c50ebe02 fixed java CameraServer
Change-Id: I34b8c1e2ff05199afdcab579f7ac7188fbe40fd7
2014-12-15 19:45:56 -05:00
Joe Ross
46c659d6b6 Enable Java 8 doclint checking (except for missing tags).
Change-Id: Iebfc7b99cbe43375f9cc067cca322244af44395b
2014-12-15 15:50:44 -08:00
Joe Ross
6fdd491081 Fix javadoc warnings.
Change-Id: I37049f234c6dfddc138121822525794d74e1b74c
2014-12-15 18:48:46 -05:00
Fred Silberberg (WPI)
fe4535dfa0 Merge "Resolved artf3579: robot can no longer be enabled until robotInit() finishes in IterativeRobot; similar options available by overriding prestart() for other base classes." 2014-12-15 15:39:21 -08:00
Brad Miller
636e2e13ad Wrong package declaration in camera server
Change-Id: Ia35d7f78d37aa0db51eb98901364fc228dabaa53
2014-12-15 13:40:25 -05:00
PetaroMitaro
d3f5b74668 added CameraServer.java
Change-Id: I4c41b560d879ffc6d8aa4681cad8f75297fe6cda

Fixed some issues with the camera server class

Change-Id: Ifda524b55f84053be004a404a2890905ded7b266
2014-12-15 11:00:49 -05:00
Brad Miller (WPI)
8116bbd15b Merge "Fix various bugs in nivision wrappers." 2014-12-15 05:42:07 -08:00
Peter Johnson
37052246a5 Fix various bugs in nivision wrappers.
- IMAQdx typedef overrides were being ignored, resulting in incorrect types
(e.g. IMAQdxSession was a long instead of an int).

- Allocated byte buffers byte order was not being set.

- imaqDispose was incorrectly named.

Change-Id: I5d038d45e82755615f0a5bb928defb98f557f93e
2014-12-15 02:44:07 -08:00
Joe Ross
a649d3b553 Fix ControllerPower 5v faults and add javadocs. Fixes artf3918.
5V faults was returning count of 3.3V faults. Copied javadocs from
C++.

Change-Id: I95b5c6ed1213ed235ecde11ef7e28ad05aabca6e
2014-12-14 16:55:22 -08:00
Omar Zrien
6a7e7cf611 Two param constructor added to C++/java CANTalon so caller can optionally specify the periodMs at which the talon control frame is sent.
The param is capped in the HAL C++ class to [1ms, 95ms] so that zero and negative periods are caped to 1ms, and so that caller can't pass an absurdly large value, which causes TALON is appear disabled.

Change-Id: I4207194be25a33bbd6ad281a75301ce6684659a5
2014-12-14 17:09:52 -05:00
Brad Miller (WPI)
77997e52fb Merge "added PDP methods to javalib" 2014-12-14 07:34:56 -08:00
Peter Johnson
e655072efc Synchronize access to buffered Joystick data.
Change-Id: Iae453872e89c7b6364d486a6bbc8b210c94defee
2014-12-14 10:22:18 -05:00
Brad Miller (WPI)
0427fc34c4 Merge "Check for negative button value and add missing newline." 2014-12-14 07:07:01 -08:00
Brad Miller (WPI)
e33d80be14 Merge "Add USB serial port option. Uses kUSB for ALSR3" 2014-12-14 07:05:52 -08:00
Brad Miller (WPI)
8381eee185 Merge "Wrap IMAQdx functions." 2014-12-14 06:57:00 -08:00
Colby Skeggs
1c24096cc9 Resolved artf3579: robot can no longer be enabled until robotInit() finishes in IterativeRobot; similar options available by overriding prestart() for other base classes.
Change-Id: I07fde4b1bd2fae0c2e2a04336639b44ec715628a
2014-12-14 01:22:41 +00:00
Omar Zrien
3a684d28b2 PWM timing change for SP and SRX. added 3us to outer bounds
Change-Id: Idce12f8290b5f5646d0d3b14c2a4414fba3120cd
2014-12-13 18:06:43 -05:00
Joe Ross
8786b242b2 Add USB serial port option. Uses kUSB for ALSR3
Change-Id: Ie43fa14fff6aa2f332d3ebacfba099984f8b4eb7
2014-12-13 11:52:27 -08:00
Peter Johnson
b29a4bebf2 Check for negative button value and add missing newline.
Change-Id: I407ab2e0090c22b08503c6de0460d6c1291fa07f
2014-12-13 02:37:35 -08:00
Peter Johnson
db0b421019 Wrap IMAQdx functions.
Quite a few functions aren't wrapped, but the most critical ones for
vision should be.

This also fixes a couple of issues:
- nivision_arm.ini (and imaqdx_arm.ini) are now generated without need for
  running the output on the RoboRIO.
- enum values are generated even if the value is not directly specified.
2014-12-13 00:32:20 -08:00
Kevin O'Connor
8efe998270 Make VictorSP and TalonSRX use correct bounds (give an extra 1us on min and max to ensure saturation). Fixes artf3914 for C++ and Java
Change-Id: Ia1a848e011615e4ff50b9f5ef6e1017764aeb904
2014-12-12 18:09:44 -05:00
Brad Miller (WPI)
ac60198842 Merge "Change vision defaults from "cam1" to cam0". Add some error reporting to Intermediate Vision example" 2014-12-12 14:01:26 -08:00
Brad Miller (WPI)
8a5ee71fd8 Merge "Make SetImaqError actually set the error" 2014-12-12 14:00:48 -08:00
Brad Miller (WPI)
af4ce1074a Merge "Image v22" 2014-12-12 12:49:11 -08:00
Dustin Spicuzza
7636041393 Don't use raw type for HALSetNewDataSem
Change-Id: Ifb6561a33b8e0c49072f9d9c00a2c9c8f4cc3fe3
2014-12-12 15:26:47 -05:00
Fredric Silberberg
745489fec7 Image v22
Added the v22 libraries and headers, and updated the minimum version number to version 22

Change-Id: Ie89dcde0212f164296c01e906b3ee9f332fb0b02
2014-12-12 15:15:45 -05:00
Kevin O'Connor
04f9ca4feb Change vision defaults from "cam1" to cam0". Add some error reporting to Intermediate Vision example
Change-Id: If0bb60611c6c5e6f2411ad5d0432c712b24efb24
2014-12-12 15:08:07 -05:00
Kevin O'Connor
ca5dfbe492 Make SetImaqError actually set the error
Change-Id: Ib714a2ff380319c60f42c859454441e4b69736e0
2014-12-12 14:36:27 -05:00
Brad Miller (WPI)
07619a37a0 Merge "Add C function wrappers for CanTalonSRX." 2014-12-12 05:12:07 -08:00
Brad Miller (WPI)
34d3d756ea Merge "Update javadoc for RobotDrive. Mecanum methods are implemented." 2014-12-12 05:11:06 -08:00
Brad Miller (WPI)
61a5fcce18 Merge "Squashed commit of the following:" 2014-12-12 05:10:34 -08:00
Brad Miller (WPI)
82c4563d34 Merge "getHALErrorMessage(): Add missing CTRE errors." 2014-12-12 05:06:37 -08:00
Peter Johnson
fa337bc747 Add C function wrappers for CanTalonSRX.
Also sync wpilibC++Devices copy of CanTalonSRX.h.

Change-Id: Ideabb0493230ab37563698d37b0360c590f4bbbb
2014-12-12 01:41:08 -08:00
Peter Johnson
8ae7e973f2 getHALErrorMessage(): Add missing CTRE errors.
Change-Id: Ifea0bd9c57d007744616c8808e8f4b1429199898
2014-12-12 00:11:50 -08:00
Peter Johnson
574f2e692a Java nivision: Add RawData to wrap void*.
Change-Id: I8a5dc2a208a39b3c0a26a1a9f906a5c19738628d
2014-12-11 22:19:08 -08:00
Kevin O'Connor
827341caa2 Squashed commit of the following:
commit c8543f97f77a0fef282b6598ae094ac75ea1dd22
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Thu Dec 11 16:41:08 2014 -0500

    Go back to buffering Joystick data.

    Change-Id: I0b4204bfc6e81f50dc4a01c58cfbe14a771e902f

commit a8ddee2a923749903aafe2a8121171b1d70750e7
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Fri Dec 5 17:38:58 2014 -0500

    Add error for using non-existent button 0. Fixes artf3870.

    Change-Id: I5b83cc7e3f0e4ab957279a877c76eeab6cb4b77b

Change-Id: Iae36482fd82176a9e09da1cfdfb69591411b2be2
2014-12-11 16:47:29 -05:00
Brad Miller (WPI)
dd272e6bcb Merge "Add Java nivision wrappers." 2014-12-11 10:00:38 -08:00
Joe Ross
3bdaa63a28 Update javadoc for RobotDrive. Mecanum methods are implemented.
Change-Id: Ia0e0fc62f8deae778eaa14789086ff47210796bb
2014-12-10 19:34:56 -08:00
Brad Miller (WPI)
41b393c210 Merge "Fixed minor issues in CANTalon. Fixes artf3884, 3885, 3887." 2014-12-10 05:53:56 -08:00
Brad Miller (WPI)
11cf860ecd Merge "Check and coerce rumble inputs to range of 0 - 1." 2014-12-10 05:31:55 -08:00
Brad Miller (WPI)
2168d2cb77 Merge "Require Jaguar version v108 or higher." 2014-12-09 14:21:10 -08:00
Peter Johnson
430722c4a3 Add Java nivision wrappers.
Only very basic testing performed to date.

The wrappers are still a bit incomplete (some structures and functions),
but are much more complete than the old ones.

Fixes artf3796.

Changes from initial changeset:
- Use // for comments.
- Add auto-generate notices to the beginning of each generated file.
- Include error number with error text in exception.
- Add free() function to structures.
- Fix out-of-order / non-array enums.
- Avoid duplicate calls to DisposedStruct.write() as .getAddress() does it.
- Refactor OpaqueStruct.
- Default to no null allowed except when overridden.
- Implement unowned return values.
- Add gen_struct_sizer script.

Change-Id: Ie0d102c45817ea8812d98fe4938d1a2255c61664
2014-12-09 00:48:57 -08:00
Joe Ross
497f38fe0e Check and coerce rumble inputs to range of 0 - 1.
Change-Id: Ic2ee301549e68e8cc56f91755521f456c8d0b5f7
2014-12-08 20:45:22 -08:00
James Kuszmaul
9f2dcdeab6 Fixed minor issues in CANTalon. Fixes artf3884, 3885, 3887.
Adds isEnabled and getSetpoint functions to CANTalon classes.
Sets m_controlEnabled=false in Java if changeControlMode(Disabled) is
called.

Change-Id: I08fd0972df22ad83c5578dd43dd6b3536f3b365b
2014-12-08 15:32:54 -05:00
PetaroMitaro
ac07142e4c added PDP methods to javalib
Change-Id: I60f3f615b01dba6e05721c78ba890859c7c9f027
2014-12-07 14:40:27 -05:00
Omar Zrien
19a7243bfc C++
Added Get/clear routine for IntegralAccumulator
Added missing status check in GetFirmwareVersion().  I don't expect this to affect anything.

JAVA
Renamed getRampRate to getCloseLoopRampRate in java to match the set routines in java, and match all routines in cpp.
Added GetFirmwareVersion to java to match cpp.
Added Get/clear routine for IntegralAccumulator
Retested all three routines in java.

Change-Id: I4ce9d9c87a379b9d4a76aae226e2072876218688
2014-12-07 11:19:14 -05:00
Brad Miller (WPI)
e3ac0b628c Merge "Fixed issue in setting CANTalon values." 2014-12-07 08:12:14 -08:00
James Kuszmaul
709a88ad68 Fixed issue in setting CANTalon values.
Used to be that if you called Set less than ~20 ms after changing the
mode, potentially unwanted behavior could ensue.

Change-Id: I27cb3603286d8fddd894649787d88c0446b00615
2014-12-07 10:52:32 -05:00
Omar Zrien
6b844b52ec comment change and added SetModeSelect(int modeSelect,int demand)
{

Change-Id: Iadac7ec70cf04cdc339771c4e919e93723cf62ec
2014-12-06 15:32:14 -05:00
Omar Zrien
9056edf932 commented out system.out.prints in CANTalon.set()
Change-Id: I85bc50c5f1ee7364395eb28d03e3845fe70649c0
2014-12-06 13:39:49 -05:00
Brad Miller (WPI)
ff2ea1287d Merge "Added C++ versions of the joystick query functions" 2014-12-05 17:29:55 -08:00
Brad Miller
b41690b387 Added C++ versions of the joystick query functions
Change-Id: I4acdb0a54493e633b2a7a9b265c3958a9ba163d1
2014-12-05 20:13:23 -05:00
Fred Silberberg (WPI)
ce8e65d41e Merge "Changed AnalogPotentiometer to use angle specification and rail voltage." 2014-12-05 16:58:04 -08:00
James Kuszmaul
66622b43e7 Fixed accidental confusion between seconds/milliseconds.
get* in CANTalon would've blocked for 1 sec instead of 1ms.

Change-Id: I1b6fce24329e2789053372181dbef5c28f4b747a
2014-12-05 19:16:53 -05:00
Omar Zrien
568b842c73 added setPosition to java. Great for zero-ing your relative sensors, also exists in cpp and LV.
Change-Id: Idfd8c0d2c568306cb6853803315a99b92992b388
2014-12-05 19:11:17 -05:00
Omar Zrien
4d142cdafa commented out throws in getP,getI,getD,getIzone, getRampRate.
Getting/setting these should be available all the time.

Change-Id: I8ecc6dc8847c946c63c83081a338c1bd70a656b5
2014-12-05 19:05:25 -05:00
Colby Skeggs
2ae8f40a58 Changed AnalogPotentiometer to use angle specification and rail voltage.
Change-Id: I98f2c1c16726496a69c86174cdb870c74e05822c
2014-12-05 23:40:20 +00:00
James Kuszmaul
4833316571 Added more Talon SRX documentation and PID samples.
Change-Id: I2b1326c11452c6895846ded1277dbf4d38a5222d
2014-12-05 17:21:36 -05:00
Brad Miller (WPI)
16f9db30a9 Merge "fixed bug artf3676 : Typing in a project name into the create command dialog in eclipse is broken" 2014-12-05 14:07:38 -08:00
PetaroMitaro
e092742f40 fixed bug artf3676 : Typing in a project name into the create command dialog in eclipse is broken
Change-Id: I591f1950624e280feb8f7cb262bce11783cb3ff1
2014-12-05 16:32:51 -05:00
PetaroMitaro
4f6fa2482b added joystick and driverstation counts for POV, buttons, and axis 2014-12-05 16:30:20 -05:00
Joe Ross
52408e2658 Add classes for VictorSP and TalonSRX PWM control.
Update documentation for existing classes to better describe what
they control

Change-Id: I1932b39a3f082c2eb57f41edb4ba55c73cce2938
2014-12-05 16:20:58 -05:00
Brad Miller (WPI)
d986ffac81 Merge "Java-Installer" 2014-12-05 13:02:54 -08:00
Fredric Silberberg
bc3c5447e7 Java-Installer
Added the java-installer to the tools-zip created by the plugins

Change-Id: Ibf03e3cf83c6c8a7663c4c55c0fb18623020039e
2014-12-05 16:02:15 -05:00
Brad Miller (WPI)
b125e6b40a Merge "Various getters and setters added to C++. usleep added to the getters that require a little time for solicted response (getPIDF, getIzone, and getFirmwareVers. Tested against the TALON SRX unit test originally written for CanTalonSrx HAL class." 2014-12-05 12:52:51 -08:00
Brad Miller (WPI)
88a043bda4 Merge "Change Periodic Status rate to 20ms. Jaguar firmware v109 fixes issue with periodic status sending." 2014-12-05 11:49:52 -08:00
Fred Silberberg (WPI)
c57d01af94 Merge "Add USB IP to deploy fallbacks and make fallbacks work." 2014-12-05 11:48:44 -08:00
Brad Miller (WPI)
6abde412c1 Merge "Image v20" 2014-12-05 11:42:40 -08:00
Brad Miller (WPI)
5e6cd0bf9e Merge "Implement Joystick Outputs and Rumble (fixes artf3807)" 2014-12-05 11:42:14 -08:00
Kevin O'Connor
ec03c3068d Add USB IP to deploy fallbacks and make fallbacks work.
Change-Id: Iae28b1bc883e65cd6f3a88858405d43815c7323b
2014-12-05 13:53:44 -05:00
Kevin O'Connor
45f3b76103 Fix off-by-one in button checking (fixes artf3861)
Change-Id: Ic3c33bf08417fef9c7432a19a419534b76cb8597
2014-12-05 12:26:05 -05:00
Kevin O'Connor
dac04cb4a2 Implement Joystick Outputs and Rumble (fixes artf3807)
Change-Id: I7e2fa3990f47b6c51ae498035878a29c02817c1b
2014-12-05 12:24:50 -05:00
Omar Zrien
7d026be264 Various getters and setters added to C++.
usleep added to the getters that require a little time for solicted response (getPIDF, getIzone, and getFirmwareVers.
Tested against the TALON SRX unit test originally written for CanTalonSrx HAL class.

Change-Id: I7e75b8b63ac9ffecb5d48b87cbe0e0ee05bbb5a2
2014-12-05 05:08:10 -05:00
James Kuszmaul
5893d28f39 Added support for basic PID in java Talon SRX.
Tested analog PID in Java and C++.
Changed to default to controlEnabled.
Loosely wrapped a bunch of CanTalonSRX functions in Java.

Change-Id: I9da380e2368d9a72f08be4434ac63b5710a9f90f
2014-12-04 17:00:36 -05:00
Fredric Silberberg
cd01945908 Image v20
This adds the updated v20 libraries, and bumps the image version number
in the ant build scripts

Change-Id: I7c4431c167dd77763d4004709454767daefccbf0
2014-12-04 14:50:21 -05:00
Kevin O'Connor
36c53667cd Require Jaguar version v108 or higher.
Change-Id: Ib3a29a9182a776771db8b45bf82df3168e800277
2014-12-04 14:15:01 -05:00
Omar Zrien
ea610eb302 Getters for : AppliedThrotte, CloseLoopErr, Sensor/Ain/Enc Pos and Vel are now signed extended. Before this negative values would not de-serialize correctly.
There are some redundant TALON fixes in this particular commit, hopefully it handles ok on Jenkins.
Tested with Talon SRX Unit Test (firm 0.34)

Change-Id: I67db546fea2867cc6bd53ea26dc1cb61ac106490
2014-12-04 10:40:59 -05:00
Omar Zrien
d04476bb2f Wired close loop pos and vel to CANTalon::Set().
Did basic testing with close loop pos with talon slaving.

Change-Id: I880a29bff29a43d45b7af1be05e08b09063bf5d7
2014-12-04 10:40:59 -05:00
Kevin O'Connor
2bb0a32c15 Change Periodic Status rate to 20ms. Jaguar firmware v109 fixes issue with periodic status sending.
Change-Id: I9d5e1f8dce5f63ea97fc3d14de518980d299b5eb
2014-12-04 10:22:01 -05:00
Fredric Silberberg
cdbe80315f Image v19
This updates the hal headers and ni libraries for image v19. There were
very few changes this time around, only some network communications stuff.
Also updated the minimum version number in the build properties to the new
image version

Change-Id: Ic8cb384b92c54d938dec36df34fc609626b4cd5d
2014-12-03 18:19:25 -05:00
Brad Miller (WPI)
517e708fd8 Merge "Reorded network table init to avoid error and added disabledInit to template (artf3841, artf3840)" 2014-12-03 14:37:07 -08:00
Brad Miller
70825be690 Reorded network table init to avoid error and added disabledInit to template (artf3841, artf3840)
Change-Id: I5d1b1925f594e8019541033b20f70be003798d82
2014-12-03 17:36:26 -05:00
Brad Miller (WPI)
43532198c7 Merge "Artifact artf3520 : Need a PDP Clear Sticky Faults API" 2014-12-03 11:40:18 -08:00
Omar Zrien
4da9ebe1fd Artifact artf3520 : Need a PDP Clear Sticky Faults API
Artifact artf3740 : C++ and Java don't implement all PDP features

Change-Id: I6a519d16de412a4d477b1f9c57e9b405b2e1aae0
2014-12-03 14:36:43 -05:00
Brad Miller (WPI)
9479793e1d Merge "Open scope of several data fields to be able to extend CommandGroup" 2014-12-03 11:08:06 -08:00
Brad Miller (WPI)
20e9f499b0 Merge "Add hasPeriodPassed function to java, for parity with C++ Timer API" 2014-12-03 11:06:58 -08:00
Brad Miller
3d897cef58 Make robot programs deploy as lvuser for correct permissions (artf3860)
Change-Id: Ia996f9c1b910c5c9cf33ca8a4305acd8b141b40c
2014-12-03 11:40:35 -05:00
Brad Miller
fa229f2b13 Added java joystick message spam fix (artf3836)
Change-Id: I1e29aea00dc61574272f47fc3e1bcd98bd825d22
2014-12-03 11:05:49 -05:00
Brad Miller
b1056cf6d7 Prevented missing joystick messages from coming out more than once a seccond (fixes artf3836)
Change-Id: I78c0862b0d1c65951a01169db56dbe4eaddf8247
2014-12-03 07:42:48 -05:00
Dustin Spicuzza
8e707169a1 Add hasPeriodPassed function to java, for parity with C++ Timer API
Change-Id: I0f9a2714f20deaaccce610bd3eec58409eac3104
2014-11-30 23:51:01 -05:00
Joe Ross
47961c8b13 Open scope of several data fields to be able to extend CommandGroup
Change-Id: I81ac59dd45aa50ed3d8dc4fdd1d5807899af546b
2014-11-30 08:28:15 -08:00
Brad Miller (WPI)
b59f4141c4 Merge "Open scope for gyro methods. Fixes FirstForge artf1699." 2014-11-28 08:34:15 -08:00
Brad Miller (WPI)
d62d82b28b Merge "Feed motor safety when StopMotor is called. Fixes artf1687 on FirstForge." 2014-11-28 08:29:27 -08:00
Brad Miller
a9d30c0389 Fixed a typo in the SRX sample project to correct a variable name error
Change-Id: I68f9cf33062bf2ef5df88247af8a5ee470a28d77
2014-11-28 11:07:08 -05:00
Joe Ross
6e0c84d942 Feed motor safety when StopMotor is called. Fixes artf1687 on FirstForge.
Change-Id: I75c1b30c28193c1e5ed5f6fad502ab88ebc345fa
2014-11-27 11:31:00 -08:00
Joe Ross
bb8ea17acf Open scope for gyro methods. Fixes FirstForge artf1699.
Allows user to cause gyro calibration on demand. It also exposes
the AnalogInput object as protected to allow the user to extend
the gyro class and implement their own calibration.

Change-Id: Ib4206a9b16ce6d5e8e5ca9c28a14471974705a7f
2014-11-27 08:37:27 -08:00
Brad Miller (WPI)
c683e24aa9 Merge changes If51bf61d,Ia6f4997b
* changes:
  Added Omar's new CanTalonSRX code.
  Added nicer Java interface for Talon SRX -- throttle mode works.
2014-11-26 12:53:44 -08:00
James Kuszmaul
7b371f6d7c Added Omar's new CanTalonSRX code.
I also updated the C++ and Java code some. For C++, this meant making it
compile and adding in the framework for the closed-loop control of the
motor. For Java, I updated the JNI bindings with SWIG and created an
GetTemperature accessor function to demonstrate how to use the accessors
because swig does funny stuff with pass-by-reference functions.

Change-Id: If51bf61d0a9bc65a8d497f8d91a5be8d6ff4fdcc
2014-11-26 15:51:16 -05:00
Brad Miller (WPI)
f6de7bc961 Merge "Java debug launcher no longer waits for text marker to appear in console." 2014-11-26 12:05:27 -08:00
Brad Miller
c00d9f1523 Updated the names and descriptions for the c++ vision examples
Change-Id: I7f4e72ddd3e5f5ad20012ed81bd74fa5373e0ebd
2014-11-26 14:26:32 -05:00
James Kuszmaul
6ec2d262c8 Added nicer Java interface for Talon SRX -- throttle mode works.
Change-Id: Ia6f4997b4836826f56a3dd4c8f7f29a0bf62d94c
2014-11-26 14:02:20 -05:00
Brad Miller (WPI)
3c8b31608c Merge "Use standard eclipse dialogs instead of Swing dialogs" 2014-11-26 10:32:19 -08:00
Brad Miller (WPI)
29f36b0eac Merge "Overwrite instead of append during version check. Fixes artf3818" 2014-11-26 09:10:17 -08:00
Brad Miller (WPI)
486885e8bf Merge changes Id7a97940,I6234fe06
* changes:
  Simulator makefiles: Set file extension based on platform
  Fix CMakeLists.txt to not be platform specific
2014-11-26 09:02:01 -08:00
Brad Miller (WPI)
020d97580a Merge "Fixed bug with SDFormat version changing." 2014-11-26 09:01:36 -08:00
James Kuszmaul
28a41e4ac2 Added support for CAN Talon SRX in C++ and Java.
Currently, the JNI bindings are generated by Swig and, unfortunately,
  the interface available through Java is lower-level than that for C++
  (ie, direct access to the ctre code through the JNI bindings, rather
   than an interface on top of that), but it does work.
See eclipse plugins for some short samples.
There are a couple of short unit tests as placeholders.
Still needs some cleaning up.

Change-Id: Iae2f74693ca6b80bf7d5aca0625c66aa6e0b7f85

Added quick samples for C++/Java CAN Talon stuff.

Change-Id: I3acb27d6fd5568d88931e0d678c09973d436735d
2014-11-26 11:55:37 -05:00
Brad Miller (WPI)
f590cda8f9 Merge "match templates with robot builder." 2014-11-26 08:34:03 -08:00
Joe Ross
c98f54dbbc match templates with robot builder.
Change-Id: Iedb8b9efc58ca73bc654b119d5d1aed5b4eb5553
2014-11-26 07:41:56 -08:00
Brad Miller
81840b2c49 Add a getControlWord() call to the run thread in DS so that the program is kept alive
Change-Id: I8b86506f6125422e19e8b5ab23e3667bf808bdc4
2014-11-25 17:34:38 -05:00
Paul Malmsten
78ccb48fd3 Java debug launcher no longer waits for text marker to appear in console.
Lanucher immediately attempts to attach 20 times before giving up
and waits 2 seconds between attempts.

Change-Id: Ib0a70b8bbf5e90d5a733ea4e0d6b17d91b36db87
2014-11-23 15:34:52 -05:00
Kevin O'Connor
b9913d3e12 Overwrite instead of append during version check. Fixes artf3818
Change-Id: I05bde0997e13318c113a7f7ee228fa1c007bfd2f
2014-11-22 14:32:13 -05:00
Brad Miller (WPI)
56430ccd7c Merge "Pipe java program output through NetConsole" 2014-11-22 11:14:06 -08:00
Brad Miller (WPI)
d412584f16 Merge "Tried to improve reliability of a couple of unit tests." 2014-11-22 10:58:09 -08:00
Kevin O'Connor
364a3afad4 Pipe java program output through NetConsole
Change-Id: Ia012d73236d8e9c73cb53eb011f1b1f9d3c2ce83
2014-11-21 16:39:46 -05:00
Kevin O'Connor
97456f40f7 Don't buffer NetComms data and add IsDSAttached() check to C++ IsEnabled() method (fixes artf3747)
Change-Id: Idaa7edcd601147c39fb31b7966d9e975869dea87
2014-11-21 13:14:48 -05:00
Kevin O'Connor
7e5ed03d28 Check if Joystick Button exists when requested and pass 0 and warn if it doesn't
Change-Id: I2194859ef8b263f1a20aba52ec154fb0a1fc8078
2014-11-21 12:07:08 -05:00
Kevin O'Connor
14a1e6ae8e Get MatchTime from NetComms (fixes artf2538)
Change-Id: I7ea438ce4610087bceac696a958e3c1e3ead238a
2014-11-21 10:37:29 -05:00
Dustin Spicuzza
529f5b773f Use standard eclipse dialogs instead of Swing dialogs
- Swing dialog triggers freeze on Eclipse Luna on OSX 10.10

Change-Id: I9f59e884d19dd397502537286d2730be9eb0fec1
2014-11-20 23:39:54 -08:00
James Kuszmaul
91c70daf5b Tried to improve reliability of a couple of unit tests.
Change-Id: I45307da855808e85c8f9b9958c7590d60636f8e9
2014-11-20 16:39:32 -05:00
Alex Henning
e86312cd6f Fixed bug with SDFormat version changing.
Change-Id: Ia2d17fc60763678ad4971d108861988157537fc3
2014-11-20 16:07:00 -05:00
Brad Miller (WPI)
99dc3c90ed Merge "Removed the tail command" 2014-11-19 16:57:01 -08:00
Brad Miller
4ad8818a8a Added vision samples
Change-Id: Ieb482d072ae15817be40477f187f081c9f7fe19f
2014-11-19 19:39:35 -05:00
Fredric Silberberg
e4babbe4d6 Removed the tail command
The build scripts were still calling the tail command for following the log
file, even though we're now using netconsole. I've removed them.

Change-Id: I48498c1ef338f99130e447097081db92b394e1aa
2014-11-19 14:20:53 -05:00
Fred Silberberg (WPI)
9ec5164075 Merge "Handle cases where no DS is attached (initial m_controlWord, reportError, getAlliance and getLocation) fixes artf3778" 2014-11-19 10:42:32 -08:00
Fred Silberberg (WPI)
033e5f37b4 Merge "Add methods for checking Watchdog status, ds status, and brownout status" 2014-11-19 10:34:33 -08:00
Brad Miller (WPI)
e3d256e441 Merge "Change uint to int for channels on constructors which can take a single channel or single pointer to avoid ambiguous calls." 2014-11-19 10:28:34 -08:00
Kevin O'Connor
867e4080dc Change uint to int for channels on constructors which can take a single channel or single pointer to avoid ambiguous calls.
Change-Id: Id56f611675bf4dee8d31e152c4ee30112d07aac4
2014-11-19 11:40:43 -05:00
Kevin O'Connor
4be9732e9c Moves C++ global build properties to properties file to match Java.
Adds host reachability check and static IP fallback
Adds roboRIO Image check
Adds JRE check for Java

Change-Id: I07f3a0863bde0ebec7e7d8f48270e45758bddba5
2014-11-19 09:20:35 -05:00
Kevin O'Connor
cd29e1c32f Handle cases where no DS is attached (initial m_controlWord, reportError, getAlliance and getLocation) fixes artf3778
Change-Id: I6befa8e31e6762a101cd0a19641e558c955865b9
2014-11-18 16:54:06 -05:00
Kevin O'Connor
e73b3ed7b5 Add methods for checking Watchdog status, ds status, and brownout status
Change-Id: I723c87d0c50612cbffbb81b0e039efd0ef05fcd0
2014-11-18 15:56:59 -05:00
Dustin Spicuzza
d7a9794080 Simulator makefiles: Set file extension based on platform 2014-11-17 21:36:29 -08:00
Dustin Spicuzza
6234fe06f5 Fix CMakeLists.txt to not be platform specific
- Additionally, use the boost macro to properly find its library
2014-11-17 21:36:29 -08:00
Fred Silberberg (WPI)
c7a90b2ccc Merge "Fix write when used with long byte array." 2014-11-17 11:56:51 -08:00
Brad Miller (WPI)
e5443f0e78 Merge "Added in new headers and libraries for image version 18. This image contains a change to fix artf3773, which switched setDataSem to be a pthread_cond_t variable instead of a mutex. As a result, a few new HAL functions had to be exposed over JNI, specifically the functions for MultiWait." 2014-11-17 11:28:36 -08:00
Brad Miller (WPI)
0abe19a1ae Merge "Added support for launching a simulation friendly SmartDashboard." 2014-11-17 11:27:13 -08:00
Joe Ross
ccd64090bb Fix write when used with long byte array.
If the byte array allocated is longer then the count passed to the
write method, there will be a buffer overflow exception. Only put
the number of bytes specified by count.

Change-Id: I10ff48d5a5cf3f82c4e4e347326be033db300cdb
2014-11-16 16:40:49 -08:00
Fredric Silberberg
c6891fc034 Added in new headers and libraries for image version 18. This image contains a change to fix artf3773, which switched setDataSem to be a pthread_cond_t variable instead of a mutex. As a result, a few new HAL functions had to be exposed over JNI, specifically the functions for MultiWait.
Change-Id: I28be07c8102acb078440ee74ded46527328dd271
2014-11-16 17:01:44 -05:00
Thomas Clark
6f4d6ed998 Add support for vision in C++
Add IMAQdx and its dependencies

Change-Id: I6befa563e96db224db83fb90985c86eb3e8d4f3e

Add a "CameraServer" class for C++

This class allows the driver station's camera viewer to interact with
a C++ program.  It includes both an automatic mode to send images from
a webcam to the dashboard in a background thread, and an option to
manually feed it IMAQ images.

Change-Id: I54fdb164c00dce165859c22f435be647dc9927cc
2014-11-16 13:06:49 -05:00
Brad Miller (WPI)
0670ff145f Merge "Using netconsole-host to start programs and get output directed to netconsole and the log file (fixes artf3777, artf3750)" 2014-11-15 16:27:27 -08:00
Brad Miller
655ade6436 Using netconsole-host to start programs and get output directed to netconsole and the log file (fixes artf3777, artf3750)
Change-Id: I904989f94132dd0031b5bec9cca2c8dee46070fe
2014-11-15 19:19:36 -05:00
Alex Henning
7cfa0d04d7 Added support for launching a simulation friendly SmartDashboard.
Change-Id: I84176cf522da20a74234f7cfb7b8a6aaca7d9248
2014-11-14 16:08:17 -05:00
James Kuszmaul
f1476be276 Reverted accidental commits
Change-Id: Ieee3600da11df698f1025c85972acd979e486aa0
2014-11-14 15:28:48 -05:00
James Kuszmaul
9be6ee4712 CANTalon throttle works.
Fleshed out CANTalon interface; it currently works just to write a
throttle. The firmware doesn't fully support everything yet, so we are
still significantly limited.

Change-Id: I2868c4c168a8cb42cda754589777beef31ffd354
2014-11-14 15:21:12 -05:00
Thomas Clark
9050ea7e3d Generalize CANJaguar and CANTalon with a CANSpeedController interface in C++
CANSpeedController is a subinterface of SpeedController that adds method
prototypes and enums for all of the common smart speed controller features.

CANJaguar implements this interfaces.  CANTalon does too, but
most methods are stubs right now.

Change-Id: I67e0177d91e45444657280502a247d787ad5c74c
2014-11-14 15:21:12 -05:00
Thomas Clark
c1f68eb2b0 Stick the CanTalonSrx code in, get it to compile
There's a CANTalon class, but it doesn' do anything yet

Change-Id: Ib397db6fc0376f9de95e5efc42a223700be3dbca
2014-11-14 15:21:12 -05:00
Brad Miller (WPI)
fb53eea6b2 Merge "[artf3749] Repaired undefined behavior in takeMultiWait." 2014-11-13 10:07:50 -08:00
Brad Miller
6c294e137b Increase timeout on network table test
Change-Id: I362209954a0abf09c1cd9a0421c2e67a15a58dc6
2014-11-13 09:49:30 -05:00
Brad Miller (WPI)
988defee16 Merge "Adds the new shared object libraries and headers for image version 17" 2014-11-13 06:39:03 -08:00
Brad Miller (WPI)
279ae1cd9d Merge "Removed remains of the old toolchain method." 2014-11-13 05:09:49 -08:00
Brad Miller (WPI)
49f6b90d15 Merge "Removed the timing option from Iterative Robot Template since it conflicted with its purpose (artf3751)" 2014-11-12 12:50:27 -08:00
Fredric Silberberg
6cd5eeab6f Adds the new shared object libraries and headers for image version 17 2014-11-12 15:43:58 -05:00
Brad Miller
c883c9e2fc Removed release configuration from template (fixes artf3688)
Change-Id: I4e6d1abc68f23f870911b7d871b5a835cc26afef
2014-11-12 15:41:55 -05:00
Alex Henning
54951c888f Removed remains of the old toolchain method.
Change-Id: Ib885730acdbb27707ce2caadadc3f9ce86fdd0ca
2014-11-12 15:27:29 -05:00
Brad Miller (WPI)
739508ff83 Merge "First cut at pulling in riolog plugin." 2014-11-12 12:22:04 -08:00
James Kuszmaul
f67849a9b1 [artf3749] Repaired undefined behavior in takeMultiWait.
Change-Id: Ieae7d602472f585db2a896cc76355a5c23d1d670
2014-11-12 15:21:53 -05:00
Brad Miller (WPI)
7c5b3c6286 Merge "Added the OutlineViewer to distribute with the plugins." 2014-11-12 11:47:29 -08:00
Brad Miller (WPI)
eb536ba340 Merge "Added default world files to examples." 2014-11-12 11:40:13 -08:00
Brad Miller (WPI)
19737ba443 Merge "Implement user API for roboRIO power methods (fixes artf3728 and artf3537)" 2014-11-12 06:35:48 -08:00
Brad Miller (WPI)
9f0bed2e6f Merge "Correct off-by-one error in DigOut PWM Gen B HAL code (fixes artf3705 for C++/Java)" 2014-11-12 06:32:07 -08:00
Brad Miller (WPI)
86e4c3b77c Merge "athena-deploy now calls the clean step to deal with a known ant issue where it does not detect changed constants. This addresses art3766." 2014-11-12 06:30:26 -08:00
Fred Silberberg (WPI)
e216d1abd6 Merge "Fix all the samples to build with the C++11/14 language features (constexpr)" 2014-11-11 13:52:33 -08:00
Alex Henning
20aeb5c6cc Added the OutlineViewer to distribute with the plugins.
Change-Id: I958050675782ad2c16e44fad4e272204e19d7d48
2014-11-11 16:39:10 -05:00
Kevin O'Connor
3ad31dd4d7 Implement user API for roboRIO power methods (fixes artf3728 and artf3537)
Change-Id: I7501a83dcdd81d45b298e044379ea4ac3670c742
2014-11-11 15:42:56 -05:00
Kevin O'Connor
4c5b8c8c46 Correct off-by-one error in DigOut PWM Gen B HAL code (fixes artf3705 for C++/Java)
Change-Id: I4cd65089690463b69cfe815bd078d744fb21ff0f
2014-11-11 15:40:48 -05:00
Fredric Silberberg
747cdc8a58 Updated an incorrect voltage constant for the 5V input rail, and added
parenthesis to make the order of operations explicit.
Fix for artf3728

Change-Id: I2dfbad03980c4154cf253fbb06792b8502fcca02
2014-11-11 15:29:20 -05:00
Brad Miller
c3c7baa15c Removed the timing option from Iterative Robot Template since it conflicted with its purpose (artf3751) 2014-11-11 14:49:05 -05:00
Fredric Silberberg
2fdb7c8eba athena-deploy now calls the clean step to deal with a known ant issue where it does not detect changed constants. This addresses art3766.
Change-Id: I0bead9f585c610bb10faef3494c0b3358a79447f
2014-11-11 14:16:43 -05:00
Brad Miller
1d0a6b8ace Fix all the samples to build with the C++11/14 language features (constexpr) 2014-11-11 09:15:46 -05:00
Alex Henning
08fdf45f6e Added default world files to examples.
This saves a step and prevents one of the biggest user errors with the
pacgoat example.

Change-Id: Icdceb1da37c4b456f1a34daa815f3bbe2a47e18e
2014-11-09 14:26:23 -05:00
Paul Malmsten
7338471194 First cut at pulling in riolog plugin.
Plugin was retrieved from https://github.com/mstoeckl/riolog.git with minimal changes to
make it compile.

Change-Id: I340d77c69fe7598595deeaba8d4cd9414b971399
2014-11-08 12:56:45 -05:00
Brad Miller (WPI)
da0cc0c83f Merge "Fixes for 0 based joysticks and joystick axes in simulation." 2014-11-07 08:33:33 -08:00
Brad Miller (WPI)
6e0637e771 Merge "Upped the limits for the output on some PID tests." 2014-11-07 08:31:59 -08:00
Brad Miller (WPI)
8d49d8255b Merge "Move SerialPort to HAL and add SerialPort support for Java Squashed commit of the following:" 2014-11-07 08:27:36 -08:00
Alex Henning
3b53f84c8f Fixes for 0 based joysticks and joystick axes in simulation.
Change-Id: I67608450d0818b38f6d5b5c709190433f2dc5cf5
2014-11-06 19:00:02 -05:00
James Kuszmaul
05bb3cdd71 Upped the limits for the output on some PID tests.
We were having issues with intermittent PID tests because one of the
motors on the test stand was sticky and needed a bit of a push to start.

Change-Id: Ic75cd38de867a74be3e4e445bd0d02323dfc4df8
2014-11-06 14:05:35 -05:00
Kevin O'Connor
18de3aebdd Make sure the whole JVM exits if an exception is thrown. This prevents the DS thread, NT thread or any additional user thread from keeping the program alive when the main thread exits (fixes artf3743)
Change-Id: Ide89a3abe57171553af0a8c68077391b9a91fd29
2014-11-05 15:51:15 -05:00
Brad Miller (WPI)
de5e5ab405 Merge "[artf3709] Fixed PIDController loop timing." 2014-11-05 11:51:04 -08:00
Kevin O'Connor
6b6e5d9530 Move SerialPort to HAL and add SerialPort support for Java
Squashed commit of the following:

commit 4359262e2fef69b1646e3d76641fe622a78dfd89
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Wed Oct 29 13:43:12 2014 -0400

    Add SerialPort to JNI and modify Java SerialPort to use it.

    Change-Id: Id3e6fa538a50e6a96274d8fb1be546dc396fc9c6

commit 114b192388c2fb01745cb3d5ad83612e9d66ea83
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Tue Oct 28 15:46:06 2014 -0400

    Move Serial port handling to HAL and define serial errors

    Change-Id: I4cc73b64d71aafacb410bce080cb29e5fdf565a3

Change-Id: I35b729ad502137ee4c877a415d78007861991e31
2014-11-05 13:58:14 -05:00
Kevin O'Connor
fa20e6ca4f Check for fatal interrupt status on multiple interrupt methods to avoid hanging program (fixes artf3602)
Change-Id: I31cb499fd1641deec26001b719fd0a6f07d20692
2014-11-05 13:19:41 -05:00
Brad Miller (WPI)
e56aa87af4 Merge "Change Talon to use 1x update rate (fixes artf3733)" 2014-11-05 09:55:39 -08:00
Brad Miller (WPI)
63bb8e1f32 Merge "Remove unimplemented sendErrorStreamToDriverStation method (fixes artf3617)" 2014-11-05 08:44:48 -08:00
Brad Miller (WPI)
c1e63acc14 Merge "Use ByteBuffer for conversion from raw sensor bytes to Java types (fixes artf2673)" 2014-11-05 08:44:20 -08:00
Brad Miller (WPI)
68ba9bfeae Merge "Detect projects which are duplicates on Windows due to casing (fixes artf3487)." 2014-11-05 07:48:39 -08:00
Brad Miller (WPI)
aa643d8ba7 Merge "Update Interrupt Javadocs (fixes artf3492 and artf3602)" 2014-11-05 07:46:26 -08:00
Brad Miller (WPI)
1f8a3d5bf3 Merge "DigitalInputs are now automatically added the LiveWindow in both C++ and Java" 2014-11-05 07:43:52 -08:00
Brad Miller (WPI)
2fa04c1750 Merge "Don't raise exception for Joystick axis/POV out of active range. Shorten error message and change to Warning (filtered by DS by default)" 2014-11-05 07:17:09 -08:00
Brad Miller (WPI)
cd3db9631e Merge "Move user program to home\lvuser based on comments from Joe" 2014-11-05 05:23:22 -08:00
Brad Miller (WPI)
8ccb99d87c Merge "Added ignore support for intellij" 2014-11-04 13:49:24 -08:00
Brad Miller (WPI)
b14ca08474 Merge "[artf3717] Added isEnabled to Teleop Loops in Samples." 2014-11-04 13:48:46 -08:00
Kevin O'Connor
b898cec901 Change Talon to use 1x update rate (fixes artf3733)
Change-Id: I592147100058504c919bdd2f31d56580503f5bc2
2014-10-31 18:52:28 -04:00
James Kuszmaul
687e2c6711 [artf3709] Fixed PIDController loop timing.
For C++: The PIDController loop had been changed to run an infinite loop
with a Wait(period) rather than using the Notifier class to schedule
exact runs of the CallCalculate command. Essentially a revert to bb50f4b134,
accounting for more recent changes.

For Java: A similar problem had developed; essentially, a TimerTask used
to be used and at some point was changed to a Runnable. The Runnable had
an infinite loop with a Wait; TimerTask actually schedules things reasonably
(although it is not strictly real-time). Also, there were some
Thread-safety issues which I fixed.

Although Java and C++ had similar issues, they seem to have developed
these issues independently.

Changes have been tested on the GearsBot in both C++ and Java (and it
    works).

Change-Id: I478cb8bfd77cd2d031f8e343d0b8193b602dcc2a
2014-10-31 17:01:44 -04:00
Kevin O'Connor
594d0d8029 Use ByteBuffer for conversion from raw sensor bytes to Java types (fixes artf2673)
Change-Id: Ic22c6569614a457cc4156541d79ed4ce05db8273
2014-10-31 14:03:20 -04:00
Fredric Silberberg
0f825b7179 Added ignore support for intellij
Change-Id: Ia55578c89fadb92d5bd0877d296305081ece0358
2014-10-30 14:48:31 -04:00
Fredric Silberberg
345ceafa0d DigitalInputs are now automatically added the LiveWindow in both C++ and Java
Change-Id: Ic3520737841f2901becfdc99e3900e4e63da8822
2014-10-30 14:46:59 -04:00
Kevin O'Connor
b030be68d3 Detect projects which are duplicates on Windows due to casing (fixes artf3487).
Change-Id: I5f1ecc657fea226ea0eb1429a0f394a3345264db
2014-10-29 16:30:24 -04:00
Kevin O'Connor
fba155804e Update Interrupt Javadocs (fixes artf3492 and artf3602)
Change-Id: Iad66841266a2d5ff606f7e27e90f7c975143245c
2014-10-29 15:23:55 -04:00
Kevin O'Connor
97f954aef6 Remove unimplemented sendErrorStreamToDriverStation method (fixes artf3617)
Change-Id: I35dc863b3318e22e503d95273812ab25a1ae0a70
2014-10-29 14:30:22 -04:00
Brad Miller (WPI)
80194e9809 Merge "Added message to notify when simulation is unsupported." 2014-10-28 13:48:04 -07:00
James Kuszmaul
767686ae2e [artf3717] Added isEnabled to Teleop Loops in Samples.
Anywhere in the sample programs where there was just a
isOperatorControl() in the while loop for Teleop, added an "&&
isEnabled()".

Change-Id: Ib81e8bab79923e262c314a073a591855cbf06846
2014-10-27 15:55:47 -04:00
Peter Johnson
7f30b6bff4 Don't raise exception for Joystick axis/POV out of active range. Shorten error message and change to Warning (filtered by DS by default)
Return 0.0 in this case (as it can be commonly caused by
the joystick not being plugged in).

Still raise exception (Java) / set error (C++) if the asked-for axis/POV
is higher than kMaxJoystickAxes/kMaxJoystickPOVs.

See artf3673.

Change-Id: I4847c5badb358ed08f01170724ec1446af2e4ab9
2014-10-27 15:36:48 -04:00
Kevin O'Connor
8c395ca292 Move user program to home\lvuser based on comments from Joe
Change-Id: I289cfb4603a4ead6641161191129cb5ca0ea9858
2014-10-27 13:43:07 -04:00
Brad Miller (WPI)
5b2520c35f Merge "Fixed building of the frcsim-libwpilibsim-cpp deb." 2014-10-27 09:40:22 -07:00
Alex Henning
fa8d7b843c Fixed building of the frcsim-libwpilibsim-cpp deb.
There is still a bug where the examples have been updated to use 0 based
joysticks, but the simulation libraries have not been updated. I'll fix
that as a separate commit focused on fixing the joystick APIs.

Change-Id: I3b358e67b7fa18b30d1fd2b53098659cfefdfd76
2014-10-26 20:43:50 -04:00
Brad Miller (WPI)
93100c0e67 Merge "Increases the runtime of the PID test to improve stability." 2014-10-24 14:01:04 -07:00
Brad Miller (WPI)
b80565d065 Merge "Decreases the amount of console spam during tests." 2014-10-24 14:00:25 -07:00
Jonathan Leitschuh
2d45cda74b Increases the runtime of the PID test to improve stability.
Change-Id: I852ac6115f0dfe4d39940fbecc34f1b52e6cc12a
2014-10-24 16:35:55 -04:00
Jonathan Leitschuh
e4d90c6cbe Decreases the amount of console spam during tests.
Change-Id: Ia2e3ac5850b4d2c184025779346118c8ac8a75b1
2014-10-24 16:31:55 -04:00
Brad Miller (WPI)
18bdb7fdec Merge "Added C++ Encoder samples to Eclipse Plugin." 2014-10-24 13:15:43 -07:00
Brad Miller (WPI)
f6e8db50f8 Merge "Fixed New Project Wizard to have a radio option always selected" 2014-10-24 13:13:10 -07:00
James Kuszmaul
20c60a5fe6 Added C++ Encoder samples to Eclipse Plugin.
Reads values from quadrature encoder and displays them on the
SmartDashbord.

Also added Encoder with Motor Control example, which is identical to the
Motor Control sample but displays an encoder value on the
SmartDashboard.
2014-10-24 16:01:11 -04:00
Brad Miller (WPI)
66b7a8b66e Merge "Use either DO PWM A or B not A and B and update javadoc to reflect 6 generators (artf3698)" 2014-10-24 12:10:42 -07:00
Peter Johnson
8ebf88b741 Java DriverStation.InTest: Set correct flag.
Change-Id: I99aa58f4fa4df13990cc310a0f21e9a9fd817eb0
2014-10-24 14:19:30 -04:00
Brad Miller (WPI)
b85b0c8eb2 Merge "Keep Notifier firing after FPGA rollover (fixes artf3582), simulation may still have an issue with counter rollover" 2014-10-24 11:07:09 -07:00
Peter Johnson
c58fde19f9 Increase the number of joystick ports to 6.
Change-Id: I18a29a3a8c8f38b3b21c3e76eead3526b9d02875
2014-10-24 13:59:59 -04:00
Kevin O'Connor
003dc0dc2b Pass errors to DS in C++ and Java
Squashed commit of the following:

commit f317b3522e312cf7e7bb9eb0494f2f96a7f6363c
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Mon Oct 20 17:15:46 2014 -0400

    Send unhandled exceptions back to the DS.

    Change-Id: I0e658fdb6d43593ee20457f20f71f4f4cd2d21c3

commit f834ef8c791945697ad483c27b4167eb917ac242
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Mon Oct 20 16:05:24 2014 -0400

    Add StackTrace to Java errors

    Change-Id: I83b162afcc5f294703705770fbcd8623b0895539

commit 02e040b0c79067ce046ada29e26004e0460fceb0
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Mon Oct 20 15:07:44 2014 -0400

    HAL Errors to DS in Java

    Change-Id: I5fb51e4066bbc26ea59ca513c03c5ec5ace98831

commit 03775ddc42b129c27fdf403f17f0796009311c3c
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Mon Oct 20 13:38:18 2014 -0400

    Update AnalogInput to report errors for getting and setting sample rate

    Change-Id: I00eb78f52fc5b17a60bc84456f0ec9842cc40ef7

commit 4c10cb79612ae81e3cbb6bd4d6da8cf3b8955821
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Mon Oct 20 11:46:03 2014 -0400

    Define errors in HAL

    Change-Id: I96595472e42ba61f0f3d0da17caf01a748d0422a

commit 56cb5dcd93e5e849a016f63ac9d0dc245a23eb2b
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Fri Oct 17 10:59:29 2014 -0400

    Throttle errors (1 report per second per error code) and fix issue with GetTime conflicting with GetTime from Timer.h/Timer.cpp

    Change-Id: Ibe4dc2e400fc4671b240b876a46959256ea65ad7

commit 71c78826e548682ecd0c1548255f8a6552cece32
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Thu Oct 16 16:41:04 2014 -0400

    Feed errors to DS from C++

    Change-Id: I009a7798499fd93e9fdd976ff00aa74c0bd094ae

commit 81030c6cee7f18a5ddf0e95c4e402a6cf7b5de6c
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Thu Oct 16 16:40:50 2014 -0400

    Don't try to de-mangle lines without any symbols in them

    Change-Id: Icea02494b68f2ec9116d6cbf20a35a3a132234f8

Change-Id: If7717025b03914183736ccd95da5c9d49819a6f3
2014-10-24 13:23:17 -04:00
Peter Johnson
26419ec209 Don't use "final" in command-based template RobotMap.
While final would seem to make sense for RobotMap values (as these values
should be constant at runtime), RobotMap values are often not truly final
in the Java sense of the word, as on real robots they often change between
project builds (e.g. they often can and will be changed by teams as wiring
changes on the physical robot).

Unfortunately, incremental compilation in Eclipse follows Java rules, and
doesn't track cross-module dependencies on final variable values, resulting
in very non-intuitive behavior when a final variable's value is changed:
other (unchanged) Java modules using the final variable are NOT recompiled
(as is necessary to pick up the new value), and there is no easy way to
force recompilation of every Java file in the project.

Change-Id: I75b13aaf4f4a687698f853d5e11eef5f904716ea
2014-10-24 00:07:30 -07:00
Brad Miller (WPI)
3834393698 Merge "Improves the general stability of the CANJaguarDefault tests" 2014-10-23 13:27:16 -07:00
Alex Henning
97be9765cd Changed the version to include time to fix issue with replacing.
Change-Id: I80654640207a8200354f4961c476a4f4fcf5c5a6
2014-10-23 13:55:45 -04:00
Alex Henning
0881ac0b24 Fixed issue where plugins don't show up on some installs.
Change-Id: I848930dc5516a36771e46c8d0e550763821bc057
2014-10-23 13:55:44 -04:00
Brad Miller (WPI)
1b7e5970f9 Merge "Added C++ sample for CAN monitoring of PDP." 2014-10-23 10:46:45 -07:00
Jonathan Leitschuh
bc84c7ac7c Improves the general stability of the CANJaguarDefault tests
Adds a poling wait to all of the tests to accommodate the CANJaguar

Change-Id: I15a64a5fe901cb775bf03ef0b08c2f83429ef9b5
2014-10-23 13:03:49 -04:00
Brad Miller (WPI)
fc34b9b803 Merge "Aggregate javadocs and use JavaFinal docs when building plugins (fixes artf3533)" 2014-10-23 09:06:29 -07:00
James Kuszmaul
9af070a4af Added C++ sample for CAN monitoring of PDP.
Uses CAN to monitor PDP and displays values on the SmartDashboard.

Change-Id: Icb06fec0b65ce02b7c396e7d4e379cee0d959095
2014-10-23 10:07:53 -04:00
Jonathan Leitschuh
93925bc025 Fixes the GyroTest
Change-Id: Ia72fcb0533ea4e91b5f7e469e1a0b367eebda3b7
2014-10-22 18:39:27 -04:00
Jonathan Leitschuh
132804a4ce Updates the test scripts to prevent a race time condition
The two run scripts now take an extra optional parameter [-m] that overrides the giving and taking of the mutex and lets the user handle it. This is used by the jenkins script to prevent other users from jumping in at any time while the script is running.

Change-Id: Iffcbeb7ce677b173b1e9b7d9953d5a35b2643436
2014-10-22 16:23:26 -04:00
Brad Miller (WPI)
9e6d683671 Merge "Increases tolerances for the PID tests" 2014-10-22 11:36:36 -07:00
Jonathan Leitschuh
f7e8b95a24 Increases tolerances for the PID tests
The tolerance is now a little bit more loose but still demonstrates that the PID works correctly.

Change-Id: I9ca74e66fd096c49be7de61f218d5651b0ca0586
2014-10-22 14:04:41 -04:00
Brad Miller (WPI)
213e73c43e Merge "v16 Image" 2014-10-22 10:46:43 -07:00
Brad Miller (WPI)
455654a95b Merge "Fix joystick issues [artf3707]" 2014-10-22 10:44:55 -07:00
Joe Ross
261b1857cd make getControlMode public. Was public in 2014.
Change-Id: I158f41e66407d47c50e3d632661a040c8cd68d14
2014-10-22 13:36:38 -04:00
Kevin O'Connor
f3fe64a60e Keep Notifier firing after FPGA rollover (fixes artf3582), simulation may still have an issue with counter rollover
Change-Id: I11d86bd65c1e0db123d93aa143b8c8c3b823737a
2014-10-22 13:36:17 -04:00
Brad Miller (WPI)
f108853e1b Merge "Added sample programs for Solenoids and Relays." 2014-10-22 09:00:59 -07:00
Thomas Clark
a56c0eb4af Fix joystick issues [artf3707]
Make axes and POVs 0-based like they are on the DS

Correct default joystick axis numbers to be 0-based

Fix array dimensions for joystick axis values

Increase the number of joystick ports to the maximum 6 that the DS supports

Change-Id: I16d0e6e636188cbdd9cd7bfa0453a62466a55093
2014-10-22 11:49:55 -04:00
Jonathan Leitschuh
8c01e9065a Fixes a bug with the test stand launch script
The Test Stand Serve launch script now runs the correct command.

Change-Id: I790b55fc24284665ec5f32effdd6fbc66c2d334a
2014-10-22 11:23:49 -04:00
Thomas Clark
be30d3ab1d Fix CANJaguar brownout recovery in Java
In Java, CANJaguar didn't set up periodic status messages again after
a brownout

Change-Id: Iaedd844a7627dd44eb5d769a106b220648f35023
2014-10-22 10:56:25 -04:00
Brad Miller (WPI)
53255a764f Merge "Relay: Allow "On" state to be set via SmartDashboard." 2014-10-22 07:30:29 -07:00
James Kuszmaul
3abd352be9 Added sample programs for Solenoids and Relays.
Added a sample program to the eclipse plugin which uses joystick buttons
in Operator Control mode in order to control the output of a single and
a double solenoid.
Also added a sample program which uses joystick buttons to control a
spike/Relay.

Bonus: The title on the window that you get when you are opening a sample in
C++ said "Java" instead of "C++". Fixed now.

Change-Id: I0d01c23003d1fba2dbb08cbe6977ec886d97a22f
2014-10-22 09:34:52 -04:00
Thomas Clark
70be534fe0 v16 Image
Change-Id: I054ce8fdeb904ef00e88ce9e3133a381da396b42
2014-10-21 16:41:24 -04:00
Jonathan Leitschuh
e677d52a21 Increases the allowed runtime for two network tables tests
This test has been causing the build system to fail to build occasionally
Tested 15 times with 0% failure rate

Change-Id: I8d335b368d95060630b1cd47926e5ba0898e78b7
2014-10-21 15:48:56 -04:00
Kevin O'Connor
62790c0f47 Use either DO PWM A or B not A and B and update javadoc to reflect 6 generators (artf3698)
Change-Id: Id8d29831c97accd54dd359c6f20a447d8eed59db
2014-10-21 14:33:02 -04:00
Brad Miller (WPI)
cd75dc71e8 Merge "Recover from signals in Wait() [artf3495]" 2014-10-21 08:46:54 -07:00
Brad Miller (WPI)
a381b60e32 Merge "Added sample program for Motor Controller." 2014-10-21 07:12:11 -07:00
James Kuszmaul
311a690262 Added sample program for Motor Controller.
Sample uses joystick output to directly control a motor controller.
Added to C++ eclipse plugin with in same way as Java MotorControl
sample.

Change-Id: I7ce36b8000fbeb94e637a820f82399462b1416e5
2014-10-21 10:03:02 -04:00
Brad Miller (WPI)
a2f015c25b Merge "Dynamically generates tools zip file." 2014-10-20 15:20:46 -07:00
Alex Henning
5c26b37d3b Dynamically generates tools zip file.
Currently the file only includes RobotBuilder and
SmartDashboard. Additionally, testing is necessary too make sure that
the unzipping is working properly.

Change-Id: I21c0ebef592891c7d27016db401ec69c35a62acd
2014-10-20 15:47:30 -04:00
Thomas Clark
8dba364bef Recover from signals in Wait() [artf3495]
Change-Id: I6e7e404b916d9fc35524998369272bc30131bb7b
2014-10-20 15:01:35 -04:00
Brad Miller (WPI)
76f9b3bbc2 Merge "Adding stdint.h to the Joystick.h makes the indexer work (fixes artf3505)" 2014-10-20 07:47:31 -07:00
Brad Miller (WPI)
bbeb0084a2 Merge "Set RobotBase instance in constructor [artf3652]" 2014-10-20 07:46:48 -07:00
Thomas Clark
e51c3daf00 Set RobotBase instance in constructor [artf3652]
Also, remove the dead code that appeared to set the singleton instance,
but isn't actually run.

Change-Id: I1967026295b97f0c5e64256f2c701569da2a2091
2014-10-20 10:41:01 -04:00
Brad Miller
dc89ec673a Adding stdint.h to the Joystick.h makes the indexer work (fixes artf3505)
Change-Id: I6fee6d8ae0089fd4ffc2f043270bc719058f4b2d
2014-10-19 20:16:51 -04:00
Joe Ross
fc7c015823 Fix warnings for javadocs
Change-Id: I818c2086d69eff098543b4d5a554ba9d703e01e8
2014-10-19 16:48:16 -07:00
Thomas Clark (WPI)
c52e29432c Merge "make preferences check for [ and ] in key" 2014-10-19 14:57:42 -07:00
Brad Miller (WPI)
53d50f470a Merge "updted licesne strings in eclipse plugins" 2014-10-19 14:53:59 -07:00
Brad Miller (WPI)
ca303e0169 Merge "fixed template on checkedin java examples" 2014-10-19 14:52:31 -07:00
Joe Ross
042a1dbc82 make preferences check for [ and ] in key
Change-Id: If60e87f1f141678ba261c7bf77aa26a12aa97a8b
2014-10-19 17:52:15 -04:00
Brad Miller (WPI)
3c91de56d3 Merge "Fix segfault in DIO PWM generators [artf3653]" 2014-10-19 14:49:10 -07:00
Thomas Clark (WPI)
0c2f3c19cc Merge "Fix Java Joystick.getPOV()." 2014-10-19 14:41:50 -07:00
Thomas Clark
023d20abc1 Fix segfault in DIO PWM generators [artf3653]
The HAL PWM generator functions tried to interpret ID numbers as int pointers
instead of ints, leading to segfaults whenever PWM generators were used.

Change-Id: I51d50162a8fc04a04795e7ca20a23de26b9e848d
2014-10-19 16:27:47 -04:00
Alex Henning
5c702edd8f Support for pushing NetworkTables (java) to the maven repository.
Change-Id: I1b5af460aa9aff078328506351f7434227ec43ad
2014-10-18 20:53:50 -04:00
Brad Miller (WPI)
d90bbc195c Merge "Removed vestigial POM file from NetworkTables" 2014-10-18 15:38:00 -07:00
Peter Johnson
3365d0dc18 Fix Java Joystick.getPOV().
It subtracts 1 from pov; this should not be done here as it is done in the
DriverStation class.

Change-Id: I7fba2c87fc4dcb2f693201346b0d935662a49678
2014-10-18 09:22:58 -07:00
Peter Johnson
615d62a219 Relay: Allow "On" state to be set via SmartDashboard.
Change-Id: I350be338045e6d27aaaea2740695930dcdd202fa
2014-10-18 08:24:11 -07:00
Alex Henning
78988584e3 Removed vestigial POM file from NetworkTables
Flattened networktables/java/Athena into networktables/java since Athena
+ Desktop builds are identical and we dropped Azalea support.

Change-Id: If965891c163394fed3bd1a3570b1f923cdd6fd56
2014-10-17 21:38:40 -04:00
Brad Miller (WPI)
294e224fcd Merge "allow installation on eclipse 3.8 (ubuntu 14.04)" 2014-10-17 14:12:55 -07:00
Brad Miller (WPI)
436c92961b Merge "Add new joystick features" 2014-10-17 14:08:49 -07:00
Brad Miller (WPI)
341abbfaaf Merge "Run the scheduler in disabled (fixes artf3631)" 2014-10-17 13:50:35 -07:00
Brad Miller (WPI)
eab34bbb88 Merge "Add SD methods with default values to match Java (fixes artf3648)" 2014-10-17 13:47:47 -07:00
Brad Miller (WPI)
5db5320793 Merge "Add method to get Device ID to Can Jaguar (fixes artf3613)" 2014-10-17 13:46:07 -07:00
Brad Miller (WPI)
54eaa913f6 Merge "Make Java ignore section headers in Preferences file and start file with [Preferences] to match C++ (fixes artf3629)" 2014-10-17 13:45:34 -07:00
Thomas Clark
8a541a67ca Add new joystick features
Axis counts other than six and POVs are both present in C++ and Java now

Add dynamic joystick axis counts, up to 12

Change-Id: Ieade5e61a89df822df8702cb32326e4635558778

Add support for POVs in C++

Change-Id: I12dc0fcaca605a256ddcf990eebde45767229171

Make POVs work in Java

Change-Id: Ie2d98adb416c1930f058bdd21c3e7d26289df503
2014-10-17 16:39:10 -04:00
Brad Miller (WPI)
7fa0eea492 Merge "ADXL345_SPI: Report usage." 2014-10-17 12:19:47 -07:00
Brad Miller (WPI)
cc431354b7 Merge "Counter::setUpSource(AnalogTrigger): actually set the source." 2014-10-17 11:40:35 -07:00
Kevin O'Connor
65c10cd469 Aggregate javadocs and use JavaFinal docs when building plugins (fixes artf3533)
Change-Id: I4c8ae68daa470bea52b4f9f3fb129f50d5f238e3
2014-10-16 14:57:50 -04:00
Kevin O'Connor
fea52a77a3 Add SD methods with default values to match Java (fixes artf3648)
Change-Id: Iee955f987ac1214d773cfd733ed99e3cbd1ac3d0
2014-10-15 17:03:04 -04:00
Kevin O'Connor
4e31b68008 Add method to get Device ID to Can Jaguar (fixes artf3613)
Change-Id: I7b0cb555a56ee97cf90ea32a3080b7c14bb5ca56
2014-10-15 16:11:29 -04:00
Kevin O'Connor
f99b57b1fe Run the scheduler in disabled (fixes artf3631)
Change-Id: Ib1614e2c96b4cda580110ea427398bcfe2ff6fbe
2014-10-15 15:32:38 -04:00
Kevin O'Connor
dad3b68f36 Make Java ignore section headers in Preferences file and start file with [Preferences] to match C++ (fixes artf3629)
Change-Id: Ia56cca061851727eee25d3996314a01022378a07
2014-10-15 14:37:25 -04:00
Kevin O'Connor
08c8723174 Merge "Add error message to new project wizard if project already exists" 2014-10-13 07:45:25 -07:00
Peter Johnson
ce768ae341 ADXL345_SPI: Report usage.
Change-Id: I369a3aecf36fc9071b10cbacc1ebac5f98c1dd39
2014-10-12 14:38:02 -07:00
Joe Ross
217c50c28f allow installation on eclipse 3.8 (ubuntu 14.04)
Change-Id: I5d0f6a05724debefecb562f8f0fb0c8acea8e2c2
2014-10-11 18:24:51 -07:00
Peter Johnson
fcc8230dbf Counter::setUpSource(AnalogTrigger): actually set the source.
Previously this created the output but didn't set up the source.

Change-Id: Ifac7ed589358e15bc70ba46ae4a756ce56683a8a
2014-10-10 09:15:42 -07:00
Evin Ugur
d2c1bc174f updted licesne strings in eclipse plugins
Change-Id: I9593e4dda3e8db8f1fd3d847285932affffcfd51
2014-10-09 19:33:10 -04:00
Evin Ugur
6fe638e977 Fixed New Project Wizard to have a radio option always selected 2014-10-09 19:21:36 -04:00
Evin Ugur
07837c4ab4 fixed template on checkedin java examples
Change-Id: I0a99aefc21e3cc2471f0ad75192c51def8bd5ba8
2014-10-09 14:15:58 -04:00
Brad Miller
daee45780d Added additional NI libraries to make C++ builds work
Change-Id: Id550b698451999a6c3d52313211798be5eddd47c
2014-10-09 09:43:12 -04:00
Patrick Plenefisch
8079482820 Create HOME on windows
Change-Id: Id16278b5280e25e383e474faf4b511c47e5d0751
2014-10-08 17:15:51 -04:00
Brad Miller (WPI)
0b828eec62 Merge "Disable CANJaguar current PID test" 2014-10-08 12:51:58 -07:00
Brad Miller (WPI)
49e06bd13b Merge "Move interrupt methods to InterruptableSensorBase" 2014-10-08 12:51:28 -07:00
Thomas Clark
eca4d36a4b Disable CANJaguar current PID test
The hardware setup makes this test basically useless

Change-Id: I40287313a1928dda897c8e35922216d44ab089d2
2014-10-08 15:02:01 -04:00
Thomas Clark
4d2a720f47 Move interrupt methods to InterruptableSensorBase
Analog interrupts work again now, and RequestInterrupts is no longer
duplicated three times.

Change-Id: I5244b76262d7620852141cd21b2429d627636793
2014-10-08 14:52:24 -04:00
Patrick Plenefisch
591e1de721 use WPILIB eclipse var & use luna to build
Change-Id: I5e8560329226fca3c60f337b6b4744c50a09cdc9
2014-10-08 10:39:06 -04:00
Brad Miller (WPI)
dc09233fca Merge "void* -> void by creating proxy fuction" 2014-10-07 14:21:45 -07:00
Patrick Plenefisch
037d3b2fb5 void* -> void by creating proxy fuction
Change-Id: I903c3d98f3210d1969b9aed6c84f5ccaa803a9ed
2014-10-07 17:19:32 -04:00
Kevin O'Connor
a3995a202d Fix bitfield indexing on PWM Latch
Change-Id: I63b423dbcab9f0f8b5b384654824f1c69b0fa052
2014-10-07 16:52:21 -04:00
Thomas Clark (WPI)
a71f07ed67 Merge "HAL: build shared library as well as static library." 2014-10-07 08:24:27 -07:00
Brad Miller (WPI)
cb81aa6fe9 Merge "Update headers and .sos to v15 image + most API changes" 2014-10-07 07:22:14 -07:00
Thomas Clark (WPI)
ace43a6a12 Merge "DigitalOutput: Fix enablePWM()." 2014-10-07 07:18:19 -07:00
Thomas Clark (WPI)
a4e8d65b71 Merge "Relay: In free(), set both forward and reverse to 0." 2014-10-07 07:17:10 -07:00
Brad Miller
bfd88f1dab Reserve network communications
Change-Id: Ie98e31baf9d5ce01056a89e009ec62c8bbb62f2e
2014-10-06 10:21:55 -04:00
Peter Johnson
a65cb500fb Relay: In free(), set both forward and reverse to 0.
Also, check status in between the two calls.

Change-Id: I5a6c24aefde3707a953a41cb7c56e8fb372e1ea0
2014-10-06 00:31:46 -07:00
Peter Johnson
f27df43b5b DigitalOutput: Fix enablePWM().
Previously enablePWM() wanted m_pwmGenerator to already be non-null on entry.
This is impossible as the only place m_pwmGenerator is set is later in this
function.

Also add correct m_pwmGenerator null checks to disablePWM() and
updateDutyCycle().

Change-Id: Ia5bbfdc62824e1cf4c2f503308313b7ef39ae2fe
2014-10-05 20:51:57 -07:00
Thomas Clark
7e9f183cf9 Update headers and .sos to v15 image + most API changes
Java still does not work

Change-Id: I172ac401a07b6703909068f82b7b6cc67e6075c0
2014-10-05 17:17:59 -04:00
Brad Miller
2f26361398 Added Mecanum drive sample program
Change-Id: I0538c21116cd6c8836f76b6d4446b83d8723a20f
2014-10-05 16:03:36 -04:00
Peter Johnson
52ecbd38ac HAL: build shared library as well as static library.
Change-Id: I02143d601dc1dc0a6f35d61b6d008340333ee98a
2014-10-03 19:13:34 -07:00
Kevin O'Connor
887a4e94f3 Add error message to new project wizard if project already exists
Change-Id: Ifeeaf25954261ff2ba1287103f6ca2f8186aeee8
2014-09-11 15:22:12 -04:00
Alex Henning
c68ee3001e Added message to notify when simulation is unsupported.
Also links to screensteps instructions to set it up.

Change-Id: I61bca3ad773d5e08b3a4f8fa6bc0fd2cd1c04c59
2014-08-14 11:37:02 -04:00
504 changed files with 55650 additions and 5823 deletions

14
.gitignore vendored
View File

@@ -10,6 +10,11 @@ bin/
.project
.classpath
**/dependency-reduced-pom.xml
wpilibj/wpilibJavaJNI/nivision/*.c
wpilibj/wpilibJavaJNI/nivision/*.cpp
wpilibj/wpilibJavaJNI/nivision/*.s
wpilibj/wpilibJavaJNI/nivision/*_arm.ini
wpilibj/wpilibJavaJNI/nivision/*.java
# Created by the jenkins test script
test-reports
@@ -17,8 +22,9 @@ test-reports
# Added by the users of vagrant
jdk-7u45-linux-arm-vfp-sflt.gz
# IntelliJ
*.iml
.idea/
# Created by http://www.gitignore.io
@@ -154,6 +160,10 @@ local.properties
.settings/
.loadpath
### Python ###
*.pyc
__pycache__
# External tool builders
.externalToolBuilders/

View File

@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 2.8)
project(All-WPILib)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -fPIC")
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
file(GLOB_RECURSE NI_LIBS ni-libraries/*.so*)
list(REMOVE_ITEM NI_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/ni-libraries/libwpi.so ${CMAKE_CURRENT_SOURCE_DIR}/ni-libraries/libwpi_2015.so)

View File

@@ -6,12 +6,12 @@
provider-name="Worcester Polytechnic Institute">
<copyright>
* Copyright (c) 2013 FIRST and WPI
* Copyright (c) 2015 FIRST and WPI
* All rights reserved.
</copyright>
<license>
* Copyright (c) 2013 FIRST and WPI
* Copyright (c) 2015 FIRST and WPI
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
@@ -52,4 +52,11 @@
version="0.0.0"
unpack="false"/>
<plugin
id="edu.wpi.first.wpilib.plugins.riolog"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View File

@@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.ui.navigator.resources;bundle-version="3.4.400",
org.eclipse.ui.intro,
org.eclipse.ui.intro.universal,
org.eclipse.core.expressions;bundle-version="3.4.400"
org.eclipse.core.expressions;bundle-version="3.4.400",
org.eclipse.core.variables
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: edu.wpi.first.wpilib.plugins.core,

View File

@@ -33,6 +33,14 @@
toolbarPath="WPILib"
tooltip="Launch the SmartDashboard to get feedback from the robot.">
</action>
<action
class="edu.wpi.first.wpilib.plugins.core.actions.RunSimulationSmartDashboardAction"
icon="icons/smartdashboard16x16.png"
id="edu.wpi.first.wpilib.plugins.core.actions.RunSimulationSmartDashboardAction"
label="Run S&amp;imulation SmartDashboard"
menubarPath="edu.wpi.first.wpilib.plugins.core.menu/edu.wpi.first.wpilib.plugins.core.actions"
tooltip="Launch the SmartDashboard to get feedback from a simulated robot.">
</action>
<action
class="edu.wpi.first.wpilib.plugins.core.actions.RunRobotBuilderAction"
icon="icons/robotbuilder16x16.png"
@@ -83,5 +91,14 @@
content="WPILib Intro/sample.xml">
</configExtension>
</extension>
<extension
point="org.eclipse.core.variables.valueVariables">
<variable
name="WPILIB"
initialValue="${HOME}/wpilib"
description="WPILib Path"
>
</variable>
</extension>
</plugin>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<artifactId>edu.wpi.first.wpilib.plugins.core</artifactId>
<packaging>eclipse-plugin</packaging>
@@ -11,4 +11,222 @@
<version>0.1.0.qualifier</version>
<relativePath>..</relativePath>
</parent>
<properties>
<build-number>DEVELOPMENT</build-number>
<tools-zip>${project.build.directory}/tools-zip</tools-zip>
</properties>
<repositories>
<repository>
<id>WPILib Maven Repository</id>
<url>http://first.wpi.edu/FRC/roborio/maven/</url>
</repository>
</repositories>
<build>
<resources>
<resource>
<directory>.</directory>
<includes>
<include>resources/configuration.properties</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-ant-resources-to-tools-zip</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${tools-zip}</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/tools-zip</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<!-- Fetch the dependencies needed to build the jar.zip file. -->
<execution>
<id>fetch-jar-zip-dependencies</id>
<phase>compile</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>edu.wpi.first.wpilib</groupId>
<artifactId>RobotBuilder</artifactId>
<version>2.0.0-SNAPSHOT</version>
<outputDirectory>${tools-zip}</outputDirectory>
<destFileName>RobotBuilder.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>edu.wpi.first.wpilib</groupId>
<artifactId>SmartDashboard</artifactId>
<version>1.0.0-SNAPSHOT</version>
<outputDirectory>${tools-zip}</outputDirectory>
<destFileName>SmartDashboard.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>edu.wpi.first.wpilib</groupId>
<artifactId>sfx</artifactId>
<type>zip</type>
<classifier>zip</classifier>
<outputDirectory>${tools-zip}/../</outputDirectory>
<destFileName>sfx.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>edu.wpi.first.wpilib.networktables</groupId>
<artifactId>OutlineViewer</artifactId>
<version>1.0.0-SNAPSHOT</version>
<outputDirectory>${tools-zip}</outputDirectory>
<destFileName>OutlineViewer.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>edu.wpi.first.wpilib</groupId>
<artifactId>java-installer</artifactId>
<version>1.0-SNAPSHOT</version>
<outputDirectory>${tools-zip}</outputDirectory>
<destFileName>java-installer.jar</destFileName>
</artifactItem>
</artifactItems>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<!-- Set time stamp and version properties. -->
<execution>
<id>set-version-info</id>
<goals>
<goal>run</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<target>
<tstamp>
<format property="timestamp" pattern="yyyy/MM/dd HH:mm:ss z"/>
</tstamp>
<tstamp>
<format property="version-info" pattern="yyyy.MM.dd.HH.mm.ss"/>
</tstamp>
<property name="version" value="${version-info}.${build-number}"/>
</target>
<exportAntProperties>true</exportAntProperties>
</configuration>
</execution>
<!-- Generate zip file to unzip for the user. -->
<execution>
<id>generate-jar-zip</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<unzip src="${tools-zip}/../sfx.zip" dest="${tools-zip}"/>
<zip destfile="${project.build.directory}/classes/resources/tools.zip"
basedir="${tools-zip}"
update="true" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-dependency-plugin
</artifactId>
<versionRange>[2.8,)</versionRange>
<goals>
<goal>copy</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<!-- Add fake dependencies to inform Maven of the correct
order it should build projects in during a multi-module build.
This list should match the list in the invocation of
maven-dependency-plugin:copy above.
It may be possible to avoid this duplication by using the
maven-assembly-plugin instead.-->
<!-- Library sources for debugging WPILib on the Athena -->
<dependency>
<groupId>edu.wpi.first.wpilib</groupId>
<artifactId>RobotBuilder</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>edu.wpi.first.wpilib</groupId>
<artifactId>SmartDashboard</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>edu.wpi.first.wpilib</groupId>
<artifactId>sfx</artifactId>
<type>zip</type>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>edu.wpi.first.wpilib.networktables</groupId>
<artifactId>OutlineViewer</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,2 @@
timestamp=${timestamp}
version=${version}

View File

@@ -134,7 +134,17 @@ public class WPILibCore extends AbstractUIPlugin {
}
public String getDefaultVersion() {
return "0.2";
try {
Properties props = new AntPropertiesParser(WPILibCore.class.getResourceAsStream("/resources/configuration.properties")).getProperties();
if (props.getProperty("version").startsWith("$")) {
return "DEVELOPMENT";
} else {
return props.getProperty("version");
}
} catch (CoreException e) {
WPILibCore.logError("Error getting properties.", e);
return "DEVELOPMENT";
}
}
public String getCurrentVersion() {

View File

@@ -0,0 +1,77 @@
package edu.wpi.first.wpilib.plugins.core.actions;
import java.io.File;
import java.io.FilenameFilter;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
/**
* Our sample action implements workbench action delegate.
* The action proxy will be created by the workbench and
* shown in the UI. When the user tries to use the action,
* this delegate will be created and execution will be
* delegated to it.
* @see IWorkbenchWindowActionDelegate
*/
public class RunSimulationSmartDashboardAction implements IWorkbenchWindowActionDelegate {
/**
* The constructor.
*/
public RunSimulationSmartDashboardAction() {
}
/**
* The action has been activated. The argument of the
* method represents the 'real' action sitting
* in the workbench UI.
* @see IWorkbenchWindowActionDelegate#run
*/
public void run(IAction action) {
File dir = new File(WPILibCore.getDefault().getWPILibBaseDir()+File.separator+"tools");
File[] files = dir.listFiles(new FilenameFilter() {
@Override public boolean accept(File dir, String name) {
return name.startsWith("SmartDashboard") && name.endsWith(".jar");
}
});
if (files == null || files.length < 1) return;
String[] cmd = {"java", "-jar", files[0].getAbsolutePath(), "-ip", "localhost"};
try {
DebugPlugin.exec(cmd, new File(System.getProperty("user.home")));
} catch (CoreException e) {
WPILibCore.logError("Error running SmartDashboard.", e);
}
}
/**
* Selection in the workbench has been changed. We
* can change the state of the 'real' action here
* if we want, but this can only happen after
* the delegate has been created.
* @see IWorkbenchWindowActionDelegate#selectionChanged
*/
public void selectionChanged(IAction action, ISelection selection) {
}
/**
* We can use this method to dispose of any system
* resources we previously allocated.
* @see IWorkbenchWindowActionDelegate#dispose
*/
public void dispose() {
}
/**
* We will cache window object in order to
* be able to provide parent shell for the message dialog.
* @see IWorkbenchWindowActionDelegate#init
*/
public void init(IWorkbenchWindow window) {
}
}

View File

@@ -8,8 +8,6 @@ import java.io.OutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.swing.JOptionPane;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -17,6 +15,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.jface.dialogs.MessageDialog;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
@@ -117,7 +116,7 @@ public abstract class AbstractInstaller {
protected void install() throws InstallException {
if(installLocation.exists()) {
if(!removeFileHandler(installLocation, true)) {
JOptionPane.showMessageDialog(null,
MessageDialog.openError(null, "Error",
String.format("Could not update the old wpilib folder.%n"
+ "Please close any WPILib tools and restart Eclipse."));
}

View File

@@ -0,0 +1,43 @@
package edu.wpi.first.wpilib.plugins.core.launching;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.jface.dialogs.MessageDialog;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
public class SimulationNotification {
private static final String URL = "https://wpilib.screenstepslive.com/s/4485/m/23353";
private static final String SIMULATION_UNSUPPORTED_MSG =
"Simulation is unsupported on your current setup.\n" +
"For more information see: " + URL;
public static void showUnsupported() {
String title = "Simulation Unsupported";
String message = SIMULATION_UNSUPPORTED_MSG;
MessageDialog.openError(null, title, message);
try {
Desktop.getDesktop().browse(new URI(URL));
} catch (IOException e) {
WPILibCore.logError("Can't open "+URL, e);
} catch (URISyntaxException e) {
WPILibCore.logError("Can't open "+URL, e);
}
}
public static boolean supportsSimulation() {
String[] cmd = {"frcsim", "--version"};
try {
DebugPlugin.exec(cmd, new File(System.getProperty("user.home")));
return true;
} catch (CoreException e) {
return false;
}
}
}

View File

@@ -36,10 +36,10 @@ public abstract class ExampleWizard extends Wizard implements INewWizard {
*/
protected abstract void doFinish(IExampleProject ex, String teamNumber) throws CoreException;
protected abstract IWizardPage getDetailsPage();
protected abstract IWizardPage getDetailsPage(INewProjectInfo info);
public abstract IExampleProject makeExampleProject(String name, String description,
List<String> tags, List<String> folders, List<IExampleProject.ExportFile> files);
List<String> tags, String world, List<String> folders, List<IExampleProject.ExportFile> files);
public abstract URL getResourceURL();
@@ -60,7 +60,7 @@ public abstract class ExampleWizard extends Wizard implements INewWizard {
}
page1 = new ExampleWizardChoicePage(this, selection);
addPage(page1);
page2 = getDetailsPage();
page2 = getDetailsPage(page1);
addPage(page2);
}

View File

@@ -6,6 +6,7 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.swing.event.ChangeListener;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -36,11 +37,12 @@ import edu.wpi.first.wpilib.plugins.core.WPILibCore;
* OR with the extension that matches the expected one (mpe).
*/
public class ExampleWizardChoicePage extends WizardPage {
public class ExampleWizardChoicePage extends WizardPage implements INewProjectInfo {
private Tree exampleTree;
private Browser descriptionText;
private IExampleProject selectedExample;
private ExampleWizard parent;
private ChangeListener listener;
/**
* Constructor for SampleNewWizardPage.
@@ -89,6 +91,20 @@ public class ExampleWizardChoicePage extends WizardPage {
dialogChanged();
setControl(container);
}
public String getName() {
if (selectedExample != null) {
return selectedExample.getName();
}
return "";
}
public String getWorld() {
if (selectedExample != null) {
return selectedExample.getWorld();
}
return "";
}
/**
* Tests if the current workbench selection is a suitable container to use.
@@ -137,7 +153,6 @@ public class ExampleWizardChoicePage extends WizardPage {
/**
* Ensures that both text fields are set.
*/
private void dialogChanged() {
if (exampleTree.getSelection().length > 0) {
Object selectedData = exampleTree.getSelection()[0].getData();
@@ -157,6 +172,7 @@ public class ExampleWizardChoicePage extends WizardPage {
return;
}
listener.stateChanged(null);
updateStatus(null);
}
@@ -211,6 +227,11 @@ public class ExampleWizardChoicePage extends WizardPage {
tags.add(tagElementList.item(i).getTextContent());
}
}
String world = "";
if (element.getElementsByTagName("world") != null &&
element.getElementsByTagName("world").item(0) != null) {
world = element.getElementsByTagName("world").item(0).getTextContent();
}
List<String> packages = new ArrayList<String>();
tagsElement = element.getElementsByTagName("packages").item(0);
if (tagsElement.getNodeType() == Node.ELEMENT_NODE) {
@@ -231,10 +252,15 @@ public class ExampleWizardChoicePage extends WizardPage {
}
}
}
return parent.makeExampleProject(name, description, tags, packages, files);
return parent.makeExampleProject(name, description, tags, world, packages, files);
}
public IExampleProject getExampleProject() {
return selectedExample;
}
@Override
public void registerChangeListener(ChangeListener listener) {
this.listener = listener;
}
}

View File

@@ -14,4 +14,10 @@ public interface IExampleProject extends ProjectType {
this.destination = destination;
}
}
/**
* @return The world file to use for simulation, if empty
* the default is used.
*/
String getWorld();
}

View File

@@ -0,0 +1,24 @@
package edu.wpi.first.wpilib.plugins.core.wizards;
import javax.swing.event.ChangeListener;
public interface INewProjectInfo {
String getName();
String getWorld();
void registerChangeListener(ChangeListener changeListener);
public static INewProjectInfo Null = new INewProjectInfo() {
@Override
public String getWorld() {
return "";
}
@Override
public String getName() {
return "";
}
@Override
public void registerChangeListener(ChangeListener changeListener) {}
};
}

View File

@@ -39,6 +39,7 @@ public class NewProjectMainPage extends WizardPage {
private boolean showPackage;
private boolean showProjectTypes;
private TeamNumberPage teamNumberPage;
private INewProjectInfo info;
/**
* Constructor for SampleNewWizardPage.
@@ -46,17 +47,20 @@ public class NewProjectMainPage extends WizardPage {
*
* @param pageName
*/
public NewProjectMainPage(ISelection selection, TeamNumberPage teamNumberPage) {
public NewProjectMainPage(ISelection selection, TeamNumberPage teamNumberPage, INewProjectInfo info) {
super("wizardPage");
this.teamNumberPage = teamNumberPage;
showPackage = true;
showProjectTypes = false;
this.info = info;
}
/**
* @see IDialogPage#createControl(Composite)
*/
public void createControl(Composite parent) {
System.out.println(info.getName() +" -- "+ info.getWorld());
Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
container.setLayout(layout);
@@ -98,18 +102,19 @@ public class NewProjectMainPage extends WizardPage {
groupLayout.numColumns = 1;
projectTypeGroup.setLayout(groupLayout);
commandRobot = new Button(projectTypeGroup, SWT.RADIO | SWT.WRAP);
commandRobot.setText("Command-Based Robot: A robot project that allows robots to be implemented using the command based model to allow complex functionality to be developed from simpler functionality.");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint = 300;
commandRobot.setLayoutData(gd);
commandRobot.setSelection(true);
iterativeRobot = new Button(projectTypeGroup, SWT.RADIO | SWT.WRAP);
iterativeRobot.setText("Iterative Robot: A robot project that allows robots to be implemented in an iterative manner.");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint = 300;
iterativeRobot.setLayoutData(gd);
commandRobot = new Button(projectTypeGroup, SWT.RADIO | SWT.WRAP);
commandRobot.setText("Command-Based Robot: A robot project that allows robots to be implemented using the command based model to allow complex functionality to be developed from simpler functionality.");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint = 300;
commandRobot.setLayoutData(gd);
sampleRobot = new Button(projectTypeGroup, SWT.RADIO | SWT.WRAP);
sampleRobot.setText("Sample Robot: A robot project used for small sample programs or for highly advanced programs with more complete control over program flow");
gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -129,7 +134,7 @@ public class NewProjectMainPage extends WizardPage {
comp.setLayout(groupLayout);
worldText = new Text(comp, SWT.BORDER | SWT.SINGLE);
worldText.setLayoutData(gd);
worldText.setText("/usr/share/frcsim/worlds/GearsBotDemo.world");
worldText.setText("/usr/share/frcsim/worlds/GearsBotDemo.world");
worldText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
dialogChanged();
@@ -160,11 +165,18 @@ public class NewProjectMainPage extends WizardPage {
@Override public void stateChanged(ChangeEvent e) {
String teamNumber = TeamNumberPage.getTeamNumberFromPage(teamNumberPage);
packageText.setText("org.usfirst.frc.team"+teamNumber+".robot");
}
});
}
}
info.registerChangeListener(new ChangeListener() {
@Override public void stateChanged(ChangeEvent e) {
projectNameText.setText(info.getName());
if (!"".equals(info.getWorld())) {
worldText.setText(info.getWorld());
}
}
});
}
/**

View File

@@ -5,6 +5,7 @@ import java.util.Arrays;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
@@ -48,4 +49,8 @@ public class ProjectComboField {
combo.addModifyListener(modifyListener);
}
public void addSelectionListener(SelectionListener selectionListener) {
combo.addSelectionListener(selectionListener);
}
}

View File

@@ -21,6 +21,8 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
@@ -78,9 +80,21 @@ public class ProjectCreationUtils {
}
} catch (CoreException e) {
WPILibCore.logError("Can't create new project.", e);
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", "Error creating project! This may occur if a project of the same name with different case exists in the Workspace");
}
});
}
}else {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", "Error! A project of the same name already exists in the Workspace");
}
});
}
return newProject;
}

View File

@@ -10,12 +10,12 @@
</description>
<copyright>
* Copyright (c) 2013 FIRST and WPI
* Copyright (c) 2015 FIRST and WPI
* All rights reserved.
</copyright>
<license>
* Copyright (c) 2013 FIRST and WPI
* Copyright (c) 2015 FIRST and WPI
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or

View File

@@ -25,7 +25,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.cdt.debug.ui;bundle-version="7.2.0",
org.eclipse.cdt.launch;bundle-version="7.1.0",
org.eclipse.cdt.launch.remote;bundle-version="2.4.0",
org.eclipse.cdt.debug.mi.core;bundle-version="7.2.0"
org.eclipse.cdt.debug.mi.core;bundle-version="7.2.0",
org.eclipse.core.variables
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: edu.wpi.first.wpilib.plugins.cpp,

View File

@@ -133,7 +133,7 @@
<format property="timestamp" pattern="yyyy/MM/dd HH:mm:ss z"/>
</tstamp>
<tstamp>
<format property="version-info" pattern="yyyy.MM"/>
<format property="version-info" pattern="yyyy.MM.dd.HH.mm.ss"/>
</tstamp>
<property name="version" value="${version-info}.${build-number}"/>
</target>

View File

@@ -27,7 +27,8 @@
<option id="gnu.cpp.compiler.option.optimization.level.1204256582" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.969129918" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.394786621" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;$cpp-location/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${WPILIB}/cpp/current/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.dialect.std.1060340803" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.c++1y" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1033680971" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
@@ -38,8 +39,9 @@
<listOptionValue builtIn="false" value="wpi"/>
</option>
<option id="gnu.cpp.link.option.paths.1566479969" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;$cpp-location/lib&quot;"/>
<listOptionValue builtIn="false" value="&quot;${WPILIB}/cpp/current/lib&quot;"/>
</option>
<option id="gnu.cpp.link.option.flags.675338432" name="Linker flags" superClass="gnu.cpp.link.option.flags" value="-Wl,-rpath,/opt/GenICam_v2_3/bin/Linux_armv7-a" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.132949138" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
@@ -55,55 +57,6 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.release.300115601">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.release.300115601" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="FRCUserProgram" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.release.300115601" name="Release" parent="cdt.managedbuild.config.gnu.cross.exe.release">
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.release.300115601." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.release.2008160346" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.release">
<option id="cdt.managedbuild.option.gnu.cross.prefix.511797597" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix" value="arm-frc-linux-gnueabi-" valueType="string"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.2130959809" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<builder buildPath="${workspace_loc:/$project}/Release" id="cdt.managedbuild.builder.gnu.cross.1554116591" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.985086840" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.2030238370" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.188807954" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.884664323" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1342658383" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
<option id="gnu.cpp.compiler.option.optimization.level.1371546365" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.1242574722" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1782227077" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1397048702" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.716979188" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.126686576" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.886832650" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.1915412749" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.671283127" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.1104744751.2017904325">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.1104744751.2017904325" moduleId="org.eclipse.cdt.core.settings" name="Simulate">
<externalSettings/>
@@ -126,10 +79,10 @@
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.2105416021" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
<option id="gnu.cpp.compiler.option.include.paths.1645322059" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/src&quot;"/>
<listOptionValue builtIn="false" value="$cpp-location/sim/include"/>
<listOptionValue builtIn="false" value="${WPILIB}/cpp/current/sim/include"/>
<listOptionValue builtIn="false" value="/usr/include"/>
<listOptionValue builtIn="false" value="/usr/include/gazebo-3.1"/>
<listOptionValue builtIn="false" value="/usr/include/sdformat-2.0"/>
<listOptionValue builtIn="false" value="/usr/include/sdformat-2.2"/>
</option>
<option id="gnu.cpp.compiler.option.optimization.level.1648211502" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.937474733" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
@@ -143,9 +96,7 @@
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.66697269" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.2094820582" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base">
<option id="gnu.cpp.link.option.libs.1563598353" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="WPILib"/>
<listOptionValue builtIn="false" value="WPILibSim"/>
<listOptionValue builtIn="false" value="WPILib"/>
<listOptionValue builtIn="false" value="gazebo"/>
<listOptionValue builtIn="false" value="gazebo_transport"/>
<listOptionValue builtIn="false" value="gazebo_msgs"/>
@@ -182,12 +133,6 @@
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.1104744751;cdt.managedbuild.config.gnu.cross.exe.debug.1104744751.;cdt.managedbuild.tool.gnu.cross.c.compiler.1261239456;cdt.managedbuild.tool.gnu.c.compiler.input.1793678673">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.300115601;cdt.managedbuild.config.gnu.cross.exe.release.300115601.;cdt.managedbuild.tool.gnu.cross.c.compiler.985086840;cdt.managedbuild.tool.gnu.c.compiler.input.884664323">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.300115601;cdt.managedbuild.config.gnu.cross.exe.release.300115601.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1342658383;cdt.managedbuild.tool.gnu.cpp.compiler.input.1782227077">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.1104744751;cdt.managedbuild.config.gnu.cross.exe.debug.1104744751.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1505235107;cdt.managedbuild.tool.gnu.cpp.compiler.input.1033680971">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
@@ -197,9 +142,6 @@
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/$project"/>
</configuration>
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/$project"/>
</configuration>
<configuration configurationName="Simulate">
<resource resourceType="PROJECT" workspacePath="/$project"/>
</configuration>

View File

@@ -1,20 +1,3 @@
# Deployment information
username=admin
password=
deploy.dir=/home/admin
deploy.kill.command=/usr/local/frc/bin/frcKillRobot.sh -t -r
deploy.log.file=/var/local/natinst/log/FRC_UserProgram.log
command.dir=/home/lvuser/
# Libraries to use
wpilib=${user.home}/wpilib/cpp/${cpp-version}
wpilib.lib=${wpilib}/lib
# Ant support
wpilib.ant.dir=${wpilib}/ant
jsch.jar=${wpilib.ant.dir}/jsch-0.1.50.jar
classloadertask.jar=${wpilib.ant.dir}/ant-classloadertask.jar
# Build information
out=FRCUserProgram
src.dir=src

View File

@@ -21,6 +21,7 @@
<property file="${user.home}/wpilib/wpilib.properties"/>
<property file="build.properties"/>
<property file="${user.home}/wpilib/cpp/${version}/ant/build.properties"/>
<import file="${wpilib.ant.dir}/build.xml"/>

View File

@@ -15,10 +15,16 @@ private:
autonomousCommand = new ExampleCommand();
lw = LiveWindow::GetInstance();
}
void DisabledPeriodic()
{
Scheduler::GetInstance()->Run();
}
void AutonomousInit()
{
autonomousCommand->Start();
if (autonomousCommand != NULL)
autonomousCommand->Start();
}
void AutonomousPeriodic()
@@ -32,7 +38,8 @@ private:
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
autonomousCommand->Cancel();
if (autonomousCommand != NULL)
autonomousCommand->Cancel();
}
void TeleopPeriodic()

View File

@@ -28,7 +28,7 @@ public:
*/
void OperatorControl()
{
while (IsOperatorControl())
while (IsOperatorControl() && IsEnabled())
{
myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
Wait(0.005); // wait for a motor update time

View File

@@ -0,0 +1,47 @@
#include "WPILib.h"
/**
* This is a sample program showing how to retrieve information from
* the Power Distribution Panel via CAN.
* The information will be displayed under variables through the SmartDashboard.
*/
class Robot: public SampleRobot
{
// Object for dealing with the Power Distribution Panel (PDP).
PowerDistributionPanel m_pdp;
// Update every 5milliseconds/0.005 seconds.
const double kUpdatePeriod = 0.005;
public:
Robot() {
}
/**
* Retrieve information from the PDP over CAN and
* displays it on the SmartDashboard interface.
* SmartDashboard::PutNumber takes a string (for a label) and a double;
* GetCurrent takes a channel number and returns a double for current,
* in Amperes. Channel numbers are printed on the PDP and range from 0-15.
*/
void OperatorControl()
{
while (IsOperatorControl() && IsEnabled())
{
// Get the current going through channel 7, in Amperes.
// The PDP returns the current in increments of 0.125A.
// At low currents the current readings tend to be less accurate.
SmartDashboard::PutNumber("Current Channel 7", m_pdp.GetCurrent(7));
// Get the voltage going into the PDP, in Volts.
// The PDP returns the voltage in increments of 0.05 Volts.
SmartDashboard::PutNumber("Voltage", m_pdp.GetVoltage());
// Retrieves the temperature of the PDP, in degrees Celsius.
SmartDashboard::PutNumber("Temperature", m_pdp.GetTemperature());
Wait(kUpdatePeriod);
}
}
};
START_ROBOT_CLASS(Robot);

View File

@@ -0,0 +1,38 @@
#include "WPILib.h"
/**
* This sample shows how to use the new CANTalon to just run a motor in a basic
* throttle mode, in the same manner as you might control a traditional PWM
* controlled motor.
*
*/
class Robot : public SampleRobot {
CANTalon m_motor;
Joystick m_stick;
// update every 0.01 seconds/10 milliseconds.
// The talon only receives control packets every 10ms.
double kUpdatePeriod = 0.010;
public:
Robot()
: m_motor(1), // Initialize the Talon as device 1. Use the roboRIO web
// interface to change the device number on the talons.
m_stick(0)
{}
/**
* Runs the motor from the output of a Joystick.
*/
void OperatorControl() {
while (IsOperatorControl() && IsEnabled()) {
// Takes a number from -1.0 (full reverse) to +1.0 (full forwards).
m_motor.Set(m_stick.GetY());
Wait(kUpdatePeriod); // Wait a bit so that the loop doesn't lock everything up.
}
}
};
START_ROBOT_CLASS(Robot);

View File

@@ -0,0 +1,63 @@
#include "WPILib.h"
/**
* This is a quick sample program to show how to use the new Talon SRX over CAN.
* This particular sample demonstrates running a basic PID control loop with an
* analog potentiometer.
*
*/
class Robot : public SampleRobot {
CANTalon m_motor;
public:
Robot()
: m_motor(1) // Initialize the Talon as device 1. Use the roboRIO web
// interface to change the device number on the m_motors.
{
// This sets the mode of the m_motor. The options are:
// kPercentVbus: basic throttle; no closed-loop.
// kCurrent: Runs the motor with the specified current if possible.
// kSpeed: Runs a PID control loop to keep the motor going at a constant
// speed using the specified sensor.
// kPosition: Runs a PID control loop to move the motor to a specified move
// the motor to a specified sensor position.
// kVoltage: Runs the m_motor at a constant voltage, if possible.
// kFollower: The m_motor will run at the same throttle as the specified other talon.
m_motor.SetControlMode(CANSpeedController::kPosition);
// This command allows you to specify which feedback device to use when doing
// closed-loop control. The options are:
// AnalogPot: Basic analog potentiometer
// QuadEncoder: Quadrature Encoder
// AnalogEncoder: Analog Encoder
// EncRising: Counts the rising edges of the QuadA pin (allows use of a
// non-quadrature encoder)
// EncFalling: Same as EncRising, but counts on falling edges.
m_motor.SetFeedbackDevice(CANTalon::AnalogPot);
// This sets the basic P, I , and D values (F, Izone, and rampRate can also
// be set, but are ignored here).
// These must all be positive floating point numbers (SetSensorDirection will
// multiply the sensor values by negative one in case your sensor is flipped
// relative to your motor).
// These values are in units of throttle / sensor_units where throttle ranges
// from -1023 to +1023 and sensor units are from 0 - 1023 for analog
// potentiometers, encoder ticks for encoders, and position / 10ms for
// speeds.
m_motor.SetPID(1.0, 0.0, 0.0);
}
/**
* Runs the motor from the output of a Joystick.
*/
void OperatorControl() {
while (IsOperatorControl() && IsEnabled()) {
// In closed loop mode, this sets the goal in the units mentioned above.
// Since we are using an analog potentiometer, this will try to go to
// the middle of the potentiometer range.
m_motor.Set(512);
Wait(5.0);
}
}
};
START_ROBOT_CLASS(Robot);

View File

@@ -0,0 +1,82 @@
#include "WPILib.h"
/**
* Sample program displaying the value of a quadrature encoder on the SmartDashboard.
* Quadrature Encoders are digital sensors which can detect the amount the encoder
* has rotated since starting as well as the direction in which the encoder
* shaft is rotating. However, encoders can not tell you the absolute
* position of the encoder shaft (ie, it considers where it starts to be the
* zero position, no matter where it starts), and so can only tell you how
* much the encoder has rotated since starting.
* Depending on the precision of an encoder, it will have fewer or greater
* ticks per revolution; the number of ticks per revolution will affect the
* conversion between ticks and distance, as specified by DistancePerPulse.
* One of the most common uses of encoders is in the drivetrain, so that the
* distance that the robot drives can be precisely controlled during the
* autonomous mode.
*/
class Robot: public SampleRobot
{
Encoder m_encoder;
/**
* Time to wait between updating SmartDashboard values.
* It is generally a good idea to stick a short wait in these loops
* to avoid hogging CPU power, especially as there will be no
* perceivable difference in the SmartDashboard display.
*/
const double kUpdatePeriod = 0.005; // 5milliseconds / 0.005 seconds.
public:
/**
* The Encoder object is constructed with 4 parameters, the last two being optional.
* The first two parameters (1, 2 in this case) refer to the ports on the
* roboRIO which the encoder uses. Because a quadrature encoder has
* two signal wires, the signal from two DIO ports on the roboRIO are used.
* The third (optional) parameter is a boolean which defaults to false.
* If you set this parameter to true, the direction of the encoder will
* be reversed, in case it makes more sense mechanically.
* The final (optional) parameter specifies encoding rate (k1X, k2X, or k4X)
* and defaults to k4X. Faster (k4X) encoding gives greater positional
* precision but more noise in the rate.
*/
Robot() : m_encoder(1, 2, false, Encoder::k4X)
{
// Defines the number of samples to average when determining the rate.
// On a quadrature encoder, values range from 1-255; larger values
// result in smoother but potentially less accurate rates than lower values.
m_encoder.SetSamplesToAverage(5);
// Defines how far the mechanism attached to the encoder moves per pulse.
// In this case, we assume that a 360 count encoder is directly attached
// to a 3 inch diameter (1.5inch radius) wheel, and that we want to
// measure distance in inches.
m_encoder.SetDistancePerPulse(1.0 / 360.0 * 2.0 * 3.1415 * 1.5);
// Defines the lowest rate at which the encoder will not be considered
// stopped, for the purposes of the GetStopped() method.
// Units are in distance / second, where distance refers to the units
// of distance that you are using, in this case inches.
m_encoder.SetMinRate(1.0);
}
/**
* Retrieve various information from the encoder and display it
* on the SmartDashboard.
*/
void OperatorControl()
{
while (IsOperatorControl() && IsEnabled())
{
// Retrieve the net displacement of the Encoder since the lsat Reset.
SmartDashboard::PutNumber("Encoder Distance", m_encoder.GetDistance());
// Retrieve the current rate of the encoder.
SmartDashboard::PutNumber("Encoder Rate", m_encoder.GetRate());
Wait(kUpdatePeriod); // Wait a short bit before updating again.
}
}
};
START_ROBOT_CLASS(Robot);

View File

@@ -13,7 +13,7 @@ private:
SpeedController* motor;
Potentiometer* pot;
static const double kP_real = 4, kI_real = 0.07,
static constexpr double kP_real = 4, kI_real = 0.07,
kP_simulation = 18, kI_simulation = 0.2;
public:

View File

@@ -13,7 +13,7 @@ private:
SpeedController* motor;
Potentiometer* pot; // TODO: Make Potentiometer
static const double kP_real = 1, kP_simulation = 0.05;
static constexpr double kP_real = 1, kP_simulation = 0.05;
public:
Wrist();

View File

@@ -0,0 +1,49 @@
#include "WPILib.h"
/**
* Uses IMAQdx to manually acquire a new image each frame, and annotate the image by drawing
* a circle on it, and show it on the FRC Dashboard.
*/
class IntermediateVisionRobot : public SampleRobot
{
IMAQdxSession session;
Image *frame;
IMAQdxError imaqError;
public:
void RobotInit() override {
// create an image
frame = imaqCreateImage(IMAQ_IMAGE_RGB, 0);
// open the camera
imaqError = IMAQdxOpenCamera("cam0", IMAQdxCameraControlModeController, &session);
if(imaqError != IMAQdxErrorSuccess) {
DriverStation::ReportError("IMAQdxOpenCamera error: " + std::to_string((long)imaqError) + "\n");
}
imaqError = IMAQdxConfigureGrab(session);
if(imaqError != IMAQdxErrorSuccess) {
DriverStation::ReportError("IMAQdxConfigureGrab error: " + std::to_string((long)imaqError) + "\n");
}
}
void OperatorControl() override {
// acquire images
IMAQdxStartAcquisition(session);
// grab an image, draw the circle, and provide it for the camera server which will
// in turn send it to the dashboard.
while(IsOperatorControl() && IsEnabled()) {
IMAQdxGrab(session, frame, true, NULL);
if(imaqError != IMAQdxErrorSuccess) {
DriverStation::ReportError("IMAQdxGrab error: " + std::to_string((long)imaqError) + "\n");
} else {
imaqDrawShapeOnImage(frame, frame, { 10, 10, 100, 100 }, DrawMode::IMAQ_DRAW_VALUE, ShapeMode::IMAQ_SHAPE_OVAL, 0.0f);
CameraServer::GetInstance()->SetImage(frame);
}
}
// stop image acquisition
IMAQdxStopAcquisition(session);
}
};
START_ROBOT_CLASS(IntermediateVisionRobot);

View File

@@ -0,0 +1,49 @@
#include "WPILib.h"
/**
* This is a demo program showing how to use Mecanum control with the RobotDrive class.
*/
class Robot: public SampleRobot
{
// Channels for the wheels
const static int frontLeftChannel = 2;
const static int rearLeftChannel = 3;
const static int frontRightChannel = 1;
const static int rearRightChannel = 0;
const static int joystickChannel = 0;
RobotDrive robotDrive; // robot drive system
Joystick stick; // only joystick
public:
Robot() :
robotDrive(frontLeftChannel, rearLeftChannel,
frontRightChannel, rearRightChannel), // these must be initialized in the same order
stick(joystickChannel) // as they are declared above.
{
robotDrive.SetExpiration(0.1);
robotDrive.SetInvertedMotor(RobotDrive::kFrontLeftMotor, true); // invert the left side motors
robotDrive.SetInvertedMotor(RobotDrive::kRearLeftMotor, true); // you may need to change or remove this to match your robot
}
/**
* Runs the motors with Mecanum drive.
*/
void OperatorControl()
{
robotDrive.SetSafetyEnabled(false);
while (IsOperatorControl() && IsEnabled())
{
// Use the joystick X axis for lateral movement, Y axis for forward movement, and Z axis for rotation.
// This sample does not use field-oriented drive, so the gyro input is set to zero.
robotDrive.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), stick.GetZ());
Wait(0.005); // wait 5ms to avoid hogging CPU cycles
}
}
};
START_ROBOT_CLASS(Robot);

View File

@@ -0,0 +1,44 @@
#include "WPILib.h"
/**
* This sample program shows how to control a motor using a joystick. In the operator
* control part of the program, the joystick is read and the value is written to the motor.
*
* Joystick analog values range from -1 to 1 and speed controller inputs as range from
* -1 to 1 making it easy to work together. The program also delays a short time in the loop
* to allow other threads to run. This is generally a good idea, especially since the joystick
* values are only transmitted from the Driver Station once every 20ms.
*/
class Robot : public SampleRobot {
Joystick m_stick;
// The motor to control with the Joystick.
// This uses a Talon speed controller; use the Victor or Jaguar classes for
// other speed controllers.
Talon m_motor;
// update every 0.005 seconds/5 milliseconds.
double kUpdatePeriod = 0.005;
public:
Robot() :
m_stick(0), // Initialize Joystick on port 0.
m_motor(0) // Initialize the Talon on channel 0.
{
}
/**
* Runs the motor from the output of a Joystick.
*/
void OperatorControl() {
while (IsOperatorControl() && IsEnabled()) {
// Set the motor controller's output.
// This takes a number from -1 (100% speed in reverse) to +1 (100% speed forwards).
m_motor.Set(m_stick.GetY());
Wait(kUpdatePeriod); // Wait 5ms for the next update.
}
}
};
START_ROBOT_CLASS(Robot);

View File

@@ -0,0 +1,55 @@
#include "WPILib.h"
/**
* This sample program shows how to control a motor using a joystick. In the operator
* control part of the program, the joystick is read and the value is written to the motor.
* An Encoder is then used to read the total distance that the motor has turned and
* to display it on the SmartDashboard.
*
* Joystick analog values range from -1 to 1 and speed controller inputs as range from
* -1 to 1 making it easy to work together. The program also delays a short time in the loop
* to allow other threads to run. This is generally a good idea, especially since the joystick
* values are only transmitted from the Driver Station once every 20ms.
*/
class Robot : public SampleRobot {
Joystick m_stick;
// The motor to control with the Joystick.
// This uses a Talon speed controller; use the Victor or Jaguar classes for
// other speed controllers.
Talon m_motor;
// update every 0.005 seconds/5 milliseconds.
double kUpdatePeriod = 0.005;
Encoder m_encoder;
public:
Robot() :
m_stick(0), // Initialize Joystick on port 0.
m_motor(2), // Initialize the Talon on channel 0.
m_encoder(1, 2) // Iniitialize encoder connected on DIO ports 1 and 2.
{
// Distance will give total rotations of the motor, assuming a 360 count encoder.
m_encoder.SetDistancePerPulse(1.0 / 360.0);
}
/**
* Runs the motor from the output of a Joystick.
* Simultaneously displays encoder values on the SmartDashboard.
*/
void OperatorControl() {
while (IsOperatorControl() && IsEnabled()) {
// Set the motor controller's output.
// This takes a number from -1 (100% speed in reverse) to +1 (100% speed forwards).
m_motor.Set(m_stick.GetY());
// Display the total displacement of the encoder, in rotations.
SmartDashboard::PutNumber("Encoder Distance", m_encoder.GetDistance());
Wait(kUpdatePeriod); // Wait 5ms for the next update.
}
}
};
START_ROBOT_CLASS(Robot);

View File

@@ -12,8 +12,8 @@ private:
double driveForwardSpeed;
double distance;
double error;
static const double TOLERANCE = .1;
static const double KP = -1.0 / 5.0;
static constexpr double TOLERANCE = .1;
static constexpr double KP = -1.0 / 5.0;
void init(double dist, double maxSpeed);
public:
DriveForward();

View File

@@ -13,9 +13,9 @@ class Collector: public Subsystem
{
public:
// Constants for some useful speeds
static const double FORWARD = 1;
static const double STOP = 0;
static const double REVERSE = -1;
static constexpr double FORWARD = 1;
static constexpr double STOP = 0;
static constexpr double REVERSE = -1;
private:
// Subsystem devices

View File

@@ -12,10 +12,10 @@ class Pivot: public PIDSubsystem
{
public:
// Constants for some useful angles
static const double COLLECT = 105;
static const double LOW_GOAL = 90;
static const double SHOOT = 45;
static const double SHOOT_NEAR = 30;
static constexpr double COLLECT = 105;
static constexpr double LOW_GOAL = 90;
static constexpr double SHOOT = 45;
static constexpr double SHOOT_NEAR = 30;
private:
// Subsystem devices

View File

@@ -17,7 +17,7 @@ private:
Compressor* compressor;
#endif
static const double MAX_PRESSURE = 2.55;
static constexpr double MAX_PRESSURE = 2.55;
public:
Pneumatics();

View File

@@ -0,0 +1,22 @@
#include "WPILib.h"
/**
* Uses the CameraServer class to automatically capture video from a USB webcam
* and send it to the FRC dashboard without doing any vision processing. This
* is the easiest way to get camera images to the dashboard. Just add this to the
* RobotInit() method in your program.
*/
class QuickVisionRobot : public SampleRobot
{
public:
void RobotInit() override {
CameraServer::GetInstance()->SetQuality(75);
CameraServer::GetInstance()->StartAutomaticCapture();
}
void OperatorControl() override {
}
};
START_ROBOT_CLASS(QuickVisionRobot);

View File

@@ -0,0 +1,69 @@
#include "WPILib.h"
/**
* This is a sample program which uses joystick buttons to control a relay.
* A Relay (generally a spike) has two outputs, each of which can be at either
* 0V or 12V and so can be used for actions such as turning a motor off,
* full forwards, or full reverse, and is generally used on the compressor.
* This program uses two buttons on a joystick and each button corresponds to
* one output; pressing the button sets the output to 12V and releasing sets
* it to 0V.
* During Operator Control, the loop waits for a brief time before continuing
* in order to allow other threads to run. This is generally a good idea,
* especially as joystick values are only received every 20ms.
*/
class Robot: public SampleRobot
{
// Joystick with which to control the relay.
Joystick m_stick;
// Relay to use for the
Relay m_relay;
// Numbers of the buttons to be used for controlling the Relay.
const int kRelayForwardButton = 1;
const int kRelayReverseButton = 2;
// Update every 5milliseconds/0.005 seconds.
const double kUpdatePeriod = 0.005;
public:
Robot() :
m_stick(0), // Use joystick on port 0.
m_relay(0) // Relay on port 0.
{
}
/**
* Control a Relay using Joystick buttons.
*/
void OperatorControl()
{
while (IsOperatorControl() && IsEnabled())
{
// Retrieve the button values. GetRawButton will return
// true if the button is pressed and false if not.
bool forward = m_stick.GetRawButton(kRelayForwardButton);
bool reverse = m_stick.GetRawButton(kRelayReverseButton);
// Depending on the button values, we want to use one of
// kOn, kOff, kForward, or kReverse.
// kOn sets both outputs to 12V, kOff sets both to 0V,
// kForward sets forward to 12V and reverse to 0V, and
// kReverse sets reverse to 12V and forward to 0V.
if (forward && reverse)
m_relay.Set(Relay::kOn);
else if (forward)
m_relay.Set(Relay::kForward);
else if (reverse)
m_relay.Set(Relay::kReverse);
else
m_relay.Set(Relay::kOff);
// Insert 5ms delay in loop.
Wait(kUpdatePeriod);
}
}
};
START_ROBOT_CLASS(Robot);

View File

@@ -0,0 +1,77 @@
#include "WPILib.h"
/**
* This is a sample program showing the use of the solenoid classes during
* operator control.
* Three buttons from a joystick will be used to control two solenoids:
* One button to control the position of a single solenoid and the other
* two buttons to control a double solenoid.
* Single solenoids can either be on or off, such that the air diverted through
* them goes through either one channel or the other.
* Double solenoids have three states: Off, Forward, and Reverse. Forward and
* Reverse divert the air through the two channels and correspond to the
* on and off of a single solenoid, but a double solenoid can also be "off",
* where both channels are diverted to exhaust such that there is no pressure
* in either channel.
* Additionally, double solenoids take up two channels on your PCM whereas
* single solenoids only take a single channel.
* During Operator Control, the loop waits for a brief time before continuing
* in order to allow other threads to run. This is generally a good idea,
* especially as joystick values are only received every 20ms.
*/
class Robot: public SampleRobot
{
// Joystick with buttons to control solenoids with.
Joystick m_stick;
// Solenoids to control with the joystick.
// Solenoid corresponds to a single solenoid.
Solenoid m_solenoid;
// DoubleSolenoid corresponds to a double solenoid.
DoubleSolenoid m_doubleSolenoid;
// Update every 5milliseconds/0.005 seconds.
const double kUpdatePeriod = 0.005;
// Numbers of the buttons to use for triggering the solenoids.
const int kSolenoidButton = 1;
const int kDoubleSolenoidForward = 2;
const int kDoubleSolenoidReverse = 3;
public:
Robot() :
m_stick(0), // Use joystick on port 0.
m_solenoid(0), // Use solenoid on channel 0.
// Use double solenoid with Forward Channel of 1 and Reverse of 2.
m_doubleSolenoid(1, 2)
{
}
/**
* Sets the solenoids from the position of joystick buttons.
*/
void OperatorControl()
{
while (IsOperatorControl() && IsEnabled())
{
// The output of GetRawButton is true/false depending on whether
// the button is pressed; Set takes a boolean for for whether to
// use the default (false) channel or the other (true).
m_solenoid.Set(m_stick.GetRawButton(kSolenoidButton));
// In order to set the double solenoid, we will say that if neither
// button is pressed, it is off, if just one button is pressed,
// set the solenoid to correspond to that button, and if both
// are pressed, set the solenoid to Forwards.
if (m_stick.GetRawButton(kDoubleSolenoidForward))
m_doubleSolenoid.Set(DoubleSolenoid::kForward);
else if (m_stick.GetRawButton(kDoubleSolenoidReverse))
m_doubleSolenoid.Set(DoubleSolenoid::kReverse);
else
m_doubleSolenoid.Set(DoubleSolenoid::kOff);
Wait(kUpdatePeriod); // wait for a motor update time
}
}
};
START_ROBOT_CLASS(Robot);

View File

@@ -87,6 +87,146 @@
<description>Example programs that demonstrate the use of the various commonly used sensors on FRC robots</description>
</tagDescription>
<tagDescription>
<name>Vision</name>
<description>Example programs that demonstrate the use of a camera for image acquisition and processing</description>
</tagDescription>
<example>
<name>Motor Controller</name>
<description>Demonstrate controlling a single motor with a Joystick.</description>
<tags>
<tag>Robot and Motor</tag>
<tag>Actuators</tag>
<tag>Joystick</tag>
<tag>Complete List</tag>
</tags>
<packages>
<package>src</package>
</packages>
<files>
<file source="examples/MotorControl/src/Robot.cpp" destination="src/Robot.cpp"></file>
</files>
</example>
<example>
<name>Motor Control With Encoder</name>
<description>Demonstrate controlling a single motor with a Joystick and displaying the net movement of the motor using an encoder.</description>
<tags>
<tag>Robot and Motor</tag>
<tag>Digital</tag>
<tag>Sensors</tag>
<tag>Actuators</tag>
<tag>Joystick</tag>
<tag>Complete List</tag>
</tags>
<packages>
<package>src</package>
</packages>
<files>
<file source="examples/MotorControl/src/Robot.cpp" destination="src/Robot.cpp"></file>
</files>
</example>
<example>
<name>CAN Talon SRX</name>
<description>Quick demo of running the SRX at a given throttle value.</description>
<tags>
<tag>Robot and Motor</tag>
<tag>Digital</tag>
<tag>Actuators</tag>
<tag>Complete List</tag>
</tags>
<packages>
<package>src</package>
</packages>
<files>
<file source="examples/CANTalon/src/Robot.cpp" destination="src/Robot.cpp"></file>
</files>
</example>
<example>
<name>CAN Talon SRX PID</name>
<description>Quick demo of running the SRX with a PID loop.</description>
<tags>
<tag>Robot and Motor</tag>
<tag>Digital</tag>
<tag>Actuators</tag>
<tag>Complete List</tag>
</tags>
<packages>
<package>src</package>
</packages>
<files>
<file source="examples/CANTalonPID/src/Robot.cpp" destination="src/Robot.cpp"></file>
</files>
</example>
<example>
<name>Relay</name>
<description>Demonstrate controlling a Relay from Joystick buttons.</description>
<tags>
<tag>Actuators</tag>
<tag>Joystick</tag>
<tag>Complete List</tag>
</tags>
<packages>
<package>src</package>
</packages>
<files>
<file source="examples/Relay/src/Robot.cpp" destination="src/Robot.cpp"></file>
</files>
</example>
<example>
<name>PDP CAN Monitoring</name>
<description>Demonstrate using CAN to monitor the voltage, current, and temperature in the Power Distribution Panel.</description>
<tags>
<tag>Complete List</tag>
<tag>CAN</tag>
<tag>Sensors</tag>
</tags>
<packages>
<package>src</package>
</packages>
<files>
<file source="examples/CANPDP/src/Robot.cpp" destination="src/Robot.cpp"></file>
</files>
</example>
<example>
<name>Solenoids</name>
<description>Demonstrate controlling a single and double solenoid from Joystick buttons.</description>
<tags>
<tag>Actuators</tag>
<tag>Joystick</tag>
<tag>Pneumatics</tag>
<tag>Complete List</tag>
</tags>
<packages>
<package>src</package>
</packages>
<files>
<file source="examples/Solenoid/src/Robot.cpp" destination="src/Robot.cpp"></file>
</files>
</example>
<example>
<name>Encoder</name>
<description>Demonstrate displaying the value of a quadrature encoder on the SmartDashboard.</description>
<tags>
<tag>Complete List</tag>
<tag>Digital</tag>
<tag>Sensors</tag>
</tags>
<packages>
<package>src</package>
</packages>
<files>
<file source="examples/Encoder/src/Robot.cpp" destination="src/Robot.cpp"></file>
</files>
</example>
<example>
<name>Arcade Drive</name>
<description>An example program which the use of Arcade Drive with the RobotDrive class</description>
@@ -105,6 +245,24 @@
</example>
<example>
<name>Mecanum Drive</name>
<description>An example program which the use of Mecanum Drive with the RobotDrive class</description>
<tags>
<tag>Getting Started with C++</tag>
<tag>Robot and Motor</tag>
<tag>Joystick</tag>
<tag>Complete List</tag>
</tags>
<packages>
<package>src</package>
</packages>
<files>
<file source="examples/MecanumDrive/src/Robot.cpp" destination="src/Robot.cpp"></file>
</files>
</example>
<example>
<name>Getting Started</name>
<description>An example program which demonstrates the simplest autonomous and
@@ -121,8 +279,45 @@
destination="src/Robot.cpp"></file>
</files>
</example>
<example>
<example>
<name>Simple vision program</name>
<description>The minimal program to acquire images from an attached USB camera on the robot
and send them to the dashboard.</description>
<tags>
<tag>Vision</tag>
<tag>Complete List</tag>
</tags>
<packages>
<package>src</package>
</packages>
<files>
<file source="examples/QuickVision/src/Robot.cpp"
destination="src/Robot.cpp"></file>
</files>
</example>
<example>
<name>Intermediate vision</name>
<description>An example program that acquires images from an attached USB camera and adds some
annotation to the image as you might do for showing operators the result of some image
recognition, and sends it to the dashboard for display.
</description>
<tags>
<tag>Vision</tag>
<tag>Complete List</tag>
</tags>
<packages>
<package>src</package>
</packages>
<files>
<file source="examples/IntermediateVision/src/Robot.cpp"
destination="src/Robot.cpp"></file>
</files>
</example>
<example>
<name>GearsBot</name>
<description>A fully functional example CommandBased program for
WPIs GearsBot robot. This code can run on your computer if it
@@ -131,6 +326,7 @@
<tag>CommandBased Robot</tag>
<tag>Complete List</tag>
</tags>
<world>/usr/share/frcsim/worlds/GearsBotDemo.world</world>
<packages>
<package>src</package>
<package>src/Commands</package>
@@ -214,7 +410,8 @@
<tags>
<tag>CommandBased Robot</tag>
<tag>Complete List</tag>
</tags>
</tags>
<world>/usr/share/frcsim/worlds/PacGoat2014.world</world>
<packages>
<package>src</package>
<package>src/Commands</package>

View File

@@ -40,7 +40,7 @@ public:
void OperatorControl()
{
myRobot.SetSafetyEnabled(true);
while (IsOperatorControl())
while (IsOperatorControl() && IsEnabled())
{
myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
Wait(0.005); // wait for a motor update time

View File

@@ -1,6 +1,12 @@
package edu.wpi.first.wpilib.plugins.cpp.installer;
import java.io.InputStream;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.IValueVariable;
import org.eclipse.core.variables.VariablesPlugin;
import edu.wpi.first.wpilib.plugins.core.installer.AbstractInstaller;
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
import edu.wpi.first.wpilib.plugins.cpp.preferences.PreferenceConstants;
@@ -21,6 +27,26 @@ public class CPPInstaller extends AbstractInstaller {
protected void updateInstalledVersion(String version) {
WPILibCPPPlugin.getDefault().getPreferenceStore().setValue(PreferenceConstants.LIBRARY_INSTALLED,
version);
IStringVariableManager vm = VariablesPlugin.getDefault().getStringVariableManager();
try
{
if (System.getProperty("os.name").startsWith("Windows"))
{
IValueVariable vv = vm.getValueVariable("HOME");
if (vv == null)
vm.addVariables(new IValueVariable[]{vm.newValueVariable("HOME", "user.home directory", false,System.getProperty("user.home"))});
else
{
if (!System.getProperty("user.home").equals(vm.performStringSubstitution("${HOME}")))
vv.setValue(System.getProperty("user.home"));
}
}
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new RuntimeException(e);
}
}
@Override

View File

@@ -154,7 +154,7 @@ public class DeployLaunchShortcut implements ILaunchShortcut
"Debug/FRCUserProgram");
config.setAttribute("org.eclipse.cdt.dsf.gdb.DEBUG_NAME", "arm-frc-linux-gnueabi-gdb");
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_REMOTE_PATH, "/home/admin/FRCUserProgram");
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_REMOTE_PATH, "/home/lvuser/FRCUserProgram");
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION, remote_connection);
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET, false);
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT, "2345");

View File

@@ -43,8 +43,8 @@ public class RSEUtils {
RSECorePlugin.getTheCoreRegistry().getSystemTypeById("org.eclipse.rse.systemtype.ssh");
host = registry.createHost(profile.getName(), systemType, connectionName, hostName,
"The remote target for debugging the robot for team "+teamNumber+".");
host.setDefaultUserId("admin");
SystemSignonInformation info = new SystemSignonInformation(hostName, "admin",
host.setDefaultUserId("lvuser");
SystemSignonInformation info = new SystemSignonInformation(hostName, "lvuser",
"", systemType);
PasswordPersistenceManager.getInstance().add(info, true, false);
} catch (Exception e) {

View File

@@ -18,6 +18,7 @@ import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PlatformUI;
import edu.wpi.first.wpilib.plugins.core.launching.AntLauncher;
import edu.wpi.first.wpilib.plugins.core.launching.SimulationNotification;
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
/**
@@ -79,7 +80,12 @@ public class SimulateLaunchShortcut implements ILaunchShortcut {
* @param activeProj The project that the script will be run on/from
* @param mode The mode it will be run in (ILaunchManager.RUN_MODE or ILaunchManager.DEBUG_MODE)
*/
public void runConfig(IProject activeProj, String mode){
public void runConfig(IProject activeProj, String mode) {
if (!SimulationNotification.supportsSimulation()) {
SimulationNotification.showUnsupported();
return;
}
String targets = "simulate";
if(mode.equals(ILaunchManager.RUN_MODE)){

View File

@@ -7,16 +7,17 @@ import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject;
import edu.wpi.first.wpilib.plugins.cpp.wizards.newproject.CPPProjectType;
public class ExampleCPPProject extends CPPProjectType implements IExampleProject {
private String name, description;
private String name, description, world;
private List<String> tags;
private List<String> directories;
private List<ExportFile> files;
public ExampleCPPProject(String name, String description, List<String> tags,
List<String> directories, List<ExportFile> files) {
String world, List<String> directories, List<ExportFile> files) {
this.name = name;
this.description = description;
this.tags = tags;
this.world = world;
this.directories = directories;
this.files = files;
}
@@ -32,6 +33,10 @@ public class ExampleCPPProject extends CPPProjectType implements IExampleProject
public List<String> getTags() {
return tags;
}
public String getWorld() {
return world;
}
@Override
public String[] getFolders(String packageName) {

View File

@@ -11,6 +11,7 @@ import edu.wpi.first.wpilib.plugins.core.WPILibCore;
import edu.wpi.first.wpilib.plugins.core.wizards.ExampleWizard;
import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject;
import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject.ExportFile;
import edu.wpi.first.wpilib.plugins.core.wizards.INewProjectInfo;
import edu.wpi.first.wpilib.plugins.core.wizards.NewProjectMainPage;
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils;
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
@@ -38,10 +39,10 @@ public class ExampleCPPWizard extends ExampleWizard {
}
@Override
protected IWizardPage getDetailsPage() {
protected IWizardPage getDetailsPage(INewProjectInfo info) {
if (detailsPage != null) return detailsPage;
detailsPage = new NewProjectMainPage(selection, getTeamNumberPage());
detailsPage.setTitle("Create Example Robot Java Project");
detailsPage = new NewProjectMainPage(selection, getTeamNumberPage(), info);
detailsPage.setTitle("Create Example Robot C++ Project");
detailsPage.setDescription("This wizard creates a new example project based on your selection.");
detailsPage.setShowPackage(false);
return detailsPage;
@@ -49,8 +50,8 @@ public class ExampleCPPWizard extends ExampleWizard {
@Override
public IExampleProject makeExampleProject(String name, String description,
List<String> tags, List<String> folders, List<ExportFile> files) {
return new ExampleCPPProject(name, description, tags, folders, files);
List<String> tags, String world, List<String> folders, List<ExportFile> files) {
return new ExampleCPPProject(name, description, tags, world, folders, files);
}
@Override

View File

@@ -15,6 +15,7 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWizard;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
import edu.wpi.first.wpilib.plugins.core.wizards.INewProjectInfo;
import edu.wpi.first.wpilib.plugins.core.wizards.NewProjectMainPage;
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils;
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType;
@@ -56,7 +57,7 @@ public class NewCPPWizard extends Wizard implements INewWizard {
teamNumberPage = new TeamNumberPage(selection);
addPage(teamNumberPage);
}
page = new NewProjectMainPage(selection, teamNumberPage);
page = new NewProjectMainPage(selection, teamNumberPage, INewProjectInfo.Null);
page.setTitle("Create New Robot C++ Project");
page.setDescription("This wizard creates a new Robot C++ Project configured to use WPILib for programming FRC robots.");
page.setShowPackage(false);

View File

@@ -0,0 +1,16 @@
# Deployment information
username=lvuser
password=
deploy.dir=/home/lvuser
deploy.kill.command=/usr/local/frc/bin/frcKillRobot.sh -t -r
command.dir=/home/lvuser/
# Libraries to use
wpilib=${user.home}/wpilib/cpp/${cpp-version}
wpilib.lib=${wpilib}/lib
roboRIOAllowedImages=23
# Ant support
wpilib.ant.dir=${wpilib}/ant
jsch.jar=${wpilib.ant.dir}/jsch-0.1.50.jar
classloadertask.jar=${wpilib.ant.dir}/ant-classloadertask.jar

View File

@@ -19,11 +19,42 @@
<!-- Targets -->
<target name="get-target-ip">
<property name="ant.enable.asserts" value="true"/>
<property name="target" value="roboRIO-${team-number}.local" />
<echo>Target: ${target}</echo>
<echo>Trying Target: ${target}</echo>
<if>
<isreachable host="${target}" timeout="5"/>
<then>
<echo>roboRIO found via mDNS</echo>
</then>
<else>
<var name="target" unset="true"/>
<echo> roboRIO not found via mDNS, falling back to static USB</echo>
<property name="target" value="172.22.11.2"/>
<if>
<isreachable host="${target}" timeout="5"/>
<then>
<echo>roboRIO found via static USB</echo>
</then>
<else>
<var name="target" unset="true"/>
<math result="ip.upper" operand1="${team-number}" operation="/" operand2="100" datatype="int"/>
<math result="ip.lower" operand1="${team-number}" operation="%" operand2="100" datatype="int"/>
<property name="target" value="10.${ip.upper}.${ip.lower}.2"/>
<echo>roboRIO not found via USB, falling back to static address of ${target}</echo>
<assert name="roboRIOFound" message="roboRIO not found, please check that the roboRIO is connected, imaged and that the team number is set properly in Eclipse">
<bool>
<isreachable host="${target}" timeout="5"/>
</bool>
</assert>
<echo>roboRIO found via Ethernet static</echo>
</else>
</if>
</else>
</if>
</target>
<target name="deploy" depends="get-target-ip" description="Deploy the progam and start it running.">
<target name="deploy" depends="get-target-ip, dependencies" description="Deploy the progam and start it running.">
<sshexec host="${target}"
username="${username}"
password="${password}"
@@ -42,11 +73,6 @@
trust="true"
command=". /etc/profile.d/natinst-path.sh; chmod a+x ${deploy.dir}/${out}; ${deploy.kill.command};"/>
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
command="tail -F -n 0 ${deploy.log.file}"/>
</target>
<target name="kill-program" depends="get-target-ip" description="Kill the currently running FRC program">
@@ -57,28 +83,6 @@
command="/usr/local/frc/bin/frcKillRobot.sh"/>
</target>
<target name="debug-deploy" depends="get-target-ip" description="Deploy the jar and start the program running in debug mode.">
<echo>[athena-deploy] Killing running program</echo>
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
command="killall FRCUserProgram; sleep 1"/>
<echo>[athena-debug-deploy] Copying code over.</echo>
<scp file="${dist.jar}" todir="${username}@${target}:${deploy.dir}"
password="${password}" trust="true"/>
<scp file="${wpilib.ant.dir}/debugcppprogram" todir="${username}@${target}:${deploy.dir}"
password="${password}" trust="true"/>
<scp file="${wpilib.ant.dir}/debugjavaprogram" todir="${username}@${target}:${deploy.dir}"
password="${password}" trust="true"/>
<echo>[athena-debug-deploy] Starting program.</echo>
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
command="chmod a+x debug*program; ${deploy.debug.command}"/>
</target>
<!-- Simulation support -->
<target name="simulate">
<parallel>
@@ -102,4 +106,21 @@
</sequential>
</parallel>
</target>
<target name="dependencies" depends="get-target-ip">
<property name="ant.enable.asserts" value="true"/>
<post to="http://${target}/nisysapi/server" logfile="sysProps.xml" verbose="false" encoding="UTF-16LE" append="false">
<prop name="Function" value="GetPropertiesOfItem"/>
<prop name="Plugins" value="nisyscfg"/>
<prop name="Items" value="system"/>
</post>
<loadfile srcFile="sysProps.xml" encoding="UTF-16LE" property="roboRIOSysValues"/>
<propertyregex property="roboRIOImage" input="${roboRIOSysValues}" regexp="FRC_roboRIO_2015_v([0-9]+)" select="\1" defaultValue="ImageRegExFail"/>
<assert message="roboRIO Image does not match plugin, allowed image version: ${roboRIOAllowedImages}">
<bool>
<contains string="${roboRIOAllowedImages}" substring="${roboRIOImage}"/>
</bool>
</assert>
<echo>roboRIO image version validated</echo>
</target>
</project>

View File

@@ -1 +1 @@
/home/admin/FRCUserProgram
/usr/local/frc/bin/netconsole-host /home/lvuser/FRCUserProgram

View File

@@ -10,12 +10,12 @@
</description>
<copyright>
* Copyright (c) 2013 FIRST and WPI
* Copyright (c) 2015 FIRST and WPI
* All rights reserved.
</copyright>
<license>
* Copyright (c) 2013 FIRST and WPI
* Copyright (c) 2015 FIRST and WPI
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or

View File

@@ -102,14 +102,7 @@
<!-- Javadoc -->
<artifactItem>
<groupId>edu.wpi.first.wpilibj</groupId>
<artifactId>wpilibJavaDevices</artifactId>
<version>0.1.0-SNAPSHOT</version>
<type>javadoc</type>
<outputDirectory>${java-zip}/javadoc-jar</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>edu.wpi.first.wpilibj</groupId>
<artifactId>wpilibJava</artifactId>
<artifactId>wpilibJavaFinal</artifactId>
<version>0.1.0-SNAPSHOT</version>
<type>javadoc</type>
<outputDirectory>${java-zip}/javadoc-jar</outputDirectory>
@@ -212,7 +205,7 @@
<format property="timestamp" pattern="yyyy/MM/dd HH:mm:ss z"/>
</tstamp>
<tstamp>
<format property="version-info" pattern="yyyy.MM"/>
<format property="version-info" pattern="yyyy.MM.dd.HH.mm.ss"/>
</tstamp>
<property name="version" value="${version-info}.${build-number}"/>
</target>

View File

@@ -31,10 +31,14 @@ public class Robot extends IterativeRobot {
// instantiate the command used for the autonomous period
autonomousCommand = new ExampleCommand();
}
public void disabledPeriodic() {
Scheduler.getInstance().run();
}
public void autonomousInit() {
// schedule the autonomous command (example)
autonomousCommand.start();
if (autonomousCommand != null) autonomousCommand.start();
}
/**
@@ -49,7 +53,15 @@ public class Robot extends IterativeRobot {
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
autonomousCommand.cancel();
if (autonomousCommand != null) autonomousCommand.cancel();
}
/**
* This function is called when the disabled button is hit.
* You can use it to reset subsystems before shutting down.
*/
public void disabledInit(){
}
/**

View File

@@ -8,11 +8,11 @@ package $package;
public class RobotMap {
// For example to map the left and right motors, you could define the
// following variables to use with your drivetrain subsystem.
// public static final int leftMotor = 1;
// public static final int rightMotor = 2;
// public static int leftMotor = 1;
// public static int rightMotor = 2;
// If you are using multiple modules, make sure to define both the port
// number and the module. For example you with a rangefinder:
// public static final int rangefinderPort = 1;
// public static final int rangefinderModule = 1;
// public static int rangefinderPort = 1;
// public static int rangefinderModule = 1;
}

View File

@@ -0,0 +1,53 @@
package $package;
import com.ni.vision.NIVision;
import com.ni.vision.NIVision.DrawMode;
import com.ni.vision.NIVision.Image;
import com.ni.vision.NIVision.ShapeMode;
import edu.wpi.first.wpilibj.SampleRobot;
/**
* This is a demo program showing the use of the NIVision class to do vision processing.
* The image is acquired from the USB Webcam, then a circle is overlayed on it.
* The NIVision class supplies dozens of methods for different types of processing.
* The resulting image can then be sent to the FRC PC Dashboard with setImage()
*/
public class Robot extends SampleRobot {
int session;
Image frame;
public void robotInit() {
frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);
/**
* the camera name (ex "cam1") can be found through the roborio web interface
*/
session = NIVision.IMAQdxOpenCamera("cam1",
NIVision.IMAQdxCameraControlMode.CameraControlModeController);
NIVision.IMAQdxConfigureGrab(session);
}
public void operatorControl() {
NIVision.IMAQdxStartAcquisition(session);
/**
* grab an image, draw the circle, and provide it for the camera server
* which will in turn send it to the dashboard.
*/
NIVision.Rect rect = new NIVision.Rect(10, 10, 100, 100);
while (isOperatorControl() && isEnabled()) {
NIVision.IMAQdxGrab(session, frame, 1);
NIVision.imaqDrawShapeOnImage(frame, frame, rect,
DrawMode.DRAW_VALUE, ShapeMode.SHAPE_OVAL, 0.0f);
CameraServer.getInstance().setImage(frame);
}
NIVision.IMAQdxStopAcquisition(session);
}
public void test() {
}
}

View File

@@ -0,0 +1,37 @@
package $package;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.CANTalon;
import edu.wpi.first.wpilibj.SampleRobot;
import edu.wpi.first.wpilibj.Timer;
/**
* This is a short sample program demonstrating how to use the basic throttle
* mode of the new CAN Talon.
*/
public class Robot extends SampleRobot {
CANTalon motor;
public Robot() {
motor = new CANTalon(1); // Initialize the CanTalonSRX on device 1.
}
/**
* Runs the motor.
*/
public void operatorControl() {
while (isOperatorControl() && isEnabled()) {
// Set the motor's output to half power.
// This takes a number from -1 (100% speed in reverse) to +1 (100% speed
// going forward)
motor.set(0.5);
Timer.delay(0.01); // Note that the CANTalon only receives updates every
// 10ms, so updating more quickly would not gain you
// anything.
}
motor.disable();
}
}

View File

@@ -0,0 +1,62 @@
package $package;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.CANTalon;
import edu.wpi.first.wpilibj.SampleRobot;
import edu.wpi.first.wpilibj.Timer;
/**
* This is a short sample program demonstrating how to use the Talon SRX over
* CAN to run a closed-loop PID controller with an analog potentiometer.
*/
public class Robot extends SampleRobot {
CANTalon motor;
public Robot() {
motor = new CANTalon(1); // Initialize the CanTalonSRX on device 1.
// This sets the mode of the m_motor. The options are:
// PercentVbus: basic throttle; no closed-loop.
// Current: Runs the motor with the specified current if possible.
// Speed: Runs a PID control loop to keep the motor going at a constant
// speed using the specified sensor.
// Position: Runs a PID control loop to move the motor to a specified move
// the motor to a specified sensor position.
// Voltage: Runs the m_motor at a constant voltage, if possible.
// Follower: The m_motor will run at the same throttle as the specified
// other talon.
motor.changeControlMode(CANTalon.ControlMode.Position);
// This command allows you to specify which feedback device to use when doing
// closed-loop control. The options are:
// AnalogPot: Basic analog potentiometer
// QuadEncoder: Quadrature Encoder
// AnalogEncoder: Analog Encoder
// EncRising: Counts the rising edges of the QuadA pin (allows use of a
// non-quadrature encoder)
// EncFalling: Same as EncRising, but counts on falling edges.
motor.setFeedbackDevice(CANTalon.FeedbackDevice.AnalogPot);
// This sets the basic P, I , and D values (F, Izone, and rampRate can also
// be set, but are ignored here).
// These must all be positive floating point numbers (reverseSensor will
// multiply the sensor values by negative one in case your sensor is flipped
// relative to your motor).
// These values are in units of throttle / sensor_units where throttle ranges
// from -1023 to +1023 and sensor units are from 0 - 1023 for analog
// potentiometers, encoder ticks for encoders, and position / 10ms for
// speeds.
motor.setPID(1.0, 0.0, 0.0);
}
public void operatorControl() {
while (isOperatorControl() && isEnabled()) {
// In closed loop mode, this sets the goal in the units mentioned above.
// Since we are using an analog potentiometer, this will try to go to
// the middle of the potentiometer range.
motor.set(512);
Timer.delay(5.0);
}
}
}

View File

@@ -0,0 +1,52 @@
package $package;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.RobotDrive.MotorType;
import edu.wpi.first.wpilibj.SampleRobot;
import edu.wpi.first.wpilibj.Timer;
/**
* This is a demo program showing how to use Mecanum control with the RobotDrive class.
*/
public class Robot extends SampleRobot {
RobotDrive robotDrive;
Joystick stick;
// Channels for the wheels
final int frontLeftChannel = 2;
final int rearLeftChannel = 3;
final int frontRightChannel = 1;
final int rearRightChannel = 0;
// The channel on the driver station that the joystick is connected to
final int joystickChannel = 0;
public Robot() {
robotDrive.setExpiration(0.1);
robotDrive = new RobotDrive(frontLeftChannel, rearLeftChannel, frontRightChannel, rearRightChannel);
robotDrive.setInvertedMotor(MotorType.kFrontLeft, true); // invert the left side motors
robotDrive.setInvertedMotor(MotorType.kRearLeft, true); // you may need to change or remove this to match your robot
stick = new Joystick(joystickChannel);
}
/**
* Runs the motors with Mecanum drive.
*/
public void operatorControl() {
robotDrive.setSafetyEnabled(true);
while (isOperatorControl() && isEnabled()) {
// Use the joystick X axis for lateral movement, Y axis for forward movement, and Z axis for rotation.
// This sample does not use field-oriented drive, so the gyro input is set to zero.
robotDrive.mecanumDrive_Cartesian(stick.getX(), stick.getY(), stick.getZ(), 0);
Timer.delay(0.005); // wait 5ms to avoid hogging CPU cycles
}
}
}

View File

@@ -1,5 +1,4 @@
package org.usfirst.frc.team190.robot;
package $package;
import edu.wpi.first.wpilibj.Joystick;
@@ -33,7 +32,7 @@ public class Robot extends SampleRobot {
* Runs the motor from a joystick.
*/
public void operatorControl() {
while (isOperatorControl()) {
while (isOperatorControl() && isEnabled()) {
// Set the motor's output.
// This takes a number from -1 (100% speed in reverse) to +1 (100% speed going forward)
motor.set(stick.getY());

View File

@@ -0,0 +1,35 @@
package $package;
import edu.wpi.first.wpilibj.SampleRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Timer;
/**
* This is a demo program showing the use of the CameraServer class.
* With start automatic capture, there is no opertunity to process the image.
* Look at the AdvancedVision sample for how to process the image before sending it to the FRC PC Dashboard.
*/
public class Robot extends SampleRobot {
CameraServer server;
public Robot() {
server = CameraServer.getInstance();
server.setQuality(50);
}
/**
* start up automatic capture you should see the video stream from the
* webcam in your FRC PC Dashboard.
*/
public void operatorControl() {
server.startAutomaticCapture("cam1");
while (isOperatorControl() && isEnabled()) {
/** robot code here! **/
}
}
}

View File

@@ -37,7 +37,7 @@ public class Robot extends SampleRobot {
*/
public void operatorControl() {
myRobot.setSafetyEnabled(true);
while (isOperatorControl()) {
while (isOperatorControl() && isEnabled()) {
myRobot.tankDrive(leftStick, rightStick);
Timer.delay(0.005); // wait for a motor update time
}

View File

@@ -81,6 +81,11 @@
<description>Example programs that demonstrate the use of the various commonly used sensors on FRC robots</description>
</tagDescription>
<tagDescription>
<name>Vision</name>
<description>Example programs that demonstrate the use of USB Cameras and image processing</description>
</tagDescription>
<example>
<name>Getting Started</name>
<description>An example program which demonstrates the simplest autonomous and
@@ -116,6 +121,25 @@
</files>
</example>
<example>
<name>Mecanum Drive</name>
<description>Demonstrate the use of the RobotDrive class doing teleop driving with Mecanum steering</description>
<tags>
<tag>Actuators</tag>
<tag>Complete List</tag>
<tag>Joystick</tag>
<tag>Robot and Motor</tag>
<tag>Safety</tag>
</tags>
<packages>
<package>src/$package-dir</package>
</packages>
<files>
<file source="examples/MecanumDrive/src/org/usfirst/frc/team190/robot/Robot.java"
destination="src/$package-dir/Robot.java"></file>
</files>
</example>
<example>
<name>Motor Controller</name>
@@ -135,6 +159,40 @@
</files>
</example>
<example>
<name>CAN Talon SRX</name>
<description>Demonstrate running a Talon SRX with the basic throttle mode.</description>
<tags>
<tag>Actuators</tag>
<tag>Complete List</tag>
<tag>Robot and Motor</tag>
</tags>
<packages>
<package>src/$package-dir</package>
</packages>
<files>
<file source="examples/CANTalon/src/org/usfirst/frc/team190/robot/Robot.java"
destination="src/$package-dir/Robot.java"></file>
</files>
</example>
<example>
<name>CAN Talon SRX PID</name>
<description>Demonstrate running a Talon SRX with PID Closed Loop control.</description>
<tags>
<tag>Actuators</tag>
<tag>Complete List</tag>
<tag>Robot and Motor</tag>
</tags>
<packages>
<package>src/$package-dir</package>
</packages>
<files>
<file source="examples/CANTalonPID/src/org/usfirst/frc/team190/robot/Robot.java"
destination="src/$package-dir/Robot.java"></file>
</files>
</example>
<tagDescription>
<name>CommandBased Robot</name>
@@ -147,6 +205,7 @@
<tags>
<tag>CommandBased Robot</tag>
</tags>
<world>/usr/share/frcsim/worlds/GearsBotDemo.world</world>
<packages>
<package>src/$package-dir</package>
<package>src/$package-dir/commands</package>
@@ -179,6 +238,7 @@
<tags>
<tag>CommandBased Robot</tag>
</tags>
<world>/usr/share/frcsim/worlds/PacGoat2014.world</world>
<packages>
<package>src/$package-dir</package>
<package>src/$package-dir/commands</package>
@@ -232,4 +292,35 @@
destination="src/$package-dir/triggers/DoubleButton.java"></file>
</files>
</example>
<example>
<name>Quick Vision</name>
<description>Demonstrate the use of the CameraServer class to stream from a USB Webcam without processing the images.</description>
<tags>
<tag>Vision</tag>
</tags>
<packages>
<package>src/$package-dir</package>
</packages>
<files>
<file source="examples/QuickVision/src/org/usfirst/frc/team190/robot/Robot.java"
destination="src/$package-dir/Robot.java"></file>
</files>
</example>
<example>
<name>Advanced Vision</name>
<description>Demonstrate the use of the NIVision class to capture image from a Webcam, process them, and then send them to the dashboard.</description>
<tags>
<tag>Vision</tag>
</tags>
<packages>
<package>src/$package-dir</package>
</packages>
<files>
<file source="examples/AdvancedVision/src/org/usfirst/frc/team190/robot/Robot.java"
destination="src/$package-dir/Robot.java"></file>
</files>
</example>
</examples>

View File

@@ -48,7 +48,7 @@ public class Robot extends SampleRobot {
*/
public void operatorControl() {
myRobot.setSafetyEnabled(true);
while (isOperatorControl()) {
while (isOperatorControl() && isEnabled()) {
myRobot.arcadeDrive(stick); // drive with arcade style (use right stick)
Timer.delay(0.005); // wait for a motor update time
}

View File

@@ -2,6 +2,7 @@ package edu.wpi.first.wpilib.plugins.java.launching;
import java.io.File;
import java.lang.reflect.Method;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
@@ -15,8 +16,6 @@ import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.IStreamListener;
import org.eclipse.debug.core.model.IStreamMonitor;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.ILaunchShortcut;
import org.eclipse.jdt.core.IJavaElement;
@@ -37,13 +36,13 @@ import edu.wpi.first.wpilib.plugins.java.WPILibJavaPlugin;
@SuppressWarnings("restriction")
public abstract class JavaLaunchShortcut implements ILaunchShortcut {
private static final int DEBUG_ATTACH_ATTEMPTS = 20;
private static final int DEBUG_ATTACH_RETRY_DELAY_SEC = 2;
//Class constants - used to delineate types for launch shortcuts
public static final String DEPLOY_TYPE = "edu.wpi.first.wpilib.plugins.core.deploy";
private static final String ANT_SERVER_THREAD_NAME = "Ant Build Server Connection";
// NOTE: This string must be changed if the port is changed.
private static final String DEBUG_START_TEXT = "Listening for transport dt_socket at address: 8348";
private static ILaunch lastDeploy = null;
/**
@@ -155,11 +154,9 @@ public abstract class JavaLaunchShortcut implements ILaunchShortcut {
lastDeploy = AntLauncher.runAntFile(new File (activeProj.getLocation().toOSString() + File.separator + "build.xml"), targets, null, mode);
if((mode.equals(ILaunchManager.DEBUG_MODE))&&(getLaunchType().equals(DEPLOY_TYPE))) {
ILaunchConfigurationWorkingCopy config;
try {
config = getRemoteDebugConfig(activeProj);
startDebugConfig(config, lastDeploy);
} catch (CoreException e) {
startDebugConfig(getRemoteDebugConfig(activeProj));
} catch (CoreException | InterruptedException e) {
WPILibJavaPlugin.logError("Debug attach failed", e);
}
}
@@ -190,20 +187,28 @@ public abstract class JavaLaunchShortcut implements ILaunchShortcut {
return WPILibCore.getDefault().getTargetIP(proj);
}
private void startDebugConfig(final ILaunchConfigurationWorkingCopy config, ILaunch deploy) throws CoreException {
IStreamListener listener = new IStreamListener() {
@Override
public void streamAppended(String text, IStreamMonitor monitor) {
if (text.contains(DEBUG_START_TEXT)) {
try {
config.launch(ILaunchManager.DEBUG_MODE, null);
} catch (CoreException e) {
WPILibJavaPlugin.logError("Error starting debug config..", e);
}
monitor.removeListener(this);
private void startDebugConfig(final ILaunchConfigurationWorkingCopy config)
throws CoreException, InterruptedException {
int remainingAttempts = DEBUG_ATTACH_ATTEMPTS;
// Retry until success or rethrow of exception on failure
while (true) {
try {
WPILibJavaPlugin.logInfo("Attemping to attach debugger...");
config.launch(ILaunchManager.DEBUG_MODE, null);
WPILibJavaPlugin.logInfo("Debugger attached.");
break;
} catch (CoreException e) {
if (--remainingAttempts > 0) {
String errorMsg = MessageFormat.format("Unable to attach debugger. "
+ "{0} attempts remain - waiting {1} second(s) before retrying...",
remainingAttempts, DEBUG_ATTACH_RETRY_DELAY_SEC);
WPILibJavaPlugin.logError(errorMsg, null);
Thread.sleep(DEBUG_ATTACH_RETRY_DELAY_SEC * 1000);
} else {
throw e;
}
}
};
deploy.getProcesses()[0].getStreamsProxy().getOutputStreamMonitor().addListener(listener);
}
}
}

View File

@@ -2,6 +2,8 @@ package edu.wpi.first.wpilib.plugins.java.launching;
import org.eclipse.core.resources.IProject;
import edu.wpi.first.wpilib.plugins.core.launching.SimulationNotification;
public class SimulateLaunchShortcut extends JavaLaunchShortcut {
@@ -11,7 +13,11 @@ public class SimulateLaunchShortcut extends JavaLaunchShortcut {
* @param mode The mode it will be run in (ILaunchManager.RUN_MODE or ILaunchManager.DEBUG_MODE)
*/
public void runConfig(IProject activeProj, String mode){
runConfigHelper(activeProj, mode, "simulate", "debug-simulate");
if (SimulationNotification.supportsSimulation()) {
runConfigHelper(activeProj, mode, "simulate", "debug-simulate");
} else {
SimulationNotification.showUnsupported();
}
}
protected String getHostname(IProject proj) {

View File

@@ -7,16 +7,17 @@ import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject;
import edu.wpi.first.wpilib.plugins.java.wizards.newproject.JavaProjectType;
public class ExampleJavaProject extends JavaProjectType implements IExampleProject {
private String name, description;
private String name, description, world;
private List<String> tags;
private List<String> packages;
private List<ExportFile> files;
public ExampleJavaProject(String name, String description, List<String> tags,
List<String> packages, List<ExportFile> files) {
String world, List<String> packages, List<ExportFile> files) {
this.name = name;
this.description = description;
this.tags = tags;
this.world = world;
this.packages = packages;
this.files = files;
}
@@ -32,6 +33,10 @@ public class ExampleJavaProject extends JavaProjectType implements IExampleProje
public List<String> getTags() {
return tags;
}
public String getWorld() {
return world;
}
@Override
public String[] getFolders(String packageName) {

View File

@@ -10,6 +10,7 @@ import org.eclipse.jface.wizard.IWizardPage;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
import edu.wpi.first.wpilib.plugins.core.wizards.ExampleWizard;
import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject;
import edu.wpi.first.wpilib.plugins.core.wizards.INewProjectInfo;
import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject.ExportFile;
import edu.wpi.first.wpilib.plugins.core.wizards.NewProjectMainPage;
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils;
@@ -40,9 +41,9 @@ public class ExampleJavaWizard extends ExampleWizard {
}
@Override
protected IWizardPage getDetailsPage() {
protected IWizardPage getDetailsPage(INewProjectInfo info) {
if (detailsPage != null) return detailsPage;
detailsPage = new NewProjectMainPage(selection, getTeamNumberPage());
detailsPage = new NewProjectMainPage(selection, getTeamNumberPage(), info);
detailsPage.setTitle("Create Example Robot Java Project");
detailsPage.setDescription("This wizard creates a new example project based on your selection.");
return detailsPage;
@@ -50,8 +51,8 @@ public class ExampleJavaWizard extends ExampleWizard {
@Override
public IExampleProject makeExampleProject(String name, String description,
List<String> tags, List<String> folders, List<ExportFile> files) {
return new ExampleJavaProject(name, description, tags, folders, files);
List<String> tags, String world, List<String> folders, List<ExportFile> files) {
return new ExampleJavaProject(name, description, tags, world, folders, files);
}
@Override

View File

@@ -11,7 +11,9 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -76,6 +78,15 @@ public class FileTemplateWizardMainPage extends WizardPage {
});
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
projectsCombo.setLayoutData(gd);
projectsCombo.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e){
if (project == null){
project = projectsCombo.getProject();
}
packageText.setText(getDefaultPackage());
}
public void widgetDefaultSelected(SelectionEvent e){}
});
projectsCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
dialogChanged();
@@ -116,6 +127,7 @@ public class FileTemplateWizardMainPage extends WizardPage {
*/
private void initialize() {
WPILibJavaPlugin.logInfo("initialize");
projectsCombo.setProject(project);
packageText.setText(getDefaultPackage());
}
@@ -130,7 +142,7 @@ public class FileTemplateWizardMainPage extends WizardPage {
// Update the default package if necessary
if (project == null || !project.equals(projectsCombo.getProject())) {
String oldDefault = getDefaultPackage();
String oldDefault = getDefaultPackage();
project = projectsCombo.getProject();
if (packageString.equals(oldDefault)) {
packageText.setText(getDefaultPackage());
@@ -200,4 +212,4 @@ public class FileTemplateWizardMainPage extends WizardPage {
if (defaultPackage != null) return defaultPackage;
else return "";
}
}
}

View File

@@ -15,6 +15,7 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWizard;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
import edu.wpi.first.wpilib.plugins.core.wizards.INewProjectInfo;
import edu.wpi.first.wpilib.plugins.core.wizards.NewProjectMainPage;
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils;
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType;
@@ -56,7 +57,7 @@ public class NewJavaWizard extends Wizard implements INewWizard {
teamNumberPage = new TeamNumberPage(selection);
addPage(teamNumberPage);
}
page = new NewProjectMainPage(selection, teamNumberPage);
page = new NewProjectMainPage(selection, teamNumberPage, INewProjectInfo.Null);
page.setProjectTypes(JavaProjectType.TYPES);
page.setTitle("Create New Robot Java Project");
page.setDescription("This wizard creates a new Robot Java Project configured to use WPILib for programming FRC robots.");

View File

@@ -1,14 +1,13 @@
# Deployment information
username=admin
username=lvuser
password=
deploy.dir=/home/admin
deploy.dir=/home/lvuser
deploy.kill.command=. /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t -r
deploy.log.file=/var/local/natinst/log/FRC_UserProgram.log
deploy.log.command=tail -F -n 0 ${deploy.log.file}
debug.flag.dir=/tmp/
debug.flag.command=chown lvuser:ni ${debug.flag.dir}frcdebug
command.dir=/home/lvuser/
version=current
roboRIOJRE.dir=/usr/local/frc/JRE
# Libraries to use
wpilib=${user.home}/wpilib/java/${version}
@@ -21,6 +20,7 @@ networktables.sources=${wpilib.lib}/NetworkTables-sources.jar
#jnaerator.jar=${wpilib.lib}/jnaerator-runtime.jar
#classpath=${wpilib.jar}:${networktables.jar}:${jna.jar}:${jnaerator.jar}
classpath=${wpilib.jar}:${networktables.jar}
roboRIOAllowedImages=23
# Ant support
wpilib.ant.dir=${wpilib}/ant

View File

@@ -19,8 +19,39 @@
<!-- Targets -->
<target name="get-target-ip">
<property name="ant.enable.asserts" value="true"/>
<property name="target" value="roboRIO-${team-number}.local" />
<echo>Target: ${target}</echo>
<echo>Trying Target: ${target}</echo>
<if>
<isreachable host="${target}" timeout="5"/>
<then>
<echo>roboRIO found via mDNS</echo>
</then>
<else>
<var name="target" unset="true"/>
<echo> roboRIO not found via mDNS, falling back to static USB</echo>
<property name="target" value="172.22.11.2"/>
<if>
<isreachable host="${target}" timeout="5"/>
<then>
<echo>roboRIO found via static USB</echo>
</then>
<else>
<var name="target" unset="true"/>
<math result="ip.upper" operand1="${team-number}" operation="/" operand2="100" datatype="int"/>
<math result="ip.lower" operand1="${team-number}" operation="%" operand2="100" datatype="int"/>
<property name="target" value="10.${ip.upper}.${ip.lower}.2"/>
<echo>roboRIO not found via USB, falling back to static address of ${target}</echo>
<assert name="roboRIOFound" message="roboRIO not found, please check that the roboRIO is connected, imaged and that the team number is set properly in Eclipse">
<bool>
<isreachable host="${target}" timeout="5"/>
</bool>
</assert>
<echo>roboRIO found via Ethernet static</echo>
</else>
</if>
</else>
</if>
</target>
<target name="compile" description="Compile the source code.">
@@ -66,7 +97,11 @@
</jar>
</target>
<target name="deploy" depends="get-target-ip,jar" description="Deploy the jar and start the program running.">
<!-- We're running a clean here to get around a known ant issue where it does not detected changed constant variables.
To get around this, we're recompiling the entire project, which is not an issue for most teams. If this is an issue
for you, you can remove the clean here, just be sure to do a full rebuild after you've changed any constants.
Reference: http://stackoverflow.com/questions/6430001/ant-doesnt-recompile-constants -->
<target name="deploy" depends="clean,jar,get-target-ip,dependencies" description="Deploy the jar and start the program running.">
<echo>[athena-deploy] Copying code over.</echo>
<scp file="${dist.jar}" todir="${username}@${target}:${deploy.dir}" password="${password}" trust="true"/>
<scp file="${wpilib.ant.dir}/robotCommand" todir="${username}@${target}:${command.dir}" password="${password}" trust="true"/>
@@ -78,14 +113,9 @@
trust="true"
command="${deploy.kill.command};"/>
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
command="${deploy.log.command}"/>
</target>
<target name="debug-deploy" depends="get-target-ip,jar" description="Deploy the jar and start the program running.">
<target name="debug-deploy" depends="jar,get-target-ip,dependencies" description="Deploy the jar and start the program running.">
<echo>[athena-deploy] Copying code over.</echo>
<scp file="${dist.jar}" todir="${username}@${target}:${deploy.dir}" password="${password}" trust="true"/>
<!-- The remoteDebugCommand file is used by /usr/local/frc/bin/frcRunRobot.sh on the roboRIO -->
@@ -105,11 +135,6 @@
trust="true"
command="${deploy.kill.command}"/>
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
command="${deploy.log.command}"/>
</target>
<!-- Simulate -->
@@ -180,4 +205,28 @@
</sequential>
</parallel>
</target>
<target name="dependencies" depends="get-target-ip">
<property name="ant.enable.asserts" value="true"/>
<post to="http://${target}/nisysapi/server" logfile="sysProps.xml" verbose="false" encoding="UTF-16LE" append="false">
<prop name="Function" value="GetPropertiesOfItem"/>
<prop name="Plugins" value="nisyscfg"/>
<prop name="Items" value="system"/>
</post>
<loadfile srcFile="sysProps.xml" encoding="UTF-16LE" property="roboRIOSysValues"/>
<propertyregex property="roboRIOImage" input="${roboRIOSysValues}" regexp="FRC_roboRIO_2015_v([0-9]+)" select="\1" defaultValue="ImageRegExFail"/>
<assert message="roboRIO Image does not match plugin, allowed image version: ${roboRIOAllowedImages}">
<bool>
<contains string="${roboRIOAllowedImages}" substring="${roboRIOImage}"/>
</bool>
</assert>
<echo>roboRIO image version validated</echo>
<echo>Checking for JRE. If this fails install the JRE using these instructions: http://wpilib.screenstepslive.com/s/4485/m/13809/l/243933-installing-java-8-on-the-roborio-java-only</echo>
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
failonerror="true"
command="test -d ${roboRIOJRE.dir}"/>
</target>
</project>

View File

@@ -1,3 +1,2 @@
/usr/local/frc/JRE/bin/java
-jar /home/admin/FRCUserProgram.jar
env LD_PRELOAD=/lib/libstdc++.so.6.0.20 /usr/local/frc/bin/netconsole-host /usr/local/frc/JRE/bin/java -jar /home/lvuser/FRCUserProgram.jar

View File

@@ -1,3 +1,2 @@
/usr/local/frc/JRE/bin/java -XX:+UsePerfData -agentlib:jdwp=transport=dt_socket,address=8348,server=y,suspend=y
-jar /home/admin/FRCUserProgram.jar
env LD_PRELOAD=/lib/libstdc++.so.6.0.20 /usr/local/frc/bin/netconsole-host /usr/local/frc/JRE/bin/java -XX:+UsePerfData -agentlib:jdwp=transport=dt_socket,address=8348,server=y,suspend=y -jar /home/lvuser/FRCUserProgram.jar

View File

@@ -0,0 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WPILib_Riolog
Bundle-SymbolicName: edu.wpi.first.wpilib.plugins.riolog;singleton:=true
Bundle-Version: 0.1.0.qualifier
Bundle-Activator: netconsole2.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Vendor: WPI & FIRST

View File

@@ -0,0 +1,13 @@
Riolog
This is an Eclipse plugin that receives and displays text from UDP port 6666. It
defines a new view that displays the received text.
To compile, open project in an Eclipse instance with the appropriate plugin
development tools, and Export as a deployable plugin/fragment.
To install, copy the resulting jar file into $eclipse/dropins/, and start
Eclipse (-clean may be necessary).
To enable, go to Window>Show View>Other... and choose General>Riolog.

View File

@@ -0,0 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
icons/,\
contexts.xml

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<contexts>
<context id="text" title="Riolog">
<description>This is the context help for the Riolog It was generated by a PDE template.</description>
<topic href="/PLUGINS_ROOT/org.eclipse.platform.doc.isv/guide/ua_help_context.htm" label="Context-sensitive help">
<enablement>
<with variable="platform">
<test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.platform.doc.isv"/>
</with>
</enablement>
</topic>
</context>
</contexts>

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.views">
<view
name="Riolog"
icon="icons/riolog.png"
category="org.eclipse.ui"
class="netconsole2.views.RiologView"
id="netconsole2.views.RiologView">
</view>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.jdt.ui.JavaPerspective">
<view
ratio="0.5"
relative="org.eclipse.ui.views.ProblemView"
relationship="right"
id="netconsole2.views.RiologView">
</view>
</perspectiveExtension>
</extension>
<extension
point="org.eclipse.help.contexts">
<contexts
file="contexts.xml">
</contexts>
</extension>
</plugin>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<artifactId>edu.wpi.first.wpilib.plugins.riolog</artifactId>
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>edu.wpi.first.wpilib.plugins</groupId>
<artifactId>edu.wpi.first.wpilib.plugins</artifactId>
<version>0.1.0.qualifier</version>
<relativePath>..</relativePath>
</parent>
</project>

View File

@@ -0,0 +1,61 @@
package netconsole2;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "riolog"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
/**
* Returns an image descriptor for the image file at the given
* plug-in relative path
*
* @param path the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
}

View File

@@ -0,0 +1,414 @@
package netconsole2.views;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetSocketAddress;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
public class RiologView extends ViewPart {
public static Action confAction(String name, String tooltip, String img,
Action e) {
e.setText(name);
e.setToolTipText(tooltip);
e.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
.getImageDescriptor(img));
return e;
}
public static byte[] getPacket(DatagramSocket socket, DatagramPacket buf) {
try {
socket.receive(buf);
} catch (IOException e) {
return null;
}
byte[] ret = new byte[buf.getLength()];
System.arraycopy(buf.getData(), 0, ret, 0, ret.length);
return ret;
}
public static DatagramSocket makeRecvSocket() {
DatagramSocket socket = null;
try {
socket = new DatagramSocket(null);
socket.setReuseAddress(true);
socket.bind(new InetSocketAddress(6666));
} catch (SocketException e) {
e.printStackTrace();
socket.close();
return null;
}
return socket;
}
public static Thread startDaemonThread(Runnable r, String name) {
Thread t = new Thread(r, name);
t.setDaemon(true);
t.start();
return t;
}
/**
* The ID of the view as specified by the extension.
*/
public static final String ID = "netconsole2.views.RiologView";
Text text;
Thread listener;
Thread transferer;
volatile DatagramSocket socket_hook = null;
volatile boolean discard = false;
volatile boolean paused = false;
volatile boolean cleanup = false;
private Action clearAction;
private Action pauseAction;
private Action discardAction;
private Action unpauseAction;
private Action undiscardAction;
private Button discardButton;
private Button pauseButton;
/**
* The constructor.
*/
public RiologView() {
}
private void contributeToActionBars() {
IActionBars bars = getViewSite().getActionBars();
fillLocalPullDown(bars.getMenuManager());
fillLocalToolBar(bars.getToolBarManager());
}
/**
* This is a callback that will allow us to create the viewer and initialize
* it.
*/
public void createPartControl(Composite parent) {
GridLayout glayout = new GridLayout();
glayout.numColumns = 1;
parent.setLayout(glayout);
text = new Text(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL
| SWT.READ_ONLY);
{
GridData gdata = new GridData();
gdata.grabExcessVerticalSpace = true;
gdata.grabExcessHorizontalSpace = true;
gdata.horizontalAlignment = SWT.FILL;
gdata.verticalAlignment = SWT.FILL;
text.setLayoutData(gdata);
}
Composite row = new Composite(parent, SWT.NONE);
row.setLayout(new FillLayout(SWT.HORIZONTAL));
{
GridData gdata = new GridData();
gdata.grabExcessVerticalSpace = false;
gdata.grabExcessHorizontalSpace = true;
gdata.horizontalAlignment = SWT.FILL;
gdata.verticalAlignment = SWT.CENTER;
row.setLayoutData(gdata);
}
// Create the help context id for the viewer's control
PlatformUI.getWorkbench().getHelpSystem()
.setHelp(parent, "netconsole2.text");
makeActions();
makeButtons(row);
hookContextMenu();
contributeToActionBars();
startListening();
}
public void makeButtons(Composite parent) {
pauseButton = new Button(parent, SWT.TOGGLE);
pauseButton.setText(pauseAction.getText());
pauseButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (pauseButton.getSelection()) {
pauseAction.run();
} else {
unpauseAction.run();
}
}
});
discardButton = new Button(parent, SWT.TOGGLE);
discardButton.setText(discardAction.getText());
discardButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (discardButton.getSelection()) {
discardAction.run();
} else {
undiscardAction.run();
}
}
});
Button clearButton = new Button(parent, SWT.PUSH);
clearButton.setText(clearAction.getText());
clearButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
clearAction.run();
}
});
}
@Override
public void dispose() {
stopListening();
super.dispose();
}
private void fillContextMenu(IMenuManager manager) {
manager.add(pauseAction);
manager.add(unpauseAction);
manager.add(new Separator());
manager.add(clearAction);
manager.add(new Separator());
manager.add(discardAction);
manager.add(undiscardAction);
manager.add(new Separator());
manager.add(confAction("Copy", "Copy selected text",
ISharedImages.IMG_TOOL_COPY, new Action() {
@Override
public void run() {
text.copy();
}
}));
manager.add(confAction("Select All", "Select all text", "",
new Action() {
@Override
public void run() {
text.selectAll();
}
}));
}
private void fillLocalPullDown(IMenuManager manager) {
manager.add(pauseAction);
manager.add(unpauseAction);
manager.add(new Separator());
manager.add(clearAction);
manager.add(new Separator());
manager.add(discardAction);
manager.add(undiscardAction);
}
private void fillLocalToolBar(IToolBarManager manager) {
manager.add(pauseAction);
manager.add(unpauseAction);
manager.add(new Separator());
manager.add(clearAction);
manager.add(new Separator());
manager.add(discardAction);
manager.add(undiscardAction);
}
private void hookContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
RiologView.this.fillContextMenu(manager);
}
});
Menu menu = menuMgr.createContextMenu(text);
text.setMenu(menu);
}
private void makeActions() {
clearAction = confAction("Clear Log", "Empty the textbox",
ISharedImages.IMG_ETOOL_CLEAR, new Action() {
public void run() {
text.setText("");
}
});
pauseAction = confAction("Pause Display",
"Stop adding packets to the textbox",
ISharedImages.IMG_ELCL_STOP, new Action() {
public void run() {
pauseAction.setEnabled(false);
unpauseAction.setEnabled(true);
pauseButton.setSelection(true);
pauseButton.setText("Show 0 Packets");
paused = true;
}
});
pauseAction.setEnabled(true);
unpauseAction = confAction("Continue Display",
"Continue adding packets to the textbox",
ISharedImages.IMG_TOOL_FORWARD, new Action() {
public void run() {
paused = false;
transferer.interrupt();
pauseAction.setEnabled(true);
unpauseAction.setEnabled(false);
pauseButton.setSelection(false);
pauseButton.setText(pauseAction.getText());
}
});
unpauseAction.setEnabled(false);
discardAction = confAction("Discard Incoming",
"Drop all incoming packets", ISharedImages.IMG_ETOOL_DELETE,
new Action() {
public void run() {
discard = true;
discardAction.setEnabled(false);
undiscardAction.setEnabled(true);
discardButton.setSelection(true);
discardButton.setText(undiscardAction.getText());
}
});
discardAction.setEnabled(true);
undiscardAction = confAction("Accept Incoming",
"Accept all incoming packets", ISharedImages.IMG_OBJ_ADD,
new Action() {
public void run() {
discard = false;
discardAction.setEnabled(true);
undiscardAction.setEnabled(false);
discardButton.setSelection(false);
discardButton.setText(discardAction.getText());
}
});
undiscardAction.setEnabled(false);
}
/**
* Passing the focus request to the viewer's control.
*/
public void setFocus() {
text.setFocus();
}
public static String drainToString(ArrayList<byte[]> arr) {
int netlength = 0;
for (byte[] b : arr) {
netlength += b.length;
}
byte[] sum = new byte[netlength];
int mark = 0;
for (int i=0;i<arr.size();i++) {
byte[] b = arr.get(i);
System.arraycopy(b, 0, sum, mark, b.length);
arr.set(i, null);
mark += b.length;
}
arr.clear();
return new String(sum);
}
void startListening() {
final BlockingQueue<byte[]> queue = new LinkedBlockingQueue<>();
listener = startDaemonThread(new Runnable() {
@Override
public void run() {
DatagramSocket socket = makeRecvSocket();
if (socket == null)
return;
socket_hook = socket;
byte[] buf = new byte[4096];
DatagramPacket datagram = new DatagramPacket(buf, buf.length);
while (!Thread.interrupted()) {
byte[] s = getPacket(socket, datagram);
if (s != null && !discard) {
try {
queue.put(s);
} catch (InterruptedException e) {
socket.close();
return;
}
}
}
socket.close();
}
}, "Riolog-Listener");
transferer = startDaemonThread(new Runnable() {
@Override
public void run() {
final ArrayList<byte[]> temp = new ArrayList<>();
while (!cleanup) {
try {
temp.add(queue.take());
} catch (InterruptedException e) {
if (cleanup) {
return;
}
}
queue.drainTo(temp);
if (!paused) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
if (text.isDisposed())
return;
text.append(drainToString(temp));
}
});
} else {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
if (paused) {
if (temp.size() == 1) {
pauseButton.setText("Show 1 Packet\u2002");
} else {
pauseButton.setText("Show " + String.valueOf(temp.size()) + " Packets");
}
}
}
});
}
}
}
}, "Riolog-Transfer");
}
void stopListening() {
cleanup = true;
if (socket_hook != null) {
socket_hook.close();
}
listener.interrupt();
transferer.interrupt();
}
}

View File

@@ -14,19 +14,20 @@
<module>edu.wpi.first.wpilib.plugins.cpp.feature</module>
<module>edu.wpi.first.wpilib.plugins.java</module>
<module>edu.wpi.first.wpilib.plugins.java.feature</module>
<module>edu.wpi.first.wpilib.plugins.riolog</module>
<module>edu.wpi.first.wpilib.plugins.updatesite</module>
</modules>
<properties>
<!-- local-repository>C:/Users/wpilibj-buildmaster/maven-repository</local-repository-->
<tycho-version>0.18.1</tycho-version>
<tycho-version>0.21.0</tycho-version>
</properties>
<repositories>
<repository>
<id>juno</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/juno</url>
<url>http://download.eclipse.org/releases/luna</url>
</repository>
<repository>
<id>FRC Binaries</id>

View File

@@ -8,6 +8,10 @@ target_link_libraries(HALAthena ${NI_LIBS})
INSTALL(TARGETS HALAthena ARCHIVE DESTINATION lib COMPONENT lib)
INSTALL(FILES ${NI_LIBS} ${WPI_LD_LIBS} DESTINATION lib COMPONENT ni_lib)
INSTALL(DIRECTORY include DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT headers)
add_library(HALAthena_shared SHARED ${SRC_FILES})
target_link_libraries(HALAthena_shared ${NI_LIBS})
INSTALL(TARGETS HALAthena_shared LIBRARY DESTINATION lib COMPONENT lib)
# lib/ c m gcc_s ld-linux
# usr/lib
# FRC_NetworkCommunication FRC_FPGA_ChipObject RoboRIO_FRC_ChipObject

View File

@@ -63,8 +63,6 @@ extern "C"
void setCounterPulseLengthMode(void* counter_pointer, double threshold, int32_t *status);
int32_t getCounterSamplesToAverage(void* counter_pointer, int32_t *status);
void setCounterSamplesToAverage(void* counter_pointer, int samplesToAverage, int32_t *status);
void startCounter(void* counter_pointer, int32_t *status);
void stopCounter(void* counter_pointer, int32_t *status);
void resetCounter(void* counter_pointer, int32_t *status);
int32_t getCounter(void* counter_pointer, int32_t *status);
double getCounterPeriod(void* counter_pointer, int32_t *status);
@@ -78,8 +76,6 @@ extern "C"
uint8_t port_b_module, uint32_t port_b_pin, bool port_b_analog_trigger,
bool reverseDirection, int32_t *index, int32_t *status); // TODO: fix routing
void freeEncoder(void* encoder_pointer, int32_t *status);
void startEncoder(void* encoder_pointer, int32_t *status);
void stopEncoder(void* encoder_pointer, int32_t *status);
void resetEncoder(void* encoder_pointer, int32_t *status);
int32_t getEncoder(void* encoder_pointer, int32_t *status); // Raw value
double getEncoderPeriod(void* encoder_pointer, int32_t *status);

View File

@@ -1,26 +1,64 @@
#pragma once
#define SAMPLE_RATE_TOO_HIGH 1
#define SAMPLE_RATE_TOO_HIGH_MESSAGE "Analog module sample rate is too high"
#define VOLTAGE_OUT_OF_RANGE 2
#define VOLTAGE_OUT_OF_RANGE_MESSAGE "Voltage to convert to raw value is out of range [0; 5]"
#define LOOP_TIMING_ERROR 4
#define LOOP_TIMING_ERROR_MESSAGE "Digital module loop timing is not the expected value"
#define SPI_WRITE_NO_MOSI 12
#define SPI_WRITE_NO_MOSI_MESSAGE "Cannot write to SPI port with no MOSI output"
#define SPI_READ_NO_MISO 13
#define SPI_READ_NO_MISO_MESSAGE "Cannot read from SPI port with no MISO input"
#define SPI_READ_NO_DATA 14
#define SPI_READ_NO_DATA_MESSAGE "No data available to read from SPI"
#define INCOMPATIBLE_STATE 15
#define INCOMPATIBLE_STATE_MESSAGE "Incompatible State: The operation cannot be completed"
#define NO_AVAILABLE_RESOURCES -4
#define NO_AVAILABLE_RESOURCES_MESSAGE "No available resources to allocate"
#define NULL_PARAMETER -5
#define NULL_PARAMETER_MESSAGE "A pointer parameter to a method is NULL"
#define ANALOG_TRIGGER_LIMIT_ORDER_ERROR -10
#define ANALOG_TRIGGER_LIMIT_ORDER_ERROR_MESSAGE "AnalogTrigger limits error. Lower limit > Upper Limit"
#define ANALOG_TRIGGER_PULSE_OUTPUT_ERROR -11
#define ANALOG_TRIGGER_PULSE_OUTPUT_ERROR_MESSAGE "Attempted to read AnalogTrigger pulse output."
#define PARAMETER_OUT_OF_RANGE -28
#define PARAMETER_OUT_OF_RANGE_MESSAGE "A parameter is out of range."
#define CTR_RxTimeout_MESSAGE "CTRE CAN Recieve Timeout"
#define CTR_TxTimeout_MESSAGE "CTRE CAN Transmit Timeout"
#define CTR_InvalidParamValue_MESSAGE "CTRE CAN Invalid Parameter"
#define CTR_UnexpectedArbId_MESSAGE "CTRE Unexpected Arbitration ID (CAN Node ID)"
#define CTR_TxFailed_MESSAGE "CTRE CAN Transmit Error"
#define CTR_SigNotUpdated_MESSAGE "CTRE CAN Signal Not Updated"
#define NiFpga_Status_FifoTimeout_MESSAGE "NIFPGA: FIFO timeout error"
#define NiFpga_Status_TransferAborted_MESSAGE "NIFPGA: Transfer aborted error"
#define NiFpga_Status_MemoryFull_MESSAGE "NIFPGA: Memory Allocation failed, memory full"
#define NiFpga_Status_SoftwareFault_MESSAGE "NIFPGA: Unexepected software error"
#define NiFpga_Status_InvalidParameter_MESSAGE "NIFPGA: Invalid Parameter"
#define NiFpga_Status_ResourceNotFound_MESSAGE "NIFPGA: Resource not found"
#define NiFpga_Status_ResourceNotInitialized_MESSAGE "NIFPGA: Resource not initialized"
#define NiFpga_Status_HardwareFault_MESSAGE "NIFPGA: Hardware Fault"
#define NiFpga_Status_IrqTimeout_MESSAGE "NIFPGA: Interrupt timeout"
#define ERR_CANSessionMux_InvalidBuffer_MESSAGE "CAN: Invalid Buffer"
#define ERR_CANSessionMux_MessageNotFound_MESSAGE "CAN: Message not found"
#define WARN_CANSessionMux_NoToken_MESSAGE "CAN: No token"
#define ERR_CANSessionMux_NotAllowed_MESSAGE "CAN: Not allowed"
#define ERR_CANSessionMux_NotInitialized_MESSAGE "CAN: Not initialized"
#define SAMPLE_RATE_TOO_HIGH 1001
#define SAMPLE_RATE_TOO_HIGH_MESSAGE "HAL: Analog module sample rate is too high"
#define VOLTAGE_OUT_OF_RANGE 1002
#define VOLTAGE_OUT_OF_RANGE_MESSAGE "HAL: Voltage to convert to raw value is out of range [0; 5]"
#define LOOP_TIMING_ERROR 1004
#define LOOP_TIMING_ERROR_MESSAGE "HAL: Digital module loop timing is not the expected value"
#define SPI_WRITE_NO_MOSI 1012
#define SPI_WRITE_NO_MOSI_MESSAGE "HAL: Cannot write to SPI port with no MOSI output"
#define SPI_READ_NO_MISO 1013
#define SPI_READ_NO_MISO_MESSAGE "HAL: Cannot read from SPI port with no MISO input"
#define SPI_READ_NO_DATA 1014
#define SPI_READ_NO_DATA_MESSAGE "HAL: No data available to read from SPI"
#define INCOMPATIBLE_STATE 1015
#define INCOMPATIBLE_STATE_MESSAGE "HAL: Incompatible State: The operation cannot be completed"
#define NO_AVAILABLE_RESOURCES -1004
#define NO_AVAILABLE_RESOURCES_MESSAGE "HAL: No available resources to allocate"
#define NULL_PARAMETER -1005
#define NULL_PARAMETER_MESSAGE "HAL: A pointer parameter to a method is NULL"
#define ANALOG_TRIGGER_LIMIT_ORDER_ERROR -1010
#define ANALOG_TRIGGER_LIMIT_ORDER_ERROR_MESSAGE "HAL: AnalogTrigger limits error. Lower limit > Upper Limit"
#define ANALOG_TRIGGER_PULSE_OUTPUT_ERROR -1011
#define ANALOG_TRIGGER_PULSE_OUTPUT_ERROR_MESSAGE "HAL: Attempted to read AnalogTrigger pulse output."
#define PARAMETER_OUT_OF_RANGE -1028
#define PARAMETER_OUT_OF_RANGE_MESSAGE "HAL: A parameter is out of range."
#define RESOURCE_IS_ALLOCATED -1029
#define RESOURCE_IS_ALLOCATED_MESSAGE "HAL: Resource already allocated"
#define VI_ERROR_SYSTEM_ERROR_MESSAGE "HAL - VISA: System Error";
#define VI_ERROR_INV_OBJECT_MESSAGE "HAL - VISA: Invalid Object"
#define VI_ERROR_RSRC_LOCKED_MESSAGE "HAL - VISA: Resource Locked"
#define VI_ERROR_RSRC_NFOUND_MESSAGE "HAL - VISA: Resource Not Found"
#define VI_ERROR_INV_RSRC_NAME_MESSAGE "HAL - VISA: Invalid Resource Name"
#define VI_ERROR_QUEUE_OVERFLOW_MESSAGE "HAL - VISA: Queue Overflow"
#define VI_ERROR_IO_MESSAGE "HAL - VISA: General IO Error"
#define VI_ERROR_ASRL_PARITY_MESSAGE "HAL - VISA: Parity Error"
#define VI_ERROR_ASRL_FRAMING_MESSAGE "HAL - VISA: Framing Error"
#define VI_ERROR_ASRL_OVERRUN_MESSAGE "HAL - VISA: Buffer Overrun Error"
#define VI_ERROR_RSRC_BUSY_MESSAGE "HAL - VISA: Resource Busy"
#define VI_ERROR_INV_PARAMETER_MESSAGE "HAL - VISA: Invalid Parameter"

View File

@@ -14,7 +14,6 @@
#include "Accelerometer.hpp"
#include "Analog.hpp"
#include "CAN.hpp"
#include "Compressor.hpp"
#include "Digital.hpp"
#include "Solenoid.hpp"
@@ -23,6 +22,7 @@
#include "Errors.hpp"
#include "PDP.hpp"
#include "Power.hpp"
#include "SerialPort.hpp"
#include "Utilities.hpp"
#include "Semaphore.hpp"
@@ -161,12 +161,36 @@ enum HALAllianceStationID {
kHALAllianceStationID_blue3,
};
/* The maximum number of axes that will be stored in a single HALJoystickAxes
struct. This is used for allocating buffers, not bounds checking, since
there are usually less axes in practice. */
static constexpr size_t kMaxJoystickAxes = 12;
static constexpr size_t kMaxJoystickPOVs = 12;
struct HALJoystickAxes {
uint16_t count;
int16_t axes[6];
int16_t axes[kMaxJoystickAxes];
};
typedef uint32_t HALJoystickButtons;
struct HALJoystickPOVs {
uint16_t count;
int16_t povs[kMaxJoystickPOVs];
};
struct HALJoystickButtons {
uint32_t buttons;
uint8_t count;
};
struct HALJoystickDescriptor {
uint8_t isXbox;
uint8_t type;
char name[256];
uint8_t axisCount;
uint8_t axisTypes;
uint8_t buttonCount;
uint8_t povCount;
};
inline float intToFloat(int value)
{
@@ -199,10 +223,17 @@ extern "C"
int HALGetControlWord(HALControlWord *data);
int HALGetAllianceStation(enum HALAllianceStationID *allianceStation);
int HALGetJoystickAxes(uint8_t joystickNum, HALJoystickAxes *axes, uint8_t maxAxes);
int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons, uint8_t *count);
int HALGetJoystickAxes(uint8_t joystickNum, HALJoystickAxes *axes);
int HALGetJoystickPOVs(uint8_t joystickNum, HALJoystickPOVs *povs);
int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons);
int HALGetJoystickDescriptor(uint8_t joystickNum, HALJoystickDescriptor *desc);
int HALSetJoystickOutputs(uint8_t joystickNum, uint32_t outputs, uint16_t leftRumble, uint16_t rightRumble);
int HALGetMatchTime(float *matchTime);
void HALSetNewDataSem(pthread_mutex_t *);
void HALSetNewDataSem(MULTIWAIT_ID sem);
bool HALGetSystemActive(int32_t *status);
bool HALGetBrownedOut(int32_t *status);
int HALInitialize(int mode = 0);
void HALNetworkCommunicationObserveUserProgramStarting();

View File

@@ -16,10 +16,11 @@ extern "C"
void* initializeInterrupts(uint32_t interruptIndex, bool watcher, int32_t *status);
void cleanInterrupts(void* interrupt_pointer, int32_t *status);
void waitForInterrupt(void* interrupt_pointer, double timeout, int32_t *status);
uint32_t waitForInterrupt(void* interrupt_pointer, double timeout, bool ignorePrevious, int32_t *status);
void enableInterrupts(void* interrupt_pointer, int32_t *status);
void disableInterrupts(void* interrupt_pointer, int32_t *status);
double readInterruptTimestamp(void* interrupt_pointer, int32_t *status);
double readRisingTimestamp(void* interrupt_pointer, int32_t *status);
double readFallingTimestamp(void* interrupt_pointer, int32_t *status);
void requestInterrupts(void* interrupt_pointer, uint8_t routing_module, uint32_t routing_pin,
bool routing_analog_trigger, int32_t *status);
void attachInterruptHandler(void* interrupt_pointer, InterruptHandlerFunction handler,

View File

@@ -11,4 +11,9 @@ extern "C"
double getPDPTemperature(int32_t *status);
double getPDPVoltage(int32_t *status);
double getPDPChannelCurrent(uint8_t channel, int32_t *status);
double getPDPTotalCurrent(int32_t *status);
double getPDPTotalPower(int32_t *status);
double getPDPTotalEnergy(int32_t *status);
void resetPDPTotalEnergy(int32_t *status);
void clearPDPStickyFaults(int32_t *status);
}

View File

@@ -8,8 +8,14 @@ extern "C"
float getVinCurrent(int32_t *status);
float getUserVoltage6V(int32_t *status);
float getUserCurrent6V(int32_t *status);
bool getUserActive6V(int32_t *status);
int getUserCurrentFaults6V(int32_t *status);
float getUserVoltage5V(int32_t *status);
float getUserCurrent5V(int32_t *status);
bool getUserActive5V(int32_t *status);
int getUserCurrentFaults5V(int32_t *status);
float getUserVoltage3V3(int32_t *status);
float getUserCurrent3V3(int32_t *status);
bool getUserActive3V3(int32_t *status);
int getUserCurrentFaults3V3(int32_t *status);
}

View File

@@ -46,7 +46,7 @@ extern "C"
MULTIWAIT_ID initializeMultiWait();
void deleteMultiWait(MULTIWAIT_ID sem);
int8_t takeMultiWait(MULTIWAIT_ID sem, int32_t timeout);
int8_t takeMultiWait(MULTIWAIT_ID sem, MUTEX_ID m, int32_t timeout);
int8_t giveMultiWait(MULTIWAIT_ID sem);
}

View File

@@ -0,0 +1,29 @@
#pragma once
#ifdef __vxworks
#include <vxWorks.h>
#else
#include <stdint.h>
#endif
extern "C"
{
void serialInitializePort(uint8_t port, int32_t *status);
void serialSetBaudRate(uint8_t port, uint32_t baud, int32_t *status);
void serialSetDataBits(uint8_t port, uint8_t bits, int32_t *status);
void serialSetParity(uint8_t port, uint8_t parity, int32_t *status);
void serialSetStopBits(uint8_t port, uint8_t stopBits, int32_t *status);
void serialSetWriteMode(uint8_t port, uint8_t mode, int32_t *status);
void serialSetFlowControl(uint8_t port, uint8_t flow, int32_t *status);
void serialSetTimeout(uint8_t port, float timeout, int32_t *status);
void serialEnableTermination(uint8_t port, char terminator, int32_t *status);
void serialDisableTermination(uint8_t port, int32_t *status);
void serialSetReadBufferSize(uint8_t port, uint32_t size, int32_t *status);
void serialSetWriteBufferSize(uint8_t port, uint32_t size, int32_t *status);
int32_t serialGetBytesReceived(uint8_t port, int32_t *status);
uint32_t serialRead(uint8_t port, char* buffer, int32_t count, int32_t *status);
uint32_t serialWrite(uint8_t port, const char *buffer, int32_t count, int32_t *status);
void serialFlush(uint8_t port, int32_t *status);
void serialClear(uint8_t port, int32_t *status);
void serialClose(uint8_t port, int32_t *status);
}

View File

@@ -1,232 +0,0 @@
#include "HAL/CAN.hpp"
#include <map>
struct CANMessage
{
uint8_t data[8];
};
static std::map<uint32_t, CANMessage> outgoingMessages;
static std::map<uint32_t, CANMessage> incomingMessages;
static const uint32_t kFullMessageIDMask = 0x1fffffff;
/**
* Gets the data from the outgoing hashmap and calls
* CANSessionMux...sendMessage.
*/
void canTxSend(uint32_t arbID, uint8_t length, int32_t period)
{
CANMessage &message = outgoingMessages[arbID];
int32_t status;
FRC_NetworkCommunication_CANSessionMux_sendMessage(
arbID, message.data, length, period, &status);
}
/**
* Updates a field in the outgoing hashmap.
*
* This is called every time an single byte field changes in a message.data,
* such as when a setter on a CAN device is called.
*/
void canTxPackInt8(uint32_t arbID, uint8_t offset, uint8_t value)
{
CANMessage &message = outgoingMessages[arbID];
message.data[offset] = value;
}
/**
* Updates a field in the outgoing hashmap.
*
* This is called every time a short integer field changes in a message.data,
* such as when a setter on a CAN device is called.
*/
void canTxPackInt16(uint32_t arbID, uint8_t offset, uint16_t value)
{
CANMessage &message = outgoingMessages[arbID];
*(uint16_t *)(message.data + offset) = value;
}
/**
* Updates a field in the outgoing hashmap.
*
* This is called every time a long integer field changes in a message.data,
* such as when a setter on a CAN device is called.
*/
void canTxPackInt32(uint32_t arbID, uint8_t offset, uint32_t value)
{
CANMessage &message = outgoingMessages[arbID];
*(uint32_t *)(message.data + offset) = value;
}
/**
* Updates a field in the outgoing hashmap.
*
* This is called every time an 8.8 fixed point field changes in a message,
* such as when a setter on a CAN device is called.
*/
void canTxPackFXP16(uint32_t arbID, uint8_t offset, double value)
{
int16_t raw = value * 255.0;
canTxPackInt16(arbID, offset, raw);
}
/**
* Updates a field in the outgoing hashmap.
*
* This is called every time a 16.16 fixed point field changes in a message,
* such as when a setter on a CAN device is called.
*/
void canTxPackFXP32(uint32_t arbID, uint8_t offset, double value)
{
int32_t raw = value * 65535.0;
canTxPackInt32(arbID, offset, raw);
}
/**
* Unpack a field from the outgoing hashmap.
*
* This is called in getters for configuration data.
*/
uint8_t canTxUnpackInt8(uint32_t arbID, uint8_t offset)
{
CANMessage &message = outgoingMessages[arbID];
return message.data[offset];
}
/**
* Unpack a field from the outgoing hashmap.
*
* This is called in getters for configuration data.
*/
uint16_t canTxUnpackInt16(uint32_t arbID, uint8_t offset)
{
CANMessage &message = outgoingMessages[arbID];
return *reinterpret_cast<uint16_t *>(message.data + offset);
}
/**
* Unpack a field from the outgoing hashmap.
*
* This is called in getters for configuration data.
*/
uint32_t canTxUnpackInt32(uint32_t arbID, uint8_t offset)
{
CANMessage &message = outgoingMessages[arbID];
return *reinterpret_cast<uint32_t *>(message.data + offset);
}
/**
* Unpack a field from the outgoing hashmap.
*
* This is called in getters for configuration data.
*/
double canTxUnpackFXP16(uint32_t arbID, uint8_t offset)
{
int16_t raw = canTxUnpackInt16(arbID, offset);
return raw / 255.0;
}
/**
* Unpack a field from the outgoing hashmap.
*
* This is called in getters for configuration data.
*/
double canTxUnpackFXP32(uint32_t arbID, uint8_t offset)
{
int32_t raw = canTxUnpackInt32(arbID, offset);
return raw / 65535.0;
}
/**
* Get data from CANSessionMux (if it's available) and put it in the incoming
* hashmap.
*
* @return true if there's new data. Otherwise, the last received value should
* still be in the hashmap.
*/
bool canRxReceive(uint32_t arbID)
{
CANMessage &message = incomingMessages[arbID];
uint8_t length;
uint32_t timestamp;
int32_t status;
FRC_NetworkCommunication_CANSessionMux_receiveMessage(
&arbID, kFullMessageIDMask, message.data, &length, &timestamp, &status);
return status != ERR_CANSessionMux_MessageNotFound;
}
/**
* Unpack a field from the incoming hashmap.
*
* This is called in getters for status data.
*/
uint8_t canRxUnpackInt8(uint32_t arbID, uint8_t offset)
{
CANMessage &message = incomingMessages[arbID];
return message.data[offset];
}
/**
* Unpack a field from the incoming hashmap.
*
* This is called in getters for status data.
*/
uint16_t canRxUnpackInt16(uint32_t arbID, uint8_t offset)
{
CANMessage &message = incomingMessages[arbID];
return *reinterpret_cast<uint16_t *>(message.data + offset);
}
/**
* Unpack a field from the incoming hashmap.
*
* This is called in getters for status data.
*/
uint32_t canRxUnpackInt32(uint32_t arbID, uint8_t offset)
{
CANMessage &message = incomingMessages[arbID];
return *reinterpret_cast<uint32_t *>(message.data + offset);
}
/**
* Unpack a field from the incoming hashmap.
*
* This is called in getters for status data.
*/
double canRxUnpackFXP16(uint32_t arbID, uint8_t offset)
{
int16_t raw = canRxUnpackInt16(arbID, offset);
return raw / 255.0;
}
/**
* Unpack a field from the incoming hashmap.
*
* This is called in getters for status data.
*/
double canRxUnpackFXP32(uint32_t arbID, uint8_t offset)
{
int32_t raw = canRxUnpackInt32(arbID, offset);
return raw / 65535.0;
}

View File

@@ -11,6 +11,7 @@
#include <stdint.h>
#include "FRC_FPGA_ChipObject/RoboRIO_FRC_ChipObject_Aliases.h"
#include "FRC_FPGA_ChipObject/tDMAChannelDescriptor.h"
#include "FRC_FPGA_ChipObject/tDMAManager.h"
#include "FRC_FPGA_ChipObject/tInterruptManager.h"
#include "FRC_FPGA_ChipObject/tSystem.h"

Some files were not shown because too many files have changed in this diff Show More