Go to Post I used to wonder if the FRC staff would read the CD game hint posts and just laugh to themselves..now I know they do. - rachelholladay [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-10-2012, 20:00
fishythefish fishythefish is offline
Programmer
FRC #1504 (The Desperate Penguins)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Okemos, MI
Posts: 2
fishythefish is an unknown quantity at this point
CAN Protocol/Missing .java and .class files

cRIOs are fairly expensive and we don't get new ones each year, so in order to continue demo-ing our old robots, we want to try to compile code into a JAR and run the program output through an Arduino or something instead. In particular, we want a standalone implementation of the CAN protocol so that we can at least run motors.

Since the cRIO doesn't do any of the work of compiling, it seems like it should be possible to extract the relevant source files from the SunSPOT FRC SDK and put them in a new vanilla Java project. However, nearly all the files from edu.wpi.blahblahblah end up importing from com.sun.blahblahblah and all the packages under com.sun are missing in sunspotfrcsdk/lib/wpilibj/src and their corresponding .class files are missing from sunspotfrcsdk/lib/wpilibj/build, so I can't even decompile them to get the actual source. (But everything does show up in javadoc.)

If I create a Simple Robot project using the Netbeans module, then I can import these missing classes, but if I navigate to source, Netbeans auto-generates the missing code instead since no source can be found. However, many of the the generated files are incomplete or incorrect, so they don't help. Adding the JAR files from the modules directory to classpath also does not help.

Has anyone tried messing with this, and if so, can they tell me where I can find the missing files or if there is a better solution?
Reply With Quote
  #2   Spotlight this post!  
Unread 16-10-2012, 00:30
F22Rapture's Avatar
F22Rapture F22Rapture is offline
College Student, Mentor
AKA: Daniel A
FRC #3737 (4H Rotoraptors)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Goldsboro, NC
Posts: 476
F22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant future
Re: CAN Protocol/Missing .java and .class files

How about deleting the sunspotfrcsdk plugins folder, then redownloading the plugins?
__________________
Research is what I’m doing when I don’t know what I’m doing.
- Wernher von Braun
Attending: Raleigh NC Regional
Reply With Quote
  #3   Spotlight this post!  
Unread 16-10-2012, 13:11
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: CAN Protocol/Missing .java and .class files

After quickly looking in my sunspotfrcsdk folder, I found that all of the class files are there. https://docs.google.com/open?id=0B8o...VU1dVZMaTVGTnM I uploaded them there if you want them.
__________________
All opinions are my own.
Reply With Quote
  #4   Spotlight this post!  
Unread 16-10-2012, 18:38
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,572
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: CAN Protocol/Missing .java and .class files

Can an Arduino even run Java?

The problem is that the WPILibJ libraries are tied to the cRIO hardware. For every cRIO hardware call, you would need to replace it with a call to the equivalent feature in your new platform. For example, in the PWM class, rather then calling the FPGA function to generate a PWM signal, you'd need to replace it with the generate PWM command on the Arduino. When you've done this will all the source, I expect that there won't be any calls left to com.sun.*, as well as edu.wpi.first.wpilibj.fpga.*. In addition, the communication protocol is handled by a compiled library which edu.wpi.first.wpilibj.communication.* references. You'd need to re-implement all of that also, based on reverse engineering the communication protocol. There are probably other things you need to do as well.

The Jaguar CAN protocol specs are included in the Jaguar SDK. You will need to program the jaguars to the stock firmware, rather then the FRC firmware. This is because the FRC firmware runs in a "trusted" mode for which the protocol is not released.
Reply With Quote
  #5   Spotlight this post!  
Unread 22-10-2012, 18:59
fishythefish fishythefish is offline
Programmer
FRC #1504 (The Desperate Penguins)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Okemos, MI
Posts: 2
fishythefish is an unknown quantity at this point
Re: CAN Protocol/Missing .java and .class files

@joelg236: Those are the same files I have in the SDK. I just noticed that if you look at what they import, many of them end up importing from a class/classes in com.sun that do not appear in the SDK and are not included by default. I was just wondering where the sources for those were located. (Presumably, they're located in one of the compiled libraries.)

@Joe: Yeah, we discovered that FIRST hides the communication protocol. We're considering reverse engineering it as an alternative to what I'm trying to do right now.

I discovered that instead of trying to reconstruct the relevant classes, there is a suite directory containing a JAR that I could add to classpath. That library contains the same files that Joel and I have, but everything is functional.

To clarify what we're trying to do with the Arduino: We're not running anything on the Arduino itself. The idea was that we could possibly replace the cRIO with a combination of a laptop running the code and an Arduino on the robot passing the output to the relevant devices.

Current status: After adding the suite JAR file to the classpath of a vanilla Java project, I can import the CANJaguar class, create a CANJaguar variable, initialize it, and set its speed without any compiler errors. I'm just having trouble instantiating it at runtime, since I'm trying to communicate over USB-to-Serial, and that requires something in addition to the usual
CANJaguar jaguar = new CANJaguar(2);
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:49.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi