A general checklist that applies for many of your questions:
-
Read the WPILib Docs, https://docs.wpilib.org/
-
Get familiar with reading/navigating the WPILib API Docs (javadocs), Overview (WPILib API 2023.4.3)
-
Check out the Command Based Example Projects (many of your “How do I implement X” questions especially are likely covered here), WPILib Example Projects — FIRST Robotics Competition documentation
-
Do 1-3 for each relevant Vendor Lib (REV, Phoenix, NavX, etc.). I know REV especially has a lot of good example projects for how to do things with the SparkMAX over CAN.
-
Find code from other teams in GitHub, and check out what/how they are doing things
See above for where to learn about the things.
As for understanding the code you are reading, the more familiar and comfortable you get at programming and problem solving, the easier it gets to read and understand another’s code, making assumptions about library and function/method calls based on names and such, until you can go back and make sure those calls do what you assumed they did.
This has been the question I have been working on answering for the last 10+ years. I do not have a good answer, especially because I am not a good teacher. Specifically I am not good at presenting loads of information in a format that makes it easier to understand. I can however explain concepts and answer specific questions. So for 3468, its mostly come down to, those who are self-motivated will spend the time on their own figuring things out and asking questions, and the rest will either limp along until enough sinks in, or leave the programming department. I wish I could increase the retention of our rookie members, but sadly as a Mentor, I just do not have the time or resources to do so.
Devices on a CAN Bus take turns sending and receiving data. When you are sending so much data that not everything can be transmitted in a timely manner, you are saturating the bus. You can also negatively impact this phenomenon if your bus isn’t properly biased (missing the terminating resistors), is extremely long, or has long extensions off the “main bus” that can introduce signal reflections which slows how quickly data can be sent because extra effort is spent understanding the data.
Physically, making sure your CAN Bus is properly terminated, is as short as is reasonable, and any stubs/extensions off the main bus are as short as possible can all improve the overall performance of the bus. In Software, limiting the amount of CAN Data send can alleviate an overload. Common examples include sending the same setpoint over and over every loop, or reading sensor data every loop. Slowing those actions down can greatly reduce the load on the Bus.
There are several ways this can be done. The way I’ve always done is using a Library like GitHub - MHeironimus/ArduinoJoystickLibrary at version-2.0 to make an Arduino emulate a HID Joystick with code like this from 3468’s 2020 code InfiniteRecharge/arduino_gamepad/InfiniteRechargeOperatorConsoleGamepad/InfiniteRechargeOperatorConsoleGamepad.ino at master · frc3468/InfiniteRecharge · GitHub
Just make sure you are using the correct type of Arduino for the Library. Usually you need one of the ATMega32U4 based board like the Leonardo or Pro Micro.
PID/F is just a control loop system for attempting to reach a setpoint. There are other algorithms that attempt the same thing such as bang-bang. The term “setpoint” is independent of PID, though within FRC, I’ve only once seen anyone using any control loop mechanism that wasn’t PID or Bang-Bang. If you are talking about giving a motor a setpoint over CAN, then generally in that case you are using a PID Controller that is running on the Motor Controller itself, refer to the docs for the relevant Motor Controller.
I assume you mean splitting up the coding work? A Kanban board can be a good way to split up tasks for the robot/code and keep each person working on one thing at a time. Think like a bunch of sticky notes, one for each task, with columns for TODO, IN PROGRESS, and DONE that you move the sticky notes between as they are worked.
This tends to be very difficult unless you happen to have the parent of a member who is a programmer. You could try reaching out to any local companies that you know would do some amount of programming and ask them if they’d ask if any of their employees would be interested.
I have been the sole Programming Mentor in Northeast Louisiana for the last 9 years, which at one point consisted of 5 teams, of which I tried to help all as much as I could. This is the first year I have a second Programming Mentor on 3468, but I am also working equally with another Rookie team in the region, and she will be moving out of state after this year. After which point, we’ll be back to one. I’ve tried inviting and even guilting co-workers and friends into joining, but most just aren’t interested either because they don’t want to work with kids, or they don’t want to put in the time investment.