Compare commits

...

83 Commits

Author SHA1 Message Date
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
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
150 changed files with 1682 additions and 543 deletions

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

View File

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

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,188 @@
<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>
</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>
<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>
</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

@@ -98,18 +98,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);

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;
@@ -79,8 +81,14 @@ public class ProjectCreationUtils {
} catch (CoreException e) {
WPILibCore.logError("Can't create new project.", e);
}
}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

@@ -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

@@ -15,6 +15,11 @@ private:
autonomousCommand = new ExampleCommand();
lw = LiveWindow::GetInstance();
}
void DisabledPeriodic()
{
Scheduler::GetInstance()->Run();
}
void AutonomousInit()
{

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())
{
// 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,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())
{
// 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

@@ -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()) {
// 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()) {
// 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

@@ -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())
{
// 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())
{
// 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,107 @@
<description>Example programs that demonstrate the use of the various commonly used sensors on FRC robots</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>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>

View File

@@ -41,7 +41,7 @@ public class ExampleCPPWizard extends ExampleWizard {
protected IWizardPage getDetailsPage() {
if (detailsPage != null) return detailsPage;
detailsPage = new NewProjectMainPage(selection, getTeamNumberPage());
detailsPage.setTitle("Create Example Robot Java Project");
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;

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,6 +31,10 @@ 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)

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

@@ -1,5 +1,4 @@
package org.usfirst.frc.team190.robot;
package $package;
import edu.wpi.first.wpilibj.Joystick;

View File

@@ -1,5 +1,4 @@
package org.usfirst.frc.team190.robot;
package $package;
import edu.wpi.first.wpilibj.Joystick;

View File

@@ -1,26 +1,47 @@
#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 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."

View File

@@ -161,9 +161,20 @@ 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];
};
struct HALJoystickPOVs {
uint16_t count;
int16_t povs[kMaxJoystickPOVs];
};
typedef uint32_t HALJoystickButtons;
@@ -199,7 +210,8 @@ extern "C"
int HALGetControlWord(HALControlWord *data);
int HALGetAllianceStation(enum HALAllianceStationID *allianceStation);
int HALGetJoystickAxes(uint8_t joystickNum, HALJoystickAxes *axes, uint8_t maxAxes);
int HALGetJoystickAxes(uint8_t joystickNum, HALJoystickAxes *axes);
int HALGetJoystickPOVs(uint8_t joystickNum, HALJoystickPOVs *povs);
int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons, uint8_t *count);
void HALSetNewDataSem(pthread_mutex_t *);

View File

@@ -256,7 +256,7 @@ void* allocatePWM(int32_t *status) {
* @param pwmGenerator The pwmGen to free that was allocated with AllocateDO_PWM()
*/
void freePWM(void* pwmGenerator, int32_t *status) {
uint32_t id = *((uint32_t*) pwmGenerator);
uint32_t id = (uint32_t) pwmGenerator;
if (id == ~0ul) return;
DO_PWMGenerators->Free(id);
}
@@ -283,7 +283,7 @@ void setPWMRate(double rate, int32_t *status) {
* @param dutyCycle The percent duty cycle to output [0..1].
*/
void setPWMDutyCycle(void* pwmGenerator, double dutyCycle, int32_t *status) {
uint32_t id = *((uint32_t*) pwmGenerator);
uint32_t id = (uint32_t) pwmGenerator;
if (id == ~0ul) return;
if (dutyCycle > 1.0) dutyCycle = 1.0;
if (dutyCycle < 0.0) dutyCycle = 0.0;
@@ -296,8 +296,10 @@ void setPWMDutyCycle(void* pwmGenerator, double dutyCycle, int32_t *status) {
// The resolution of the duty cycle drops close to the highest frequencies.
rawDutyCycle = rawDutyCycle / pow(2.0, 4 - pwmPeriodPower);
}
digitalSystem->writePWMDutyCycleA(id, (uint8_t)rawDutyCycle, status);
digitalSystem->writePWMDutyCycleB(id, (uint8_t)rawDutyCycle, status);
if(id < 4)
digitalSystem->writePWMDutyCycleA(id, (uint8_t)rawDutyCycle, status);
else
digitalSystem->writePWMDutyCycleB(id - 3, (uint8_t)rawDutyCycle, status);
}
}
@@ -308,28 +310,9 @@ void setPWMDutyCycle(void* pwmGenerator, double dutyCycle, int32_t *status) {
* @param channel The Digital Output channel to output on
*/
void setPWMOutputChannel(void* pwmGenerator, uint32_t pin, int32_t *status) {
uint32_t id = *((uint32_t*) pwmGenerator);
if (id == ~0ul) return;
switch(id) {
case 0:
digitalSystem->writePWMOutputSelect(0, pin, status);
break;
case 1:
digitalSystem->writePWMOutputSelect(1, pin, status);
break;
case 2:
digitalSystem->writePWMOutputSelect(2, pin, status);
break;
case 3:
digitalSystem->writePWMOutputSelect(3, pin, status);
break;
case 4:
digitalSystem->writePWMOutputSelect(4, pin, status);
break;
case 5:
digitalSystem->writePWMOutputSelect(5, pin, status);
break;
}
uint32_t id = (uint32_t) pwmGenerator;
if (id > 5) return;
digitalSystem->writePWMOutputSelect(id, pin, status);
}
/**

View File

@@ -32,7 +32,7 @@ public:
void enable(tRioStatusCode *status);
void disable(tRioStatusCode *status);
bool isEnabled(tRioStatusCode *status);
public:
private:
class tInterruptThread;
friend class tInterruptThread;
void handler();
@@ -58,3 +58,4 @@ public:
#endif // __tInterruptManager_h__

View File

@@ -2,6 +2,7 @@
#include "Port.h"
#include "HAL/Errors.hpp"
#include "ctre/ctre.h"
#include "ChipObject.h"
#include "NetworkCommunication/FRCComm.h"
#include "NetworkCommunication/UsageReporting.h"
@@ -38,34 +39,72 @@ void* getPortWithModule(uint8_t module, uint8_t pin)
const char* getHALErrorMessage(int32_t code)
{
if (code == 0)
return "";
else if (code == SAMPLE_RATE_TOO_HIGH)
return SAMPLE_RATE_TOO_HIGH_MESSAGE;
else if (code == VOLTAGE_OUT_OF_RANGE)
return VOLTAGE_OUT_OF_RANGE_MESSAGE;
else if (code == LOOP_TIMING_ERROR)
return LOOP_TIMING_ERROR_MESSAGE;
else if (code == SPI_WRITE_NO_MOSI)
return SPI_WRITE_NO_MOSI_MESSAGE;
else if (code == SPI_READ_NO_MISO)
return SPI_READ_NO_MISO_MESSAGE;
else if (code == SPI_READ_NO_DATA)
return SPI_READ_NO_DATA_MESSAGE;
else if (code == INCOMPATIBLE_STATE)
return INCOMPATIBLE_STATE_MESSAGE;
else if (code == NO_AVAILABLE_RESOURCES)
return NO_AVAILABLE_RESOURCES_MESSAGE;
else if (code == NULL_PARAMETER)
return NULL_PARAMETER_MESSAGE;
else if (code == ANALOG_TRIGGER_LIMIT_ORDER_ERROR)
return ANALOG_TRIGGER_LIMIT_ORDER_ERROR_MESSAGE;
else if (code == ANALOG_TRIGGER_PULSE_OUTPUT_ERROR)
return ANALOG_TRIGGER_PULSE_OUTPUT_ERROR_MESSAGE;
else if (code == PARAMETER_OUT_OF_RANGE)
return PARAMETER_OUT_OF_RANGE_MESSAGE;
else
return "";
switch(code) {
case 0:
return "";
case CTR_RxTimeout:
return CTR_RxTimeout_MESSAGE;
case CTR_TxTimeout:
return CTR_TxTimeout_MESSAGE;
case CTR_InvalidParamValue:
return CTR_InvalidParamValue_MESSAGE;
case CTR_UnexpectedArbId:
return CTR_UnexpectedArbId_MESSAGE;
case NiFpga_Status_FifoTimeout:
return NiFpga_Status_FifoTimeout_MESSAGE;
case NiFpga_Status_TransferAborted:
return NiFpga_Status_TransferAborted_MESSAGE;
case NiFpga_Status_MemoryFull:
return NiFpga_Status_MemoryFull_MESSAGE;
case NiFpga_Status_SoftwareFault:
return NiFpga_Status_SoftwareFault_MESSAGE;
case NiFpga_Status_InvalidParameter:
return NiFpga_Status_InvalidParameter_MESSAGE;
case NiFpga_Status_ResourceNotFound:
return NiFpga_Status_ResourceNotFound_MESSAGE;
case NiFpga_Status_ResourceNotInitialized:
return NiFpga_Status_ResourceNotInitialized_MESSAGE;
case NiFpga_Status_HardwareFault:
return NiFpga_Status_HardwareFault_MESSAGE;
case NiFpga_Status_IrqTimeout:
return NiFpga_Status_IrqTimeout_MESSAGE;
case SAMPLE_RATE_TOO_HIGH:
return SAMPLE_RATE_TOO_HIGH_MESSAGE;
case VOLTAGE_OUT_OF_RANGE:
return VOLTAGE_OUT_OF_RANGE_MESSAGE;
case LOOP_TIMING_ERROR:
return LOOP_TIMING_ERROR_MESSAGE;
case SPI_WRITE_NO_MOSI:
return SPI_WRITE_NO_MOSI_MESSAGE;
case SPI_READ_NO_MISO:
return SPI_READ_NO_MISO_MESSAGE;
case SPI_READ_NO_DATA:
return SPI_READ_NO_DATA_MESSAGE;
case INCOMPATIBLE_STATE:
return INCOMPATIBLE_STATE_MESSAGE;
case NO_AVAILABLE_RESOURCES:
return NO_AVAILABLE_RESOURCES_MESSAGE;
case NULL_PARAMETER:
return NULL_PARAMETER_MESSAGE;
case ANALOG_TRIGGER_LIMIT_ORDER_ERROR:
return ANALOG_TRIGGER_LIMIT_ORDER_ERROR_MESSAGE;
case ANALOG_TRIGGER_PULSE_OUTPUT_ERROR:
return ANALOG_TRIGGER_PULSE_OUTPUT_ERROR_MESSAGE;
case PARAMETER_OUT_OF_RANGE:
return PARAMETER_OUT_OF_RANGE_MESSAGE;
case ERR_CANSessionMux_InvalidBuffer:
return ERR_CANSessionMux_InvalidBuffer_MESSAGE;
case ERR_CANSessionMux_MessageNotFound:
return ERR_CANSessionMux_MessageNotFound_MESSAGE;
case WARN_CANSessionMux_NoToken:
return WARN_CANSessionMux_NoToken_MESSAGE;
case ERR_CANSessionMux_NotAllowed:
return ERR_CANSessionMux_NotAllowed_MESSAGE;
case ERR_CANSessionMux_NotInitialized:
return ERR_CANSessionMux_NotInitialized_MESSAGE;
default:
return "Unknown error status";
}
}
/**
@@ -125,9 +164,14 @@ int HALGetAllianceStation(enum HALAllianceStationID *allianceStation)
return FRC_NetworkCommunication_getAllianceStation((AllianceStationID_t*) allianceStation);
}
int HALGetJoystickAxes(uint8_t joystickNum, HALJoystickAxes *axes, uint8_t maxAxes)
int HALGetJoystickAxes(uint8_t joystickNum, HALJoystickAxes *axes)
{
return FRC_NetworkCommunication_getJoystickAxes(joystickNum, (JoystickAxes_t*) axes, maxAxes);
return FRC_NetworkCommunication_getJoystickAxes(joystickNum, (JoystickAxes_t*) axes, kMaxJoystickAxes);
}
int HALGetJoystickPOVs(uint8_t joystickNum, HALJoystickPOVs *povs)
{
return FRC_NetworkCommunication_getJoystickPOVs(joystickNum, (JoystickPOV_t*) povs, kMaxJoystickPOVs);
}
int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons, uint8_t *count)

View File

@@ -9,7 +9,12 @@ void delayTicks(int32_t ticks)
struct timespec test, remaining;
test.tv_sec = 0;
test.tv_nsec = ticks * 3;
nanosleep(&test, &remaining);
/* Sleep until the requested number of ticks has passed, with additional
time added if nanosleep is interrupted. */
while(nanosleep(&test, &remaining) == -1) {
test = remaining;
}
}
void delayMillis(double ms)
@@ -17,7 +22,12 @@ void delayMillis(double ms)
struct timespec test, remaining;
test.tv_sec = ms / 1000;
test.tv_nsec = 1000 * (((uint64_t)ms) % 1000000);
nanosleep(&test, &remaining);
/* Sleep until the requested number of milliseconds has passed, with
additional time added if nanosleep is interrupted. */
while(nanosleep(&test, &remaining) == -1) {
test = remaining;
}
}
void delaySeconds(double s)
@@ -25,5 +35,10 @@ void delaySeconds(double s)
struct timespec test, remaining;
test.tv_sec = (int)s;
test.tv_nsec = (s - (int)s) * 1000000000.0;
nanosleep(&test, &remaining);
/* Sleep until the requested number of seconds has passed, with additional
time added if nanosleep is interrupted. */
while(nanosleep(&test, &remaining) == -1) {
test = remaining;
}
}

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>
<groupId>edu.wpi.first.wpilib.networktables.java</groupId>
<artifactId>NetworkTables</artifactId>
@@ -38,11 +38,19 @@
<profile>
<id>docline-java8-disable</id>
<activation>
<jdk>[1.8,</jdk>
<jdk>[1.8,</jdk>
</activation>
<distributionManagement>
<repository>
<id>filesystem.repo</id>
<name>Temporary Staging Repository</name>
<url>file://${user.home}/releases/maven</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
@@ -50,7 +58,7 @@
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
</plugins>
</plugins>
</build>
</profile>
</profiles>
@@ -63,9 +71,9 @@
<configuration>
<source>1.6</source>
<target>1.6</target>
<testExcludes>
<exclude>edu/wpi/first/wpilibj/networktables2/system/SystemTest.java</exclude>
</testExcludes>
<testExcludes>
<exclude>edu/wpi/first/wpilibj/networktables2/system/SystemTest.java</exclude>
</testExcludes>
</configuration>
</plugin>
<plugin>
@@ -92,8 +100,8 @@
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>

View File

@@ -1,25 +1,90 @@
<?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>
<groupId>edu.wpi.first.wpilib.networktables</groupId>
<artifactId>java</artifactId>
<packaging>pom</packaging>
<version>0.1.0-SNAPSHOT</version>
<modules>
<module>Athena</module>
</modules>
<groupId>edu.wpi.first.wpilib.networktables.java</groupId>
<artifactId>NetworkTables</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>edu.wpi.first.wpilib.templates.athena</groupId>
<artifactId>library-jar</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>../../maven-utilities/athena/library-jar</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock-junit4</artifactId>
<version>2.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock-legacy</artifactId>
<version>2.6.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>filesystem.repo</id>
<name>Temporary Staging Repository</name>
<url>file://${user.home}/releases/maven</url>
</repository>
</distributionManagement>
<profiles>
<profile>
<id>desktop</id>
<id>docline-java8-disable</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>[1.8,</jdk>
</activation>
<modules>
<module>Athena</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<testExcludes>
<exclude>edu/wpi/first/wpilibj/networktables2/system/SystemTest.java</exclude>
</testExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -19,9 +19,9 @@ public class SocketTest {
}};
@Test(timeout=1000)
@Test(timeout=1500)
public void testSingleSocketConnection() throws Throwable {
doSocketTest(1, 500, 1000, SocketStreams.newStreamProvider(10111), SocketStreams.newStreamFactory("localhost", 10111));
doSocketTest(1, 500, 1500, SocketStreams.newStreamProvider(10111), SocketStreams.newStreamFactory("localhost", 10111));
}
@Test(timeout=2500)
public void testManySocketConnection() throws Throwable {

View File

@@ -10,7 +10,7 @@ import org.junit.*;
public class DefaultThreadManagerTest {
volatile Throwable exception = null;
@Test(timeout=300)
@Test(timeout=400)
public void testConcurrentThreads() throws Throwable {
final int numCounts = 10;
final int numThreads = 10;

View File

@@ -0,0 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libni_emb.so.7 )

View File

@@ -0,0 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libni_emb.so.7.0 )

View File

@@ -0,0 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libni_emb.so.7.0.0 )

Binary file not shown.

View File

@@ -0,0 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libni_rtlog.so.2 )

View File

@@ -0,0 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libni_rtlog.so.2.3 )

View File

@@ -0,0 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libni_rtlog.so.2.3.0 )

Binary file not shown.

View File

@@ -0,0 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libnirio_emb_can.so.14 )

View File

@@ -0,0 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libnirio_emb_can.so.14.0 )

View File

@@ -0,0 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libnirio_emb_can.so.14.0.0 )

Binary file not shown.

BIN
ni-libraries/libvisa.so Normal file

Binary file not shown.

View File

@@ -17,11 +17,12 @@ DEFAULT_DESTINATION_CPP_TEST_FILE=${DEFAULT_TEST_SCP_DIR}/${DEFAULT_CPP_TEST_NAM
DEFAULT_DESTINATION_RUN_TEST_SCRIPT=${DEFAULT_DESTINATION_DIR}/${DEFAULT_LOCAL_RUN_TEST_SCRIPT}
usage="$(basename "$0") [-h] (java|cpp) [-A] [arg] [arg]...
usage="$(basename "$0") [-h] (java|cpp) [-m] [-A] [arg] [arg]...
A script designed to run the integration tests.
This script should only be run on the roborio.
Where:
-h Show this help text.
-m The driver station mutex will be handled manually.
-A Disable language recomended arguments.
arg Additional arguments to be passed to test."
@@ -60,14 +61,20 @@ if [[ ! -e ${LOCAL_TEST_FILE} ]]; then
exit 1
fi
TEST_RUN_ARGS="${@:2}"
MUTEX_OVERRIDE_PARAM_TEXT=""
if [[ "$2" = "-m" ]]; then
MUTEX_OVERRIDE_PARAM_TEXT="-m "
TEST_RUN_ARGS="${@:3}"
else
TEST_RUN_ARGS="${@:2}"
fi
shopt -s huponexit
SCP_TEST_SCRIPT="scp config.sh ${DEFAULT_LOCAL_RUN_TEST_SCRIPT} ${ROBOT_ADDRESS}:/${DEFAULT_DESTINATION_DIR}"
SSH_CHMOD_AND_MAKE_TEMP_TEST_DIR="ssh -t ${ROBOT_ADDRESS} chmod a+x ${DEFAULT_DESTINATION_RUN_TEST_SCRIPT}; mkdir ${DEFAULT_TEST_SCP_DIR} 2>/dev/null"
SCP_TEST_PROGRAM="scp ${LOCAL_TEST_FILE} ${ROBOT_ADDRESS}:/${DESTINATION_TEST_FILE}"
SSH_RUN_TESTS="ssh -t ${ROBOT_ADDRESS} ${DEFAULT_DESTINATION_RUN_TEST_SCRIPT} ${LANGUAGE} $(whoami) -d ${DEFAULT_TEST_SCP_DIR} ${TEST_RUN_ARGS}"
SSH_RUN_TESTS="ssh -t ${ROBOT_ADDRESS} ${DEFAULT_DESTINATION_RUN_TEST_SCRIPT} ${LANGUAGE} $(whoami) ${MUTEX_OVERRIDE_PARAM_TEXT}-d ${DEFAULT_TEST_SCP_DIR} ${TEST_RUN_ARGS}"
if [ $(which sshpass) ]; then
sshpass -p "" ${SCP_TEST_SCRIPT}

View File

@@ -9,6 +9,34 @@
# Configurable variables
source config.sh
# Setup the mutex release before we grab it
mutexTaken=false
# This function should run even if the script exits abnormally
function finish {
if [ "$mutexTaken" == true ]; then
SSH_GIVE_MUTEX="ssh -t ${ROBOT_ADDRESS} /usr/local/frc/bin/teststand give --name=$(whoami)"
if [ $(which sshpass) ]; then
sshpass -p "" ${SSH_GIVE_MUTEX}
else
printf "WARNING!!! THIS IS HOW THE MUTEX IS RELEASED!\nIF YOU CHOOSE TO 'ctr+c' NOW YOU WILL HAVE TO HAND BACK THE MUTEX MANUALLY ON THE ROBOT.\n"
eval ${SSH_GIVE_MUTEX}
fi
mutexTaken=false
fi
}
trap finish EXIT SIGINT
# Take the mutex from the driver station
mutexTaken=true
SSH_TAKE_MUTEX="ssh -t ${ROBOT_ADDRESS} /usr/local/frc/bin/teststand take --name=$(whoami)"
if [ $(which sshpass) ]; then
sshpass -p "" ${SSH_TAKE_MUTEX}
else
eval ${SSH_TAKE_MUTEX}
fi
# If there are already test results in the repository then remove them
if [[ -e ${DEFAULT_LOCAL_TEST_RESULTS_DIR} ]]; then
rm -R ${DEFAULT_LOCAL_TEST_RESULTS_DIR}
@@ -28,7 +56,7 @@ fi
printf "Running cpp test\n"
# Run the C++ Tests
./deploy-and-run-test-on-robot.sh cpp -A "--gtest_output=xml:${DEFAULT_DESTINATION_CPP_TEST_RESULTS}"
./deploy-and-run-test-on-robot.sh cpp -m -A "--gtest_output=xml:${DEFAULT_DESTINATION_CPP_TEST_RESULTS}"
# Retrive the C++ Test Results
SCP_GET_CPP_TEST_RESULT="scp ${ROBOT_ADDRESS}:${DEFAULT_DESTINATION_CPP_TEST_RESULTS} ${DEFAULT_LOCAL_CPP_TEST_RESULT}"
@@ -39,7 +67,7 @@ else
fi
# Run the Java Tests
./deploy-and-run-test-on-robot.sh java
./deploy-and-run-test-on-robot.sh java -m
# Retrive the Java Test Results
SCP_GET_JAVA_TEST_RESULT="scp ${ROBOT_ADDRESS}:${DEFAULT_DESTINATION_JAVA_TEST_RESULTS} ${DEFAULT_LOCAL_JAVA_TEST_RESULT}"
@@ -48,3 +76,5 @@ if [ $(which sshpass) ]; then
else
eval ${SCP_GET_JAVA_TEST_RESULT}
fi
# The mutex is released when this program exits

View File

@@ -17,7 +17,7 @@ source config.sh
DEFAULT_TEST_DIR=${DEFAULT_DESTINATION_DIR}
DEFAULT_PATH_TO_JRE=/usr/local/frc/JRE/bin/java
usage="$(basename "$0") [-h] (java|cpp) name [-d test_dir] [-A] [arg] [arg]...
usage="$(basename "$0") [-h] (java|cpp) name [-d test_dir] [-m] [-A] [arg] [arg]...
A script designed to run the integration tests.
This script should only be run on the roborio.
Where:
@@ -29,14 +29,19 @@ Where:
This scrip will automatically move the test into the ${DEFAULT_TEST_DIR}
directory when the driver station mutex is released.
Default: Assumes the test is in the same directory as this scrip.
-m The driver station mutex will be handled manually.
-A Do not use the default arguments for the given language.
arg The arguments to be passed to test."
mutexTaken=false
driverStationEnabled=false
# This function should run even if the script exits abnormally
function finish {
if [ "$mutexTaken" == true ]; then
if [ "$driverStationEnabled" == true ]; then
/usr/local/frc/bin/teststand ds --name="${NAME}" disable
driverStationEnabled=false
fi
if [ "$mutexTaken" == true ]; then
/usr/local/frc/bin/teststand give --name="${NAME}"
mutexTaken=false
fi
@@ -46,6 +51,8 @@ trap finish EXIT SIGINT
# This function should be run asynchronysly to enable the tests 10
# seconds after they have been run.
function enableIn10Seconds {
/usr/local/frc/bin/teststand ds --name="${NAME}" disable
driverStationEnabled=true
sleep 10
/usr/local/frc/bin/teststand ds --name="${NAME}" enable
}
@@ -68,6 +75,7 @@ PARAM_ARGS=${@:3}
TEST_RUN_ARGS=${@:3}
RUN_WITH_DEFAULT_ARGS=true
DEFAULT_ARGS=""
MUTEX_OVERRIDE=false
# Determine the language that we are attempting to run
if [[ "$1" = java ]]; then
@@ -92,7 +100,7 @@ PARAM_COUNTER=2
printf "Param Args ${PARAM_ARGS}\n"
# Check for optional paramaters
while getopts ':hd:A' option $PARAM_ARGS ; do
while getopts ':hmd:A' option $PARAM_ARGS ; do
case "$option" in
h)
# Print the help message
@@ -105,6 +113,10 @@ while getopts ':hd:A' option $PARAM_ARGS ; do
RUN_WITH_DEFAULT_ARGS=false
PARAM_COUNTER=$[$PARAM_COUNTER +1]
;;
m)
MUTEX_OVERRIDE=true
PARAM_COUNTER=$[$PARAM_COUNTER +1]
;;
d)
TEST_DIR=$OPTARG
# Since we are selecting the directory the run args start from the 5th argument
@@ -130,9 +142,14 @@ if [[ $# -lt $PARAM_COUNTER ]]; then
exit 1
fi
# Attempt to take the mutex for the driver station
mutexTaken=true
/usr/local/frc/bin/teststand take --name="${NAME}"
# If the mutex has been retrived a higher level in the tree
if [ "$MUTEX_OVERRIDE" == false ]; then
# Attempt to take the mutex for the driver station
mutexTaken=true
/usr/local/frc/bin/teststand take --name="${NAME}"
else
printf "Override driver station control enabled.\n"
fi
# Kill all running robot programs
killall java FRCUserProgram

View File

@@ -8,7 +8,7 @@
source config.sh
TESTSTAND_SERVE_COMMAND=".scratch/teststand serve"
TESTSTAND_SERVE_COMMAND="/usr/local/frc/bin/teststand serve"
#Checks to see if the mutex driver station is running. If it isn't then start it.

View File

@@ -29,7 +29,7 @@ public:
const char *GetFunction() const;
uint32_t GetLineNumber() const;
const ErrorBase* GetOriginatingObject() const;
double GetTime() const;
double GetTimestamp() const;
void Clear();
void Set(Code code, const char* contextMessage, const char* filename, const char *function,
uint32_t lineNumber, const ErrorBase* originatingObject);

View File

@@ -33,4 +33,6 @@ public:
virtual bool GetTop(JoystickHand hand = kRightHand) = 0;
virtual bool GetBumper(JoystickHand hand = kRightHand) = 0;
virtual bool GetRawButton(uint32_t button) = 0;
virtual int GetPOV(uint32_t pov = 0) = 0;
};

View File

@@ -26,13 +26,16 @@ public:
static void PutBoolean(std::string keyName, bool value);
static bool GetBoolean(std::string keyName);
static bool GetBoolean(std::string keyName, bool defaultValue);
static void PutNumber(std::string keyName, double value);
static double GetNumber(std::string keyName);
static double GetNumber(std::string keyName, double defaultValue);
static void PutString(std::string keyName, std::string value);
static int GetString(std::string keyName, char *value, unsigned int valueLen);
static std::string GetString(std::string keyName);
static std::string GetString(std::string keyName, std::string defaultValue);
static void PutValue(std::string keyName, ComplexData& value);
static void RetrieveValue(std::string keyName, ComplexData& value);

View File

@@ -35,6 +35,9 @@ public:
static double GetFPGATimestamp();
static double GetPPCTimestamp();
static double GetMatchTime();
// The time, in seconds, at which the 32-bit FPGA timestamp rolls over to 0
static constexpr double kRolloverTime = (1ll << 32) / 1e6;
private:
double m_startTime;

View File

@@ -65,8 +65,8 @@ S(CompressorTaskError, 3, "Compressor task won't start");
S(LoopTimingError, 4, "Digital module loop timing is not the expected value");
S(NonBinaryDigitalValue, 5, "Digital output value is not 0 or 1");
S(IncorrectBatteryChannel, 6, "Battery measurement channel is not correct value");
S(BadJoystickIndex, 7, "Joystick index is out of range, should be 1-4");
S(BadJoystickAxis, 8, "Joystick axis is out of range");
S(BadJoystickIndex, 7, "Joystick index is out of range, should be 0-3");
S(BadJoystickAxis, 8, "Joystick axis or POV is out of range");
S(InvalidMotorIndex, 9, "Motor index is out of range, should be 0-3");
S(DriverStationTaskError, 10, "Driver Station task won't start");
S(EnhancedIOPWMPeriodOutOfRange, 11, "Driver Station Enhanced IO PWM Output period out of range.");

View File

@@ -8,13 +8,12 @@
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <stdint.h>
#include "HAL/Task.hpp"
//#include "NetworkCommunication/FRCComm.h"
#include "DriverStation.h"
#include "Timer.h"
#include "Utility.h"
bool Error::m_suspendOnErrorEnabled = false;
@@ -58,20 +57,30 @@ uint32_t Error::GetLineNumber() const
const ErrorBase* Error::GetOriginatingObject() const
{ return m_originatingObject; }
double Error::GetTime() const
double Error::GetTimestamp() const
{ return m_timestamp; }
void Error::Set(Code code, const char* contextMessage, const char* filename, const char* function, uint32_t lineNumber, const ErrorBase* originatingObject)
{
bool report = true;
if(code == m_code && GetTime() - m_timestamp < 1)
{
report = false;
}
m_code = code;
m_message = contextMessage;
m_filename = filename;
m_function = function;
m_lineNumber = lineNumber;
m_originatingObject = originatingObject;
m_timestamp = GetTime();
Report();
if(report)
{
m_timestamp = GetTime();
Report();
}
if (m_suspendOnErrorEnabled) suspendTask(0);
}
@@ -87,9 +96,7 @@ void Error::Report()
std::string error = errorStream.str();
// Print the error and send it to the DriverStation
std::cout << error << std::endl;
// TODO: Better logging HALSetErrorData(error.c_str(), error.size(), 100);
DriverStation::ReportError(error);
}
void Error::Clear()

View File

@@ -110,7 +110,7 @@ void SmartDashboard::PutBoolean(std::string keyName, bool value)
}
/**
* Returns the value at the specified key.
* Returns the value at the specified key. Throws an exception if the key is not found in the table
* @param keyName the key
* @return the value
*/
@@ -119,6 +119,16 @@ bool SmartDashboard::GetBoolean(std::string keyName)
return m_table->GetBoolean(keyName);
}
/**
* Returns the value at the specified key. If the key is not found, returns the default value.
* @param keyName the key
* @return the value
*/
bool SmartDashboard::GetBoolean(std::string keyName, bool defaultValue)
{
return m_table->GetBoolean(keyName, defaultValue);
}
/**
* Maps the specified key to the specified value in this table.
* The key can not be NULL.
@@ -131,7 +141,7 @@ void SmartDashboard::PutNumber(std::string keyName, double value){
}
/**
* Returns the value at the specified key.
* Returns the value at the specified key. Throws an exception if the key is not found in the table.
* @param keyName the key
* @return the value
*/
@@ -140,6 +150,16 @@ double SmartDashboard::GetNumber(std::string keyName)
return m_table->GetNumber(keyName);
}
/**
* Returns the value at the specified key. If the key is not found, returns the default value.
* @param keyName the key
* @return the value
*/
double SmartDashboard::GetNumber(std::string keyName, double defaultValue)
{
return m_table->GetNumber(keyName, defaultValue);
}
/**
* Maps the specified key to the specified value in this table.
* Neither the key nor the value can be NULL.
@@ -170,7 +190,7 @@ int SmartDashboard::GetString(std::string keyName, char *outBuffer, unsigned int
/**
* Returns the value at the specified key.
* Returns the value at the specified key. Throws an exception if the key is not found in the table
* @param keyName the key
* @return the value
*/
@@ -178,3 +198,13 @@ std::string SmartDashboard::GetString(std::string keyName)
{
return m_table->GetString(keyName);
}
/**
* Returns the value at the specified key. If the key is not found, returns the default value.
* @param keyName the key
* @return the value
*/
std::string SmartDashboard::GetString(std::string keyName, std::string defaultValue)
{
return m_table->GetString(keyName, defaultValue);
}

View File

@@ -41,6 +41,7 @@ public:
/** Sets a potentiometer as the position reference only. <br> Passed as the "tag" when setting the control mode. */
static const struct PotentiometerStruct {} Potentiometer;
typedef enum {kPercentVbus, kCurrent, kSpeed, kPosition, kVoltage} ControlMode;
typedef enum {kCurrentFault = 1, kTemperatureFault = 2, kBusVoltageFault = 4, kGateDriverFault = 8} Faults;
typedef enum {kForwardLimit = 1, kReverseLimit = 2} Limits;
typedef enum {
@@ -133,6 +134,7 @@ public:
void ConfigReverseLimit(double reverseLimitPosition);
void ConfigMaxOutputVoltage(double voltage);
void ConfigFaultTime(float faultTime);
ControlMode GetControlMode();
static void UpdateSyncGroup(uint8_t syncGroup);
@@ -143,13 +145,12 @@ public:
bool IsSafetyEnabled();
void SetSafetyEnabled(bool enabled);
void GetDescription(char *desc);
uint8_t GetDeviceID();
protected:
// Control mode helpers
typedef enum {kPercentVbus, kCurrent, kSpeed, kPosition, kVoltage} ControlMode;
void ChangeControlMode(ControlMode controlMode);
ControlMode GetControlMode();
void SetSpeedReference(uint8_t reference);
uint8_t GetSpeedReference();

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