Personal Project: Using CTRE Board

Hey guys, I am using the CTRE Hero board for a personal robot project and it seems I am forced to write in C#, which isn’t too ideal. If any of you have done solo projects with just the CTRE and nothing else, it would be great to have some up-to-date example code. The example code CTRE provides is a bit confusing because they show so many different systems. I am looking to drive a single TalonSRX w/ Bag Motor using the Logitech controller. I would be using the Joysticks so I of course expect to be using AnalogDrive, it is just CTRE didn’t provide an Analog Drive example, but just an Analog Input example.

Also, any tips when tackling the CTRE Hero board? Is it possible to connect an Arduino or Pi, how would I do it? Thanks!

I used the HERO for a project last semester. Here’s the code. I apologize, it’s pretty poorly documented.

We connected a Pi over UART- I imagine it’s pretty similar to do for an Arduino. Something that isn’t spelled out in the documentation is that you need to add a specific reference to the project or it won’t compile.
For this you just need to connect the RX-TX pair on the Pi or Arduino to the TX-RX ports on the HERO. The pinouts are described at the end of the user manual. There’s also an example UART project that I found very helpful to get started with.

Using the SRX is fairly similar to using it for FRC, API-wise. If you have any specific questions feel free to DM me or post. The CTRE guys also hang out here fairly often.

Here’s an example with four Talon SRXs and a gamepad.

Yes, but arcade drive would be using the d-pad/gamepad correct? Not the joysticks?

The example was tested with a Logitech 710 Wireless gamepad in D mode. The joysticks are used for driving the robot.
https://github.com/CrossTheRoadElec/Phoenix-Examples-Languages/blob/master/HERO%20C%23/HERO%20Arcade%20Drive%20Example/Program.cs#L63

‘Arcade’ refers to the mixing of the sticks. Left stick (Y) controls translation (straight) drive.
Right stick (X) applies turning.

GetAxis returns an analog axis by index.

You don’t have to use the hero board. I’ve been having a great time using the new raspberry pi libraries to control TalonSRXs with C++.

1 Like

Link to the libraries?

Awesome. Another question since I am a complete noob to all of this, but because I am only currently looking for a forward drive, I would set my left stick (Y) to equal getAxis(1) * -1 correct? Then in that case, what is getAxis(2)'s corresponding stick and why is it added or subtracted from Y for left or right throttle?

Here are the official armhf and x86 libraries https://github.com/CrossTheRoadElec/Phoenix-Linux-SocketCAN-Example

Here is my ROS implementation https://github.com/vanderbiltrobotics/NASA-RMC-2018-2019/tree/drive_devel/robot_motor_control

2 Likes

Raspberry Pi??? Ooh yes please!

FYI, You can:

  • control our devices this way for non-FRC applications
  • control our devices this way in FRC as long as a RIO is on the bus.

Some more relevant links…
https://phoenix-documentation.readthedocs.io/en/latest/ch03_PrimerPhoenixSoft.html?highlight=linux
image

More info…
https://phoenix-documentation.readthedocs.io/en/latest/blog/blog-week1.html?highlight=linux#phoenix-on-other-platforms

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.