Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
merge MentorSandbox -> master
Browse files Browse the repository at this point in the history
Former-commit-id: 05d463594a648c8e11722a26eb51e69da83219c1
Former-commit-id: 7e6f129
  • Loading branch information
rgatkinson committed Oct 14, 2015
2 parents 5bff912 + 9876e8b commit 957f732
Show file tree
Hide file tree
Showing 27 changed files with 381 additions and 243 deletions.
2 changes: 1 addition & 1 deletion FtcRobotController/FtcRobotController.iml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android 4.4.2 Google APIs" jdkType="Android SDK" />
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="RobotCore-release-" level="project" />
<orderEntry type="library" exported="" name="ModernRobotics-release-" level="project" />
Expand Down
33 changes: 10 additions & 23 deletions FtcRobotController/build.gradle
Original file line number Diff line number Diff line change
@@ -1,41 +1,28 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 19
buildToolsVersion '21.1.2'

defaultConfig {
minSdkVersion 16
targetSdkVersion 19
}
compileSdkVersion 'Google Inc.:Google APIs:19'
buildToolsVersion '21.1.2'
}

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
buildTypes {
release {
debuggable true
}
debug {
debuggable true
}
}
}

repositories {
flatDir {
dirs 'libs'
}
}

allprojects {
repositories {
jcenter()
flatDir {
dirs 'out'
}
}
}

dependencies {
compile files('libs/android-support-v4.jar')
compile (name:'RobotCore-release', ext:'aar')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ private void requestRobotSetup() {
modernRoboticsFactory.setXmlInputStream(fis);
factory = modernRoboticsFactory;

eventLoop = new FtcEventLoop(factory, new FtcOpModeRegister(), callback, this);
eventLoop = new SwerveFtcEventLoop(factory, new FtcOpModeRegister(), callback, this);

controllerService.setCallback(callback);
controllerService.setupRobot(eventLoop);
Expand Down Expand Up @@ -420,22 +420,22 @@ static class SwerveEventLoopMonitor implements EventLoopManager.EventLoopMonitor
}

// Make sure we're installed in the in the hook of the current event loop
public synchronized static void installIfNecessary(FtcRobotControllerService service)
public synchronized static boolean installIfNecessary(FtcRobotControllerService service)
{
if (service == null)
return;
return false;

Robot robot = robotOfFtcRobotControllerService(service);
Robot robot = MemberUtil.robotOfFtcRobotControllerService(service);
if (robot == null)
return;
return false;

EventLoopManager eventLoopManager = eventLoopManagerOfRobot(robot);
EventLoopManager eventLoopManager = MemberUtil.eventLoopManagerOfRobot(robot);
if (eventLoopManager == null)
return;
return false;

EventLoopManager.EventLoopMonitor monitor = monitorOfEventLoopManager(eventLoopManager);
EventLoopManager.EventLoopMonitor monitor = MemberUtil.monitorOfEventLoopManager(eventLoopManager);
if (monitor == null)
return;
return false;

if (monitor instanceof SwerveEventLoopMonitor)
{
Expand All @@ -446,100 +446,90 @@ public synchronized static void installIfNecessary(FtcRobotControllerService ser
SwerveEventLoopMonitor newMonitor = new SwerveEventLoopMonitor(monitor);
eventLoopManager.setMonitor(newMonitor);
}

return true;
}

//----------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
// Notifications
//----------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------

@Override
public void onStateChange(RobotState newState)
{
this.prevMonitor.onStateChange(newState);
RobotStateTransitionNotifier.onEventLoopStateChange(newState);
RobotStateTransitionNotifier.onRobotStateChange(newState);
}

//----------------------------------------------------------------------------------------------
// Skullduggery
//----------------------------------------------------------------------------------------------

public static Robot robotOfFtcRobotControllerService(FtcRobotControllerService service)
{
return Util.<Robot>getLocalPrivateObjectField(service, 2);
}
public static EventLoopManager eventLoopManagerOfRobot(Robot robot)
{
return Util.<EventLoopManager>getLocalPrivateObjectField(robot, 0);
}
public static EventLoopManager.EventLoopMonitor monitorOfEventLoopManager(EventLoopManager manager)
{
return Util.<EventLoopManager.EventLoopMonitor>getLocalPrivateObjectField(manager, 8);
}
}

class SwerveUpdateUIHook extends UpdateUI
// Hook used to augment the user interface
{
//----------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
// State
//----------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------

FtcRobotControllerActivity activity;
FtcRobotControllerService controllerService;
FtcRobotControllerActivity activity;
FtcRobotControllerService controllerService;

//----------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
// Construction
//----------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------

SwerveUpdateUIHook(FtcRobotControllerActivity activity, Dimmer dimmer)
{
super(activity, dimmer);
this.activity = activity;
this.controllerService = null;
}
{
super(activity, dimmer);
this.activity = activity;
this.controllerService = null;
}

@Override
public void setControllerService(FtcRobotControllerService controllerService)
{
super.setControllerService(controllerService);
this.controllerService = controllerService;
}
{
super.setControllerService(controllerService);
this.controllerService = controllerService;
}

//------------------------------------------------------------------------------------------
// Operations
//------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------
// Operations
//----------------------------------------------------------------------------------------------
class CallbackHook extends UpdateUI.Callback
{
//--------------------------------------------------------------------------------------
// Operations
//--------------------------------------------------------------------------------------

class CallbackHook extends UpdateUI.Callback
{
@Override
public void robotUpdate(final String status)
{
super.robotUpdate(status);
RobotStateTransitionNotifier.onRobotUpdate(status);

// Make sure we get to see all the robot state transitions
SwerveEventLoopMonitor.installIfNecessary(controllerService);
}

@Override
public void wifiDirectUpdate(WifiDirectAssistant.Event event)
{
super.wifiDirectUpdate(event);
{
super.wifiDirectUpdate(event);

final String message = controllerService == null
? ""
: String.format("Wifi Direct passphrase: %s", controllerService.getWifiDirectAssistant().getPassphrase());
final String message = controllerService == null
? ""
: String.format("Wifi Direct passphrase: %s", controllerService.getWifiDirectAssistant().getPassphrase());

SwerveUpdateUIHook.this.activity.runOnUiThread(new Runnable()
{
@Override
public void run()
{
activity.textWifiDirectPassphrase.setText(message);
{
@Override public void run()
{
activity.textWifiDirectPassphrase.setText(message);
}
});
}
}
}
});
}
}
}
}


Expand Down
2 changes: 1 addition & 1 deletion SwerveRoboticsLibrary/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdkVersion 16
targetSdkVersion 19
versionCode 1
versionName "0.6"
versionName "1.0"
}
buildTypes {
release {
Expand Down
4 changes: 3 additions & 1 deletion SwerveRoboticsLibrary/doc/javadoc/index-all.html
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ <h2 class="title">M</h2>
<dd>&nbsp;</dd>
<dt><a href="org/usfirst/ftc/exampleteam/yourcodehere/MyRobotControllerAdministration.html" title="class in org.usfirst.ftc.exampleteam.yourcodehere"><span class="typeNameLink">MyRobotControllerAdministration</span></a> - Class in <a href="org/usfirst/ftc/exampleteam/yourcodehere/package-summary.html">org.usfirst.ftc.exampleteam.yourcodehere</a></dt>
<dd>
<div class="block">MyRobotControllerAdministration is a container for 'administrative' methods that intereract
<div class="block">MyRobotControllerAdministration is a container for 'administrative' methods that interact
with the Swerve library.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/usfirst/ftc/exampleteam/yourcodehere/MyRobotControllerAdministration.html#MyRobotControllerAdministration--">MyRobotControllerAdministration()</a></span> - Constructor for class <a href="org/usfirst/ftc/exampleteam/yourcodehere/MyRobotControllerAdministration.html" title="class in org.usfirst.ftc.exampleteam.yourcodehere">MyRobotControllerAdministration</a></dt>
Expand Down Expand Up @@ -1021,6 +1021,8 @@ <h2 class="title">P</h2>
<dd>
<div class="block">Advanced: a hook for subclasses</div>
</dd>
<dt><span class="memberNameLink"><a href="org/swerverobotics/library/examples/SynchMotorLoopPerf.html#powerMotors-double-">powerMotors(double)</a></span> - Method in class <a href="org/swerverobotics/library/examples/SynchMotorLoopPerf.html" title="class in org.swerverobotics.library.examples">SynchMotorLoopPerf</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="org/swerverobotics/library/SynchronousOpMode.html#preInitHook--">preInitHook()</a></span> - Method in class <a href="org/swerverobotics/library/SynchronousOpMode.html" title="class in org.swerverobotics.library">SynchronousOpMode</a></dt>
<dd>
<div class="block">Advanced: the various 'hook' calls calls preInitHook(), postInitHook(), preLoopHook(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
catch(err) {
}
//-->
var methods = {"i0":10};
var methods = {"i0":10,"i1":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
Expand Down Expand Up @@ -128,7 +128,9 @@ <h2 title="Class SynchMotorLoopPerf" class="title">Class SynchMotorLoopPerf</h2>
extends <a href="../../../../org/swerverobotics/library/SynchronousOpMode.html" title="class in org.swerverobotics.library">SynchronousOpMode</a></pre>
<div class="block">An op mode that investigates how many loop() cycles it takes to do full
mode switching on a motor controller. Each main loop cycle does both
a read and a write to the motor.</div>
a read and a write to the motor.

This OpMode expects two motors, named 'motorLeft' and 'motorRight'.</div>
</li>
</ul>
</div>
Expand Down Expand Up @@ -192,6 +194,10 @@ <h3>Method Summary</h3>
<div class="block">Implement main() (in a subclass) to contain your robot logic.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/swerverobotics/library/examples/SynchMotorLoopPerf.html#powerMotors-double-">powerMotors</a></span>(double&nbsp;power)</code>&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.SynchronousOpMode">
Expand Down Expand Up @@ -248,7 +254,7 @@ <h3>Method Detail</h3>
<a name="main--">
<!-- -->
</a>
<ul class="blockListLast">
<ul class="blockList">
<li class="blockList">
<h4>main</h4>
<pre>public&nbsp;void&nbsp;main()
Expand Down Expand Up @@ -285,6 +291,15 @@ <h4>main</h4>
</dl>
</li>
</ul>
<a name="powerMotors-double-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>powerMotors</h4>
<pre>public&nbsp;void&nbsp;powerMotors(double&nbsp;power)</pre>
</li>
</ul>
</li>
</ul>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,27 +113,27 @@ <h2 title="Interface Hierarchy">Interface Hierarchy</h2>
</ul>
<h2 title="Annotation Type Hierarchy">Annotation Type Hierarchy</h2>
<ul>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/OpModeRegistrar.html" title="annotation in org.swerverobotics.library.interfaces"><span class="typeNameLink">OpModeRegistrar</span></a> (implements java.lang.annotation.Annotation)</li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/TeleOp.html" title="annotation in org.swerverobotics.library.interfaces"><span class="typeNameLink">TeleOp</span></a> (implements java.lang.annotation.Annotation)</li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/OnRobotRunning.html" title="annotation in org.swerverobotics.library.interfaces"><span class="typeNameLink">OnRobotRunning</span></a> (implements java.lang.annotation.Annotation)</li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/Disabled.html" title="annotation in org.swerverobotics.library.interfaces"><span class="typeNameLink">Disabled</span></a> (implements java.lang.annotation.Annotation)</li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/OnRobotStartupFailure.html" title="annotation in org.swerverobotics.library.interfaces"><span class="typeNameLink">OnRobotStartupFailure</span></a> (implements java.lang.annotation.Annotation)</li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/Autonomous.html" title="annotation in org.swerverobotics.library.interfaces"><span class="typeNameLink">Autonomous</span></a> (implements java.lang.annotation.Annotation)</li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/Disabled.html" title="annotation in org.swerverobotics.library.interfaces"><span class="typeNameLink">Disabled</span></a> (implements java.lang.annotation.Annotation)</li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/TeleOp.html" title="annotation in org.swerverobotics.library.interfaces"><span class="typeNameLink">TeleOp</span></a> (implements java.lang.annotation.Annotation)</li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/OpModeRegistrar.html" title="annotation in org.swerverobotics.library.interfaces"><span class="typeNameLink">OpModeRegistrar</span></a> (implements java.lang.annotation.Annotation)</li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/OnRobotRunning.html" title="annotation in org.swerverobotics.library.interfaces"><span class="typeNameLink">OnRobotRunning</span></a> (implements java.lang.annotation.Annotation)</li>
</ul>
<h2 title="Enum Hierarchy">Enum Hierarchy</h2>
<ul>
<li type="circle">java.lang.Object
<ul>
<li type="circle">java.lang.Enum&lt;E&gt; (implements java.lang.Comparable&lt;T&gt;, java.io.Serializable)
<ul>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/II2cDeviceClient.READ_MODE.html" title="enum in org.swerverobotics.library.interfaces"><span class="typeNameLink">II2cDeviceClient.READ_MODE</span></a></li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/IBNO055IMU.PITCHMODE.html" title="enum in org.swerverobotics.library.interfaces"><span class="typeNameLink">IBNO055IMU.PITCHMODE</span></a></li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/IBNO055IMU.ANGLEUNIT.html" title="enum in org.swerverobotics.library.interfaces"><span class="typeNameLink">IBNO055IMU.ANGLEUNIT</span></a></li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/IBNO055IMU.TEMPUNIT.html" title="enum in org.swerverobotics.library.interfaces"><span class="typeNameLink">IBNO055IMU.TEMPUNIT</span></a></li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/IBNO055IMU.REGISTER.html" title="enum in org.swerverobotics.library.interfaces"><span class="typeNameLink">IBNO055IMU.REGISTER</span></a></li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/IBNO055IMU.I2CADDR.html" title="enum in org.swerverobotics.library.interfaces"><span class="typeNameLink">IBNO055IMU.I2CADDR</span></a></li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/IBNO055IMU.ACCELUNIT.html" title="enum in org.swerverobotics.library.interfaces"><span class="typeNameLink">IBNO055IMU.ACCELUNIT</span></a></li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/IBNO055IMU.ANGLEUNIT.html" title="enum in org.swerverobotics.library.interfaces"><span class="typeNameLink">IBNO055IMU.ANGLEUNIT</span></a></li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/IBNO055IMU.SENSOR_MODE.html" title="enum in org.swerverobotics.library.interfaces"><span class="typeNameLink">IBNO055IMU.SENSOR_MODE</span></a></li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/II2cDeviceClient.READ_MODE.html" title="enum in org.swerverobotics.library.interfaces"><span class="typeNameLink">II2cDeviceClient.READ_MODE</span></a></li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/IBNO055IMU.ACCELUNIT.html" title="enum in org.swerverobotics.library.interfaces"><span class="typeNameLink">IBNO055IMU.ACCELUNIT</span></a></li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/IBNO055IMU.PITCHMODE.html" title="enum in org.swerverobotics.library.interfaces"><span class="typeNameLink">IBNO055IMU.PITCHMODE</span></a></li>
<li type="circle"><a href="../../../../org/swerverobotics/library/interfaces/IBNO055IMU.TEMPUNIT.html" title="enum in org.swerverobotics.library.interfaces"><span class="typeNameLink">IBNO055IMU.TEMPUNIT</span></a></li>
</ul>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ <h2 title="Class MyRobotControllerAdministration" class="title">Class MyRobotCon
<br>
<pre>public class <span class="typeNameLabel">MyRobotControllerAdministration</span>
extends java.lang.Object</pre>
<div class="block">MyRobotControllerAdministration is a container for 'administrative' methods that intereract
<div class="block">MyRobotControllerAdministration is a container for 'administrative' methods that interact
with the Swerve library. You don't <em>have to</em> put your administrative methods in a separate
class as we do here, but it does help keep them neat and tidy. Administrative methods are
each tagged with a Java annotation that connotes and bestows their significance; see the
Expand Down
Loading

0 comments on commit 957f732

Please sign in to comment.