Yes, I have posted about each of these things separately before. But the problems persist.
No, I still have not read the rulebook. I know I should have long ago, but it is too late now.
Our team is doomed if we can’t figure these things out.
Are you using the Logitech “fakebox” controller that came with the Rookie Starter Kit? If so, do you know what numbers correspond to what buttons? I got this from my last post, but it is not accurate with our controller; for instance, our A button is 6, not 0. Is there a way to set those numbers somehow, or a place where I can see them all?
Do you use AndyMark actuators on your robot? The .set() method of the Servo class does not seem to work for us, even when we put it in RobotInit rather than a button press.
Bottom line: You can see the button numbers for any controller by plugging it into your driver station and going to the USB tab. Select the controller you need to characterize and as you press the buttons and move the joysticks the display will show you what button number and joystick axis is being used.
Code like the following will probably not behave properly if you keep the button down for more than 20ms (highly likely).
// Toggle the tulip's position
if (A.get()) {
if (tulipPos == 0.5) {
tulipPos = 1;
}
else {
tulipPos = 0.5;
}
tulip.set(tulipPos);
}
The teleopPeriodic() method is called every 20ms by default and the code shown here will, as long as the button is held, toggle the setting for tulip back and forth. This is probably not what you want. The last time through with the button down will win.
You probably just want to change state if the value of A.get() is true and different from the last cycle. You want something more like this.
// Toggle the tulip's position
if (A.get()) {
if (!lastTime) {
lastTime = true;
if (tulipPos == 0.5) {
tulipPos = 1;
}
else {
tulipPos = 0.5;
}
tulip.set(tulipPos);
}
}
else {
lastTime = false;
}
I think so. Although, ours has little triangles on the Start and Back buttons that don’t show up in any other pictures.
What’s wrong with the indentation?
What do you mean? For the buttons, they give an error in the RioLog when they are not set to the correct number. For the actuator, it just doesn’t work. Here’s a picture of it:
That is a very good point. I don’t think it’s the problem, because we tried the .set() in the RobotInit not tied to any buttons, but it was definitely a problem. Thank you!
Looking at the link you provided for button mapping, it appears to have multiple modes which change button configuration. Can you make sure that it is in the correct mod (X/D switch on back, and mode light)?
curses at window’s built in code reader Nothing, it was just not displaying right for me. It actually is better than our code…
Waz’s suggestion is an important one to make sure to implement, but since you said it wasn’t the full cause… Try instead of putting the code in robot init (since most controllers are disabled when the robot is disabled) put it in teleopInit and do tulip.set(1.0); If that works make sure 0.0 works. If those do then it must be something with the triggering code, if it doesn’t work then it may be electrical or mechanical.