View Single Post
  #1   Spotlight this post!  
Unread 30-07-2015, 21:33
TheHolyHades1 TheHolyHades1 is offline
Registered User
no team
 
Join Date: Jan 2014
Rookie Year: 2010
Location: usa
Posts: 145
TheHolyHades1 is a jewel in the roughTheHolyHades1 is a jewel in the roughTheHolyHades1 is a jewel in the rough
Programming for TalonSRX without RoboRIO?

In a side project, I'm currently attempting to use a couple Talon SRX's with a Beaglebone Black I have lying around, interfacing through a CANbus cape for the Beaglebone Black. In looking at the software reference manual, I see that I need to set the device IDs for the Talons - is it currently possible to do this without a RoboRIO?

Additionally, I'm attempting to find the source for the CANTalon.cpp / other relevant files, since I imagine I'll need to modify it slightly to be able to communicate via the can0 network interface that the cape provides as opposed to via the RoboRIO, but I can't seem to find the .cpp files on the WPIlib website - I'm only able to find the .h files. Could someone please point me to the .cpp files?

EDIT: As a note, I'm using Linux, but I also have a windows box available if necessary to download files.

EDIT 2: After some more poking around on CD, I was able to find this thread (http://www.chiefdelphi.com/forums/sh...d.php?t=129615) which links to this page (https://usfirst.collab.net/sf/projects/wpilib/), from where I was able to clone the repo. It seems that the CANTalon implementation has 2 levels - one being a WPIlib implementation (CANTalon), and the other, lower level one being a CTRE item (CanTalonSRX). However, I'm still not sure how to get the correct device IDs without the RoboRIO.

EDIT 3: Further digging reveals that the CAN implementation is dependent on a NI library, which is provided only as a .so. ("./ni-libraries/libFRC_NetworkCommunication.so"). I believe what I'd have to do is rewrite this library using my network interface instead of the one that is used on the RoboRIO. This would be significantly easier if I had the original code to work off of, so I will continue looking around.

EDIT 4: I've narrowed the files down to just a select few that I can start building up from, but I've hit another roadblock. I was hoping to be able to run a very simple program where I just instantiate a single CanTalonSRX, but it seems even that isn't possible at the moment, because the .so that's provided doesn't work on my system architecture. I should've realized this earlier. Since the RoboRIO is an ARM system, I'll try it on my beaglebone and see if I'm able to get it to work there.

EDIT 5: I've realized that the precompiled libraries are going to do me no good, so I've scrapped them entirely - while I got very close to compiling successfully on the beaglebone (note, C++11 is required), I got an error saying the linker wasn't able to find the _start. A quick SO search revealed that this is typically found in some .a file, which I wasn't able to find in wpilib. Additionally, I belive the .so requires libraries on the RoboRIO which I don't have on the Beaglebone. In short, this means that the only real way (as you've probably guessed by now) is to scrap the entire NI code and work with just the CANTalon code. I've begun this by starting to rewrite CANSessionMux.h / cpp, using the same gigantic function names as before. If you're curious, the file list that I'm working with at this point is as follows:

Code:
ctre.h
CanSessionMux2.h //I've renamed CanSessionMux.h, the original, by adding a 2
CanSessionMux2.cpp //This was previously in the form of the .so, and this is where my rewrite will likely take place
CtreCanNode.h
CtreCanNode.cpp
CanTalonSRX.h
CanTalonSRX.cpp
testing.cpp // a small program to initialize a CANTalon object. Compiles successfully!
And the command line arguments to compile:

Code:
g++ ctre.h CANSessionMux2.h CANSessionMux2.cpp CtreCanNode.h CtreCanNode.cpp CanTalonSRX.h CanTalonSRX.cpp testing.cpp -std=c++0x

Last edited by TheHolyHades1 : 31-07-2015 at 03:39.