Compare commits

...

82 Commits

Author SHA1 Message Date
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
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
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
209 changed files with 4097 additions and 1529 deletions

5
.gitignore vendored
View File

@@ -17,8 +17,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

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

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

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

View File

@@ -85,6 +85,13 @@
<outputDirectory>${tools-zip}</outputDirectory>
<destFileName>SmartDashboard.jar</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>
</artifactItems>
<overWriteReleases>false</overWriteReleases>
@@ -194,5 +201,10 @@
<artifactId>SmartDashboard</artifactId>
<version>1.0.0-SNAPSHOT</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,44 @@
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 javax.swing.JOptionPane;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
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;
JOptionPane.showMessageDialog(null, message, title, JOptionPane.OK_OPTION);
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);
@@ -130,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();
@@ -161,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

@@ -80,6 +80,12 @@ 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() {

View File

@@ -28,6 +28,7 @@
<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;${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"/>
@@ -40,6 +41,7 @@
<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;${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/>
@@ -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

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

@@ -27,7 +27,7 @@ public:
*/
void OperatorControl()
{
while (IsOperatorControl())
while (IsOperatorControl() && IsEnabled())
{
// Get the current going through channel 7, in Amperes.
// The PDP returns the current in increments of 0.125A.

View File

@@ -66,7 +66,7 @@ public:
*/
void OperatorControl()
{
while (IsOperatorControl())
while (IsOperatorControl() && IsEnabled())
{
// Retrieve the net displacement of the Encoder since the lsat Reset.
SmartDashboard::PutNumber("Encoder Distance", m_encoder.GetDistance());

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,40 @@
#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;
public:
void RobotInit() override {
// create an image
frame = imaqCreateImage(IMAQ_IMAGE_RGB, 0);
// open the camera
IMAQdxOpenCamera("cam1", IMAQdxCameraControlModeController, &session);
IMAQdxConfigureGrab(session);
}
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);
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

@@ -34,7 +34,7 @@ public:
void OperatorControl()
{
robotDrive.SetSafetyEnabled(false);
while (IsOperatorControl())
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.

View File

@@ -31,7 +31,7 @@ public:
* Runs the motor from the output of a Joystick.
*/
void OperatorControl() {
while (IsOperatorControl()) {
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());

View File

@@ -39,7 +39,7 @@ public:
* Simultaneously displays encoder values on the SmartDashboard.
*/
void OperatorControl() {
while (IsOperatorControl()) {
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());

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

@@ -39,7 +39,7 @@ public:
*/
void OperatorControl()
{
while (IsOperatorControl())
while (IsOperatorControl() && IsEnabled())
{
// Retrieve the button values. GetRawButton will return
// true if the button is pressed and false if not.

View File

@@ -51,7 +51,7 @@ public:
*/
void OperatorControl()
{
while (IsOperatorControl())
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

View File

@@ -87,7 +87,12 @@
<description>Example programs that demonstrate the use of the various commonly used sensors on FRC robots</description>
</tagDescription>
<example>
<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>
@@ -240,8 +245,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>Getting Started</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
@@ -250,6 +292,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>
@@ -333,7 +376,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

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

@@ -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,9 +39,9 @@ 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 = 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);
@@ -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=admin
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=18
# 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

@@ -20,10 +20,25 @@
<target name="get-target-ip">
<property name="target" value="roboRIO-${team-number}.local" />
<echo>Target: ${target}</echo>
<echo>Trying Target: ${target}</echo>
<if>
<isreachable host="${target}"/>
<then>
<echo>roboRIO found via mDNS</echo>
</then>
<else>
<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 mDNS, 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">
<isreachable host="${target}"/>
</assert>
</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 +57,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 +67,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 +90,20 @@
</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">
<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>
</target>
</project>

View File

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

View File

@@ -39,7 +39,7 @@ public class Robot extends SampleRobot {
*/
public void operatorControl() {
robotDrive.setSafetyEnabled(true);
while (isOperatorControl()) {
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.

View File

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

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

@@ -166,6 +166,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>
@@ -198,6 +199,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>

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

@@ -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
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=18
# Ant support
wpilib.ant.dir=${wpilib}/ant

View File

@@ -20,7 +20,22 @@
<target name="get-target-ip">
<property name="target" value="roboRIO-${team-number}.local" />
<echo>Target: ${target}</echo>
<echo>Trying Target: ${target}</echo>
<if>
<isreachable host="${target}"/>
<then>
<echo>roboRIO found via mDNS</echo>
</then>
<else>
<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 mDNS, 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">
<isreachable host="${target}"/>
</assert>
</else>
</if>
</target>
<target name="compile" description="Compile the source code.">
@@ -66,7 +81,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 +97,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 +119,6 @@
trust="true"
command="${deploy.kill.command}"/>
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
command="${deploy.log.command}"/>
</target>
<!-- Simulate -->
@@ -180,4 +189,27 @@
</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">
<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>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
/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
/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,12 +14,13 @@
<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>

View File

@@ -45,3 +45,16 @@
#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 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

@@ -23,6 +23,7 @@
#include "Errors.hpp"
#include "PDP.hpp"
#include "Power.hpp"
#include "SerialPort.hpp"
#include "Utilities.hpp"
#include "Semaphore.hpp"
@@ -214,7 +215,10 @@ extern "C"
int HALGetJoystickPOVs(uint8_t joystickNum, HALJoystickPOVs *povs);
int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons, uint8_t *count);
void HALSetNewDataSem(pthread_mutex_t *);
void HALSetNewDataSem(pthread_cond_t *);
bool HALGetSystemActive(int32_t *status);
bool HALGetBrownedOut(int32_t *status);
int HALInitialize(int mode = 0);
void HALNetworkCommunicationObserveUserProgramStarting();

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

@@ -242,7 +242,7 @@ void setPWMPeriodScale(void* digital_port_pointer, uint32_t squelchMask, int32_t
/**
* Allocate a DO PWM Generator.
* Allocate PWM generators so that they are not accidently reused.
* Allocate PWM generators so that they are not accidentally reused.
*
* @return PWM Generator refnum
*/
@@ -299,12 +299,12 @@ void setPWMDutyCycle(void* pwmGenerator, double dutyCycle, int32_t *status) {
if(id < 4)
digitalSystem->writePWMDutyCycleA(id, (uint8_t)rawDutyCycle, status);
else
digitalSystem->writePWMDutyCycleB(id - 3, (uint8_t)rawDutyCycle, status);
digitalSystem->writePWMDutyCycleB(id - 4, (uint8_t)rawDutyCycle, status);
}
}
/**
* Configure which DO channel the PWM siganl is output on
* Configure which DO channel the PWM signal is output on
*
* @param pwmGenerator The generator index reserved by AllocateDO_PWM()
* @param channel The Digital Output channel to output on

View File

@@ -4,6 +4,6 @@
#ifndef __RoboRIO_FRC_ChipObject_Aliases_h__
#define __RoboRIO_FRC_ChipObject_Aliases_h__
#define nRoboRIO_FPGANamespace nFRC_2015_1_0_9
#define nRoboRIO_FPGANamespace nFRC_2015_1_0_A
#endif // __RoboRIO_FRC_ChipObject_Aliases_h__

View File

@@ -0,0 +1,15 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__
#define __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__
namespace nFPGA
{
namespace nFRC_C0EF_1_1_0
{
extern unsigned int g_currentTargetClass;
}
}
#endif // __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__

View File

@@ -1,15 +1,15 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_nInterfaceGlobals_h__
#define __nFRC_2015_1_0_9_nInterfaceGlobals_h__
#ifndef __nFRC_2015_1_0_A_nInterfaceGlobals_h__
#define __nFRC_2015_1_0_A_nInterfaceGlobals_h__
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
extern unsigned int g_currentTargetClass;
}
}
#endif // __nFRC_2015_1_0_9_nInterfaceGlobals_h__
#endif // __nFRC_2015_1_0_A_nInterfaceGlobals_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_AI_h__
#define __nFRC_2015_1_0_9_AI_h__
#ifndef __nFRC_2015_1_0_A_AI_h__
#define __nFRC_2015_1_0_A_AI_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tAI
@@ -140,4 +140,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_AI_h__
#endif // __nFRC_2015_1_0_A_AI_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_AO_h__
#define __nFRC_2015_1_0_9_AO_h__
#ifndef __nFRC_2015_1_0_A_AO_h__
#define __nFRC_2015_1_0_A_AO_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tAO
@@ -47,4 +47,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_AO_h__
#endif // __nFRC_2015_1_0_A_AO_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_Accel_h__
#define __nFRC_2015_1_0_9_Accel_h__
#ifndef __nFRC_2015_1_0_A_Accel_h__
#define __nFRC_2015_1_0_A_Accel_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tAccel
@@ -99,4 +99,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_Accel_h__
#endif // __nFRC_2015_1_0_A_Accel_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_Accumulator_h__
#define __nFRC_2015_1_0_9_Accumulator_h__
#ifndef __nFRC_2015_1_0_A_Accumulator_h__
#define __nFRC_2015_1_0_A_Accumulator_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tAccumulator
@@ -84,4 +84,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_Accumulator_h__
#endif // __nFRC_2015_1_0_A_Accumulator_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_Alarm_h__
#define __nFRC_2015_1_0_9_Alarm_h__
#ifndef __nFRC_2015_1_0_A_Alarm_h__
#define __nFRC_2015_1_0_A_Alarm_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tAlarm
@@ -54,4 +54,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_Alarm_h__
#endif // __nFRC_2015_1_0_A_Alarm_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_AnalogTrigger_h__
#define __nFRC_2015_1_0_9_AnalogTrigger_h__
#ifndef __nFRC_2015_1_0_A_AnalogTrigger_h__
#define __nFRC_2015_1_0_A_AnalogTrigger_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tAnalogTrigger
@@ -126,4 +126,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_AnalogTrigger_h__
#endif // __nFRC_2015_1_0_A_AnalogTrigger_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_BIST_h__
#define __nFRC_2015_1_0_9_BIST_h__
#ifndef __nFRC_2015_1_0_A_BIST_h__
#define __nFRC_2015_1_0_A_BIST_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tBIST
@@ -87,4 +87,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_BIST_h__
#endif // __nFRC_2015_1_0_A_BIST_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_Counter_h__
#define __nFRC_2015_1_0_9_Counter_h__
#ifndef __nFRC_2015_1_0_A_Counter_h__
#define __nFRC_2015_1_0_A_Counter_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tCounter
@@ -216,4 +216,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_Counter_h__
#endif // __nFRC_2015_1_0_A_Counter_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_DIO_h__
#define __nFRC_2015_1_0_9_DIO_h__
#ifndef __nFRC_2015_1_0_A_DIO_h__
#define __nFRC_2015_1_0_A_DIO_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tDIO
@@ -245,4 +245,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_DIO_h__
#endif // __nFRC_2015_1_0_A_DIO_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_DMA_h__
#define __nFRC_2015_1_0_9_DMA_h__
#ifndef __nFRC_2015_1_0_A_DMA_h__
#define __nFRC_2015_1_0_A_DMA_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tDMA
@@ -185,4 +185,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_DMA_h__
#endif // __nFRC_2015_1_0_A_DMA_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_Encoder_h__
#define __nFRC_2015_1_0_9_Encoder_h__
#ifndef __nFRC_2015_1_0_A_Encoder_h__
#define __nFRC_2015_1_0_A_Encoder_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tEncoder
@@ -24,7 +24,7 @@ public:
typedef enum
{
kNumSystems = 4,
kNumSystems = 8,
} tIfaceConstants;
typedef
@@ -196,4 +196,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_Encoder_h__
#endif // __nFRC_2015_1_0_A_Encoder_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_Global_h__
#define __nFRC_2015_1_0_9_Global_h__
#ifndef __nFRC_2015_1_0_A_Global_h__
#define __nFRC_2015_1_0_A_Global_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tGlobal
@@ -101,4 +101,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_Global_h__
#endif // __nFRC_2015_1_0_A_Global_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_Interrupt_h__
#define __nFRC_2015_1_0_9_Interrupt_h__
#ifndef __nFRC_2015_1_0_A_Interrupt_h__
#define __nFRC_2015_1_0_A_Interrupt_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tInterrupt
@@ -97,4 +97,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_Interrupt_h__
#endif // __nFRC_2015_1_0_A_Interrupt_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_PWM_h__
#define __nFRC_2015_1_0_9_PWM_h__
#ifndef __nFRC_2015_1_0_A_PWM_h__
#define __nFRC_2015_1_0_A_PWM_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tPWM
@@ -117,4 +117,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_PWM_h__
#endif // __nFRC_2015_1_0_A_PWM_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_Power_h__
#define __nFRC_2015_1_0_9_Power_h__
#ifndef __nFRC_2015_1_0_A_Power_h__
#define __nFRC_2015_1_0_A_Power_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tPower
@@ -214,4 +214,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_Power_h__
#endif // __nFRC_2015_1_0_A_Power_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_Relay_h__
#define __nFRC_2015_1_0_9_Relay_h__
#ifndef __nFRC_2015_1_0_A_Relay_h__
#define __nFRC_2015_1_0_A_Relay_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tRelay
@@ -65,4 +65,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_Relay_h__
#endif // __nFRC_2015_1_0_A_Relay_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_SPI_h__
#define __nFRC_2015_1_0_9_SPI_h__
#ifndef __nFRC_2015_1_0_A_SPI_h__
#define __nFRC_2015_1_0_A_SPI_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tSPI
@@ -65,4 +65,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_SPI_h__
#endif // __nFRC_2015_1_0_A_SPI_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_9_SysWatchdog_h__
#define __nFRC_2015_1_0_9_SysWatchdog_h__
#ifndef __nFRC_2015_1_0_A_SysWatchdog_h__
#define __nFRC_2015_1_0_A_SysWatchdog_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_9
namespace nFRC_2015_1_0_A
{
class tSysWatchdog
@@ -105,4 +105,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_9_SysWatchdog_h__
#endif // __nFRC_2015_1_0_A_SysWatchdog_h__

View File

@@ -0,0 +1,15 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2012_1_6_4_nInterfaceGlobals_h__
#define __nFRC_2012_1_6_4_nInterfaceGlobals_h__
namespace nFPGA
{
namespace nFRC_2012_1_6_4
{
extern unsigned int g_currentTargetClass;
}
}
#endif // __nFRC_2012_1_6_4_nInterfaceGlobals_h__

View File

@@ -3,6 +3,7 @@
#include "Port.h"
#include "HAL/Errors.hpp"
#include "ctre/ctre.h"
#include "visa/visa.h"
#include "ChipObject.h"
#include "NetworkCommunication/FRCComm.h"
#include "NetworkCommunication/UsageReporting.h"
@@ -10,6 +11,7 @@
#include <fstream>
#include <iostream>
#include <unistd.h>
#include <sys/prctl.h>
#include <signal.h> // linux for kill
const uint32_t solenoid_kNumDO7_0Elements = 8;
const uint32_t dio_kNumSystems = tDIO::kNumSystems;
@@ -17,6 +19,7 @@ const uint32_t interrupt_kNumSystems = tInterrupt::kNumSystems;
const uint32_t kSystemClockTicksPerMicrosecond = 40;
static tGlobal *global;
static tSysWatchdog *watchdog;
void* getPort(uint8_t pin)
{
@@ -101,7 +104,31 @@ const char* getHALErrorMessage(int32_t code)
case ERR_CANSessionMux_NotAllowed:
return ERR_CANSessionMux_NotAllowed_MESSAGE;
case ERR_CANSessionMux_NotInitialized:
return ERR_CANSessionMux_NotInitialized_MESSAGE;
return ERR_CANSessionMux_NotInitialized_MESSAGE;
case VI_ERROR_SYSTEM_ERROR:
return VI_ERROR_SYSTEM_ERROR_MESSAGE;
case VI_ERROR_INV_OBJECT:
return VI_ERROR_INV_OBJECT_MESSAGE;
case VI_ERROR_RSRC_LOCKED:
return VI_ERROR_RSRC_LOCKED_MESSAGE;
case VI_ERROR_RSRC_NFOUND:
return VI_ERROR_RSRC_NFOUND_MESSAGE;
case VI_ERROR_INV_RSRC_NAME:
return VI_ERROR_INV_RSRC_NAME_MESSAGE;
case VI_ERROR_QUEUE_OVERFLOW:
return VI_ERROR_QUEUE_OVERFLOW_MESSAGE;
case VI_ERROR_IO:
return VI_ERROR_IO_MESSAGE;
case VI_ERROR_ASRL_PARITY:
return VI_ERROR_ASRL_PARITY_MESSAGE;
case VI_ERROR_ASRL_FRAMING:
return VI_ERROR_ASRL_FRAMING_MESSAGE;
case VI_ERROR_ASRL_OVERRUN:
return VI_ERROR_ASRL_OVERRUN_MESSAGE;
case VI_ERROR_RSRC_BUSY:
return VI_ERROR_RSRC_BUSY_MESSAGE;
case VI_ERROR_INV_PARAMETER:
return VI_ERROR_INV_PARAMETER_MESSAGE;
default:
return "Unknown error status";
}
@@ -179,16 +206,31 @@ int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons, uint
return FRC_NetworkCommunication_getJoystickButtons(joystickNum, buttons, count);
}
void HALSetNewDataSem(pthread_mutex_t * param)
void HALSetNewDataSem(pthread_cond_t * param)
{
setNewDataSem(param);
}
bool HALGetSystemActive(int32_t *status)
{
return watchdog->readStatus_SystemActive(status);
}
bool HALGetBrownedOut(int32_t *status)
{
return !(watchdog->readStatus_PowerAlive(status));
}
/**
* Call this to start up HAL. This is required for robot programs.
*/
int HALInitialize(int mode)
{
setlinebuf(stdin);
setlinebuf(stdout);
prctl(PR_SET_PDEATHSIG, SIGTERM);
FRC_NetworkCommunication_Reserve(nullptr);
// image 4; Fixes errors caused by multiple processes. Talk to NI about this
nFPGA::nRoboRIO_FPGANamespace::g_currentTargetClass =
@@ -196,6 +238,7 @@ int HALInitialize(int mode)
int32_t status;
global = tGlobal::create(&status);
watchdog = tSysWatchdog::create(&status);
// Kill any previous robot programs
std::fstream fs;

View File

@@ -51,6 +51,7 @@ public:
*/
virtual int32_t receiveMessage(uint32_t &messageID, uint8_t *data, uint8_t &dataSize) = 0;
#if defined(__linux)
/**
* This entry-point of the CANInterfacePlugin returns status of the CAN bus.
*
@@ -67,6 +68,7 @@ public:
* @return This should return 0 if all status was retrieved successfully or an error code if not.
*/
virtual int32_t getStatus(uint32_t &busOffCount, uint32_t &txFullCount, uint32_t &receiveErrorCount, uint32_t &transmitErrorCount) {return 0;}
#endif
};
/**

View File

@@ -91,7 +91,7 @@ extern "C" {
# if defined (__vxworks)
void EXPORT_FUNC setNewDataSem(SEM_ID);
# else
void EXPORT_FUNC setNewDataSem(pthread_mutex_t *);
void EXPORT_FUNC setNewDataSem(pthread_cond_t *);
# endif
#endif

View File

@@ -68,7 +68,11 @@ namespace nUsageReporting
kResourceType_HiTechnicColorSensor,
kResourceType_HiTechnicAccel,
kResourceType_HiTechnicCompass,
kResourceType_SRF08,
kResourceType_SRF08,
kResourceType_AnalogOutput,
kResourceType_VictorSP,
kResourceType_TalonSRX,
kResourceType_CANTalonSRX,
} tResourceType;
typedef enum

View File

@@ -41,12 +41,28 @@ float getUserCurrent6V(int32_t *status) {
return power->readUserCurrent6V(status) / 4.096f * 0.005566f - 0.009f;
}
/**
* Get the active state of the 6V rail
*/
bool getUserActive6V(int32_t *status) {
initializePower(status);
return power->readStatus_User6V(status) == 4;
}
/**
* Get the fault count for the 6V rail
*/
int getUserCurrentFaults6V(int32_t *status) {
initializePower(status);
return (int)power->readOverCurrentFaultCounts_OverCurrentFaultCount6V(status);
}
/**
* Get the 5V rail voltage
*/
float getUserVoltage5V(int32_t *status) {
initializePower(status);
return power->readUserVoltage5V(status) / 4.096f * 0.004962f - 0.013f;
return power->readUserVoltage5V(status) / 4.096f * 0.005962f - 0.013f;
}
/**
@@ -57,6 +73,27 @@ float getUserCurrent5V(int32_t *status) {
return power->readUserCurrent5V(status) / 4.096f * 0.001996f - 0.002f;
}
/**
* Get the active state of the 5V rail
*/
bool getUserActive5V(int32_t *status) {
initializePower(status);
return power->readStatus_User5V(status) == 4;
}
/**
* Get the fault count for the 5V rail
*/
int getUserCurrentFaults5V(int32_t *status) {
initializePower(status);
return (int)power->readOverCurrentFaultCounts_OverCurrentFaultCount5V(status);
}
unsigned char getUserStatus5V(int32_t *status) {
initializePower(status);
return power->readStatus_User5V(status);
}
/**
* Get the 3.3V rail voltage
*/
@@ -72,3 +109,19 @@ float getUserCurrent3V3(int32_t *status) {
initializePower(status);
return power->readUserCurrent3V3(status) / 4.096f * 0.002486f - 0.003f;
}
/**
* Get the active state of the 3.3V rail
*/
bool getUserActive3V3(int32_t *status) {
initializePower(status);
return power->readStatus_User3V3(status) == 4;
}
/**
* Get the fault count for the 3.3V rail
*/
int getUserCurrentFaults3V3(int32_t *status) {
initializePower(status);
return (int)power->readOverCurrentFaultCounts_OverCurrentFaultCount3V3(status);
}

View File

@@ -1,4 +1,3 @@
#include "HAL/Semaphore.hpp"
#include "Log.hpp"
@@ -122,11 +121,10 @@ void deleteMultiWait(MULTIWAIT_ID sem) {
delete sem;
}
int8_t takeMultiWait(MULTIWAIT_ID sem, int32_t timeout) {
MUTEX_ID m = initializeMutexNormal();
int8_t takeMultiWait(MULTIWAIT_ID sem, MUTEX_ID m, int32_t timeout) {
takeMutex(m);
int8_t val = pthread_cond_wait(sem, m);
deleteMutex(m);
giveMutex(m);
return val;
}

View File

@@ -0,0 +1,146 @@
#include "HAL/SerialPort.hpp"
#include "visa/visa.h"
uint32_t m_resourceManagerHandle;
uint32_t m_portHandle[2];
void serialInitializePort(uint8_t port, int32_t *status) {
char const * portName;
if (m_resourceManagerHandle ==0)
viOpenDefaultRM((ViSession*)&m_resourceManagerHandle);
if(port == 0)
portName = "ASRL1::INSTR";
else
portName = "ASRL2::INSTR";
*status = viOpen(m_resourceManagerHandle, const_cast<char*>(portName), VI_NULL, VI_NULL, (ViSession*)&m_portHandle[port]);
if(*status > 0)
*status = 0;
}
void serialSetBaudRate(uint8_t port, uint32_t baud, int32_t *status) {
*status = viSetAttribute(m_portHandle[port], VI_ATTR_ASRL_BAUD, baud);
if(*status > 0)
*status = 0;
}
void serialSetDataBits(uint8_t port, uint8_t bits, int32_t *status) {
*status = viSetAttribute(m_portHandle[port], VI_ATTR_ASRL_DATA_BITS, bits);
if(*status > 0)
*status = 0;
}
void serialSetParity(uint8_t port, uint8_t parity, int32_t *status) {
*status = viSetAttribute(m_portHandle[port], VI_ATTR_ASRL_PARITY, parity);
if(*status > 0)
*status = 0;
}
void serialSetStopBits(uint8_t port, uint8_t stopBits, int32_t *status) {
*status = viSetAttribute(m_portHandle[port], VI_ATTR_ASRL_STOP_BITS, stopBits);
if(*status > 0)
*status = 0;
}
void serialSetWriteMode(uint8_t port, uint8_t mode, int32_t *status) {
*status = viSetAttribute(m_portHandle[port], VI_ATTR_WR_BUF_OPER_MODE, mode);
if(*status > 0)
*status = 0;
}
void serialSetFlowControl(uint8_t port, uint8_t flow, int32_t *status) {
*status = viSetAttribute(m_portHandle[port], VI_ATTR_ASRL_FLOW_CNTRL, flow);
if(*status > 0)
*status = 0;
}
void serialSetTimeout(uint8_t port, float timeout, int32_t *status) {
*status = viSetAttribute(m_portHandle[port], VI_ATTR_TMO_VALUE, (uint32_t)(timeout * 1e3));
if(*status > 0)
*status = 0;
}
void serialEnableTermination(uint8_t port, char terminator, int32_t *status) {
viSetAttribute(m_portHandle[port], VI_ATTR_TERMCHAR_EN, VI_TRUE);
viSetAttribute(m_portHandle[port], VI_ATTR_TERMCHAR, terminator);
*status = viSetAttribute(m_portHandle[port], VI_ATTR_ASRL_END_IN, VI_ASRL_END_TERMCHAR);
if(*status > 0)
*status = 0;
}
void serialDisableTermination(uint8_t port, int32_t *status) {
viSetAttribute(m_portHandle[port], VI_ATTR_TERMCHAR_EN, VI_FALSE);
*status = viSetAttribute(m_portHandle[port], VI_ATTR_ASRL_END_IN, VI_ASRL_END_NONE);
if(*status > 0)
*status = 0;
}
void serialSetReadBufferSize(uint8_t port, uint32_t size, int32_t *status) {
*status = viSetBuf(m_portHandle[port], VI_READ_BUF, size);
if(*status > 0)
*status = 0;
}
void serialSetWriteBufferSize(uint8_t port, uint32_t size, int32_t *status) {
*status = viSetBuf(m_portHandle[port], VI_WRITE_BUF, size);
if(*status > 0)
*status = 0;
}
int32_t serialGetBytesReceived(uint8_t port, int32_t *status) {
int32_t bytes = 0;
*status = viGetAttribute(m_portHandle[port], VI_ATTR_ASRL_AVAIL_NUM, &bytes);
if(*status > 0)
*status = 0;
return bytes;
}
uint32_t serialRead(uint8_t port, char* buffer, int32_t count, int32_t *status) {
uint32_t retCount = 0;
*status = viRead(m_portHandle[port], (ViPBuf)buffer, count, (ViPUInt32)&retCount);
if(*status == VI_ERROR_IO || *status == VI_ERROR_ASRL_OVERRUN || *status == VI_ERROR_ASRL_FRAMING || *status == VI_ERROR_ASRL_PARITY)
{
int32_t localStatus = 0;
serialClear(port, &localStatus);
}
if(*status == VI_ERROR_TMO || *status > 0)
*status = 0;
return retCount;
}
uint32_t serialWrite(uint8_t port, const char *buffer, int32_t count, int32_t *status) {
uint32_t retCount = 0;
*status = viWrite(m_portHandle[port], (ViPBuf)buffer, count, (ViPUInt32)&retCount);
if(*status > 0)
*status = 0;
return retCount;
}
void serialFlush(uint8_t port, int32_t *status) {
*status = viFlush(m_portHandle[port], VI_WRITE_BUF);
if(*status > 0)
*status = 0;
}
void serialClear(uint8_t port, int32_t *status) {
*status = viClear(m_portHandle[port]);
if(*status > 0)
*status = 0;
}
void serialClose(uint8_t port, int32_t *status) {
*status = viClose(m_portHandle[port]);
if(*status > 0)
*status = 0;
}

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