C++ motor assignments

I am new to c++ and I’m trying to figure out how to use two different types of motor controllers on a 4 wheel base. I know how to do it in LabVIEW and am curious if i can do it in C++. Thanks for the help!!

Below is what I’m talking about in LabVIEW so hopefully its easier to understand what I’m asking.





You definitely can, but posting code of why you can’t do it it always helpful. From an electrical perspective, this is a TERRIBLE idea. I can’t tell what configuration you have them in here, but it’s most likely one of two situations:

  1. One Type of motor controller for each drive side. This means that you will not drive straight. Both the SRX and SR are fairly linear (compared to some worse off offenders cough victor 888 cough), but you will never be able to drive straight. For autonomous, your encoders are going to do extra works that you don’t need them to do, and driving in teleop can be harder as well.
  2. One motor controller of each type on each side. This means that if they aren’t outputting the same voltage, one of the motors is getting back driven (maybe a better word, reverse stalling?) and can get damaged over time because of this. It’s not a great idea as it also draws more current because one motor is stalled and the other is getting back driven.

If you are REALLY content on this, it’s fairly simple. Just declare your various types of motor controllers, then put those four (or two) motor controllers into the RobotDrive constructor class. See more here: https://wpilib.screenstepslive.com/s/4485/m/13810/l/241857-getting-your-robot-to-drive-with-the-robotdrive-class

I plan on using the motors in a 4 wheel drive mecanum base. The configuration is going to be cross. Mecanum wheels by default are crossed so I saw no harm in doing the same with the motor controllers. If there is a true issue with this other than prolonged use can cause then I will look over other possibilities. Thanks for the response!

Mecanum wheels are a little different. I guess it was bad of me for assuming tank drive. With mecanum drives, there’s significantly less issue than a tank drive. Because each one is on rollers, you don’t have issues of stalling and back driving that you would with the second example up there. You still have issues with potentially offset voltage, but that’s pretty easy to solve with a encoder on each wheel. That’s expensive, and you might as well just buy more motor controllers with that money, but it’ll work. Good luck with your project!

Alright thanks! Well our team is currently breaking off into 3 groups and we are building 2 KOP drop six bases and one mecanum to teach the new people how stuff works. So I thought by using TalonSR’s for PWMs and TalonSRX’s for can would teach mechanical, electrical, and programming the disadvantages, advantages, and how to do both types of motor controllers.

(Yes I said drop 6 and we are only using one cim for each gear box on those. I understand they will drift and I planed to use that to my advantage because it would throw in a curveball that the new programmers would have to figure out how to get around in the fastest and easiest time possible. A good prep. for build season :slight_smile: :smiley: :stuck_out_tongue: )