I am using Command-based Java.
Our code is here (in case any of you want to look)
How do I make an autonomous selector? I looked through the docs and I know you can make a Shuffleboard chooser and what not, but I can’t figure out where to put it all. I had issues putting it in robot.java. The examples I found were for the old Command-based systems. Currently, we re-deploy code to change the autonomous modes
How can I get a NEO’s RPM using the hall-effect sensor built into the motor? I feel like it should be able to be done, but I am a bit confused. I know I can do:
private final CANSparkMax shooterMotor = new CANSparkMax(25, MotorType.kBrushless);
private final CANEncoder shooterEncoder = shooterMotor.getEncoder();
However, the docs say:
Assumes that the encoder the is integrated encoder, configured as: EncoderType.kHallEffect, 0 counts per revolution.
Which doesn’t make sense because how can you have a 0 CPR encoder and still get a velocity? Or is the integrated encoder a special case? I don’t have a lot of time to do programming tests, so any advice helps
Not for this season, but can I implement PathWeaver/WPI Trajectory with NEOs for drivetrain motors, and use the NEO’s integrated encoders, or do I have to use quadrature encoders and hook them up to the RoboRIO seperately?
Addressable LEDs - How Should I wire them up? I was thinking hooking up the Signal + Ground to Roborio, then 5V + Ground to the 5V 2A output on the VRM. Good or bad idea?
Also, How do I communicate to the LEDs from different subsystems or commands? Like If I was good to shoot, I would want to display green, and if the robot is done hanging, display Yellow (Just examples, but you get the point). How would I communicate from subsystems (I assume LEDs are a subsystem) or command to the LED strip?
Here is a link to how we do it.. We just instantiate the chooser with commands in RobotContainer’s constructor, and then get the selected one from the chooser when it’s time to run.
We actually programmatically build a Shuffleboard dashboard tab called Driver that loads up our driver windows. That is where we put the actual object, but it can be anywhere on either a Shuffleboard layout or the SmartDashboard.
If you use the 5v version of the LED strips you can just plug them into the roborio PWM ports which will give you the 6v rail, ground, and signal lines. Then you just need to solder the red/white/black PWM connectors directly to the LED strips (in the proper order).
As far as communicating Subsystem information back to the LEDs, we use NetworkTables to display information. Then you could have subsystems report any details back to the LED subsystem with network tables entries.
If you look in our repository, checkout our ShuffleboardInfo container class. That is where we collect all the information to display to the drivers. You could do similar things to get information to the LED subsystem that will control the color blink and all of that good stuff.
An easy way to hook up LEDs and make them display different patterns is to use one of these.
It plugs into the PDP for power and a PWM port and you just create an instance of a spark motor control and send it PWM values to display different patterns and colors. Then when you want to set a color just :
Or what ever pwm value corresponds to the color or pattern you want. They have long list to choose from.
But if you have a lot of LEDs, you should get the power from a separate regulated power supply off the PDP as the 6V rail on the PWM ports is only capable of sourcing up to 2.2A total. It was designed for powering small servos.