Hey guys. Although this is an FRC forum for the teams, I want to ask a personal question. As of now, I am apart of team 852 as a first year rookie, but I am not only apart of it to create a robot for this years competition, but to also gain experience so I can apply that into my own personal project, building BB-8.
I have decided that I want to use Rev Robotics new NEO Brushless Motors with the SparkMax motor controllers. I still need to know what other components I need to get, in order to start coding using the wpilib library. I believe in order to connect all my motors together to get a unified system, I would usually need a RoboRio, which is a crap ton of money. I want to find a cheaper solution to run around 4 Neo’s in total. I can program in either C++ or Java, which ever works is fine. I have browsed through other sites saying that a Rasberry Pi 2 could work, but I have no idea where to start with that. ATM, I have coded up the lights and LED’s for the dome via an Arduino, and will eventually be controlled with a PS4 or Xbox controller, so I am also trying to figure out how to get the Arduino code to coincide with the robot motor code. Should I use a pi instead? As well as a recommendation for a roborio alternative, what other electronic components should I need to get the robot functioning?
You can use a Pi, but if you want to control the MAX over CAN bus, you’ll have to implement the MAX’s CAN API yourself, which’ll be a lot of work (unless REV has an open source non-rio library anywhere, but I don’t think so).
Simple PWM control of the MAX is fairly easy, but then you’re missing out on everything from current limiting to closed loop control.
The Spark MAX Java API can be decompiled fairly easily in IntelliJ or a similar IDE to reveal the code that creates the CAN frames. The frames are actually quite simple, and it looks like you could fairly easily replicate them on another platform. However, this is probably NOT recommended by REV (and might void your warranty if you do something wrong!)
Another way (especially if you’re only controlling one) may be to control over USB to the pi. The backend of our PC software will compile on the pi, and has a networking layer with protocol buffers that describe the messages. Unfortunately we don’t have any examples at the moment, so you would be on your own with the implementation.
I have not actually used the HERO. I purchased one, but figured out how to get an arduino to work fast enough for an SRX encoder before I figured out HERO programming.
Speaking from documentation rather than experience, the HERO boasts support for I2C, SPI, USB (both host and device), and USART/UART. You should be able to get at least one of these working with either arduino or pi.
Depending on how much of a “project” you want the control system to be, the complexity of software required, and etc, I’d use a microcontroller. The ESP32 is a current favorite of mine, very powerful and includes Wifi and Bluetooth. You can get a CAN transceiver board and write the packets yourself, or just go PWM control for the motors.
It seems like you and GeeTwo have great confidence in the HERO board. I think I will use that and try get it to communicate with a rasberry pi or arduino, then control the whole thing with a ps4 or xbox controller. I have the link to the product itself, but is the documentation and everything else in the description a satisfactory start to learn how to get everything up and running? I do want to get the MAX CAN api working if I can, and if not I will use PWM. Do you have a good site to learn the ins and outs of coding up everything, because I am an FRC rookie who has only written the easy code for the DriveTrain.
I’ve never used the HERO board, but it serves in the same capacity as a roboRIO, so you shouldn’t need any extra boards.
My idea would be to use something like this to talk to CANbus and then use this as the main robot controller.
If you do decide to go with the HERO, you can get a wireless Xbox controller and I believe that works natively. The HERO can only be programmed with C# and probably has a higher level interface than the ESP32 I recommend.
Cool, thanks for the advice! I am still unsure in that case what products are good. Could you perhaps send me a link to products that would servo as the “non-MAX + NEO” setup you were referring to. Of course for the NEO, you mean the motors, but for the non-MAX one, I want to be able to do PID. If I am understanding right, what other non-max product would be able to deliver that information, or do I have it all wrong? Sorry for asking so much, but I am so new to these devices that asking as many questions seems like the right decision.
Yeah we use a normal FRC wireless bridge programmed to our team number and the gorgon and drivers station get a 10.TE.AM.xx address. Just a matter of finding which IP it gets and set accordingly. We have only used it for driving so far using the examples that are in the library.
If I was building this myself, I’d just use off-the-shelf brushed DC motors and controllers - nobody does good sensored control outside of the Odrive folks, and that’s expensive - some random encoder I have lying around (probably a CUI or grayhill), and implement the PID control myself. It’s really not all that difficult - writing reliable TCP code for controls is going to be harder, complexity wise. You’re not going to get anything that can servo out of the box for less than a few hundreds of dollars. The Odrive is a good option but it only does motor speed/position sensing, it can’t take in inputs from encoders that aren’t directly connected to the motor.
Plus, building a system like this from scratch is an amazing learning experience.
I think it would be best for me to drive to NEOs with the Spark Max would be with the PWM interface, because I don’t think I will be needing the advanced features like closed-loop and such. I will most likely be using a Rasberry Pi and get all the necessary components to have it communicate with a ps4 or xbox controller. Since I have no experience with Rasberry Pi’s, what other components and resources do you recommend for my project? Or is everything already avaliable and all I have to do is implement the code in the pi?