Go to Post FIRST is aimed at those girls on your team. They don't know anything about mechanics, or electricity, or programming, or machining. They have no interest in it, either. They're perfect candidates for FIRST. - Madison [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-06-2013, 18:17
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
Need a programmer familiar with CAN

Hey guys,

I need somebody who has worked with CAN before. I'm working on ATALibJ and I have to make a module for CANJaguars. If you have experience with CAN, please PM me. I don't have the first clue on how exactly to do it and I need the module done.

I'll explain the details of the project if you can help out.

Thanks,
Joel
__________________
All opinions are my own.
  #2   Spotlight this post!  
Unread 09-06-2013, 18:46
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Need a programmer familiar with CAN

I am familiar with CAN in the automotive industry, and read the entire LabVIEW FRC CAN driver, but FRC CAN is a terrible mess of garbage due to some insane restrictions on the Jaguar's CAN chip and poor software, and I highly recommend against ever using it in FRC.

Basically, the Jaguar's CAN chip has a 1-message rx buffer, and the receiving software in the Jaguar is either not interrupt driven or the 1khz control loop has higher priority, so multiple messages will overwrite and possibly corrupt the buffer (why not lock the buffer while reading?). The FRC solution is to not send another message to a single Jaguar until the Jaguar responds with an Ack. The WPIlib implementation waits for the Ack by locking the thread and waiting, which is terrible programming practice, especially in a single-threaded program sending command messages at 100hz plus configuration messages possibly as fast. Also, a single Jaguar failure will cause a 10ms task delay for each message missed when a Jaguar is down, which can cause several task iteration to be skipped waiting for Acks from other Jaguars.

A better solution would be to queue all messages to send to the Jaguars for a given loop tick and send one message to a jaguar at a time and hope the spacing is enough, relying on the CAN checksum, or use a state machine for each Jaguar to check if an Ack has been received without block-waiting for it and locking the thread.

Luckily, the great folks at Cross The Road Electronics are working hard to fix this for the 2015 control system. Until then, Jaguar CAN sucks.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #3   Spotlight this post!  
Unread 09-06-2013, 19:09
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: Need a programmer familiar with CAN

Quote:
Originally Posted by apalrd View Post
Until then, Jaguar CAN sucks.
I'm sorry if I was unclear with my intentions. I agree with you and am not planning to use CAN at all. I'm building a library in Java for FRC teams that wraps all of the wpilibj classes. Naturally, CANJaguar is on that list. I mostly have to do it out of necessity, and not at all because I think people should use it.
__________________
All opinions are my own.
  #4   Spotlight this post!  
Unread 09-06-2013, 19:13
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 992
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Need a programmer familiar with CAN

Quote:
Originally Posted by apalrd View Post
Basically, the Jaguar's CAN chip has a 1-message rx buffer, and the receiving software in the Jaguar is either not interrupt driven or the 1khz control loop has higher priority, so multiple messages will overwrite and possibly corrupt the buffer (why not lock the buffer while reading?). The FRC solution is to not send another message to a single Jaguar until the Jaguar responds with an Ack. The WPIlib implementation waits for the Ack by locking the thread and waiting, which is terrible programming practice, especially in a single-threaded program sending command messages at 100hz plus configuration messages possibly as fast. Also, a single Jaguar failure will cause a 10ms task delay for each message missed when a Jaguar is down, which can cause several task iteration to be skipped waiting for Acks from other Jaguars.

A better solution would be to queue all messages to send to the Jaguars for a given loop tick and send one message to a jaguar at a time and hope the spacing is enough, relying on the CAN checksum, or use a state machine for each Jaguar to check if an Ack has been received without block-waiting for it and locking the thread.

Luckily, the great folks at Cross The Road Electronics are working hard to fix this for the 2015 control system. Until then, Jaguar CAN sucks.
Continuing to parrot this rhetoric at every opportunity over a season after No-Ack commands have been implemented in the Jaguar firmware and LabVIEW libraries doesn't seem quite right.

Now if you want to complain about the C++ and Java libraries not implementing them, that would probably be more appropriate.
  #5   Spotlight this post!  
Unread 09-06-2013, 19:49
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Need a programmer familiar with CAN

Quote:
Originally Posted by RufflesRidge View Post
Continuing to parrot this rhetoric at every opportunity over a season after No-Ack commands have been implemented in the Jaguar firmware and LabVIEW libraries doesn't seem quite right.

Now if you want to complain about the C++ and Java libraries not implementing them, that would probably be more appropriate.
I suggested an alternative method using a state-machine for each Jaguar. There are still many deficiencies of the protocol, as the isochronous updates only apply to set commands, not set configuration, and configuration is volatile so it must be re-sent periodically if a device resets, or if the software wishes to change it (e.g. gain scheduled PID). A purely isochronous protocol would be significantly better.

When I implemented a rewrite of WPIlib in LabVIEW, I removed all CAN support because it wasn't worth the trouble. In fact, I removed almost all FPGA functionality that wasn't commonly used to improve efficiency. I only kept PWM, Analog input, Accumulator, DI, Relay, Solenoid, Encoder, and Counter. I will heavily consider adding CAN support back in for 2015, if CTRE improves the protocol design.

As for C++/Java libraries not implementing them, then the isochronous no-ack set command messages would be a good step.

If you would like any advice at all on how FRC-can operates or implementation advice from a CAN message standpoint (not java specific), I can answer questions, but I am not a Java programmer.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
Closed Thread


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 03:36.

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