RobotDrive

Ive Created a RobotDrive with 4 controllers, and associated it to a Joystick. I do have 2 Victors that are working, which should be my left side. I have tested them with code using the set(.50) and they both work.

drive = new RobotDrive(vic01, vic02, vic03, vic04)
drive.arcadeDrive(stick);

when I go into teleop mode, I get a message “Robot Drive… Output not updated enough”

  1. I do not have vic03, or vic04 connected. (Assuming that the left side should work regardless of the right side failure.
  2. Im assuming that associating a drive with controllers and then associating a Joystick to the drive is going to automatically allow me to control movement of my motors.
  3. Im assuming that I will not have to capture inputs from the joystick and translate them myself to the motors.
  4. I have opened the SRC of the edu.wpi.first libs and searched for this message. I could not find it anywhere. What is the standard logging mechanism that writes to the Riolog? (System.out, Log4j, Other?)

Try disabling the safety on the RobotDrive with

drive.setSafetyEnabled(false)

This is the timeout between updates of the RobotDrive. It really isn’t super important to keep it enabled, but if you want to enable it, then try timing your code and set the timeout longer than the loop that is calling arcade drive.

About the RioLog, anything printed to stdout or stderror will appear in the log.

So that solved my “Robot Drive… Output not updated enough” issue and I did find that message in MotorSafetyHelper, so I was close,

But what about 2, and 3

  1. Im assuming that associating a drive with controllers and then associating a Joystick to the drive is going to automatically allow me to control movement of my motors.
  2. Im assuming that I will not have to capture inputs from the joystick and translate them myself to the motors.

Yes, the code you have should allow you to drive with that Joystick. You should not have to manually write code to get stick values then write them to the motors. Robot drive will do this for you.

Now that Im reading further into the demos, it looks like you do have to keep pulling the value of the

  1. Im assuming that associating a drive with controllers and then associating a Joystick to the drive is going to automatically allow me to control movement of my motors. (FALSE)
  2. Im assuming that I will not have to capture inputs from the joystick and translate them myself to the motors. (FALSE)

In the operatorControl method, they are looping and polling. I thought it was going to be more event driven.

Those assumptions are incorrect. Every time you call drive.arcadeDrive, it will update the speed controllers with the new values. The drive methods that take a joystick are simply convenience methods that save you the step of getting the joystick axes and passing them into the RobotDrive object. With safety off, the motors will continue to drive at the last set speed until you disable the robot or it runs out of power.

just to make sure, you aren’t calling the constructor (drive = new RobotDrive(vic01, vic02, vic03, vic04) every time in the loop, you just have that once in robotInit()?