|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: [cRIO] Robot Drive... Output not updated often enough.
I went thru all the things that you all suggested (thank you) but still the same problem shows up.
Any other suggestions would be appreciated... |
|
#2
|
|||||
|
|||||
|
Re: [cRIO] Robot Drive... Output not updated often enough.
Can you post your updated code so we can see what you changed?
|
|
#3
|
|||
|
|||
|
Re: [cRIO] Robot Drive... Output not updated often enough.
Here is the new code:
Code:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Joystick;
public class RobotTemplate extends SimpleRobot
{
private RobotDrive drivetrain;
private Joystick mainStick;
public RobotTemplate()
{
drivetrain = new RobotDrive(1, 2); // create RobotDrive
mainStick = new Joystick(1); // and joysticks
}
public void autonomous() {
for (int i = 0; i < 4; i++) {
drivetrain.drive(0.5, 0.0); // drive 50% forward with 0% turn
Timer.delay(2.0); // wait 2 seconds
drivetrain.drive(0.0, 0.75); // drive 0% forward and 75% turn
}
drivetrain.drive(0.0, 0.0); // drive 0% forward, 0% turn (stop)
}
public void OperatorControl()
{
while (true && isOperatorControl() && isEnabled())
{
drivetrain.arcadeDrive(mainStick);// drive w/joysticks
Timer.delay(0.02);
}
}
}
|
|
#4
|
||||
|
||||
|
Re: [cRIO] Robot Drive... Output not updated often enough.
Quote:
Also, the initial part of that while condition does absolutely nothing. |
|
#5
|
|||
|
|||
|
Re: [cRIO] Robot Drive... Output not updated often enough.
Can you please explain what you mean by that.
|
|
#6
|
||||
|
||||
|
Re: [cRIO] Robot Drive... Output not updated often enough.
Just that putting
Code:
true && |
|
#7
|
|||
|
|||
|
Re: [cRIO] Robot Drive... Output not updated often enough.
Ok so thank you for all your help. We fixed our problem by changing our code. The new code is posted below. But now the problem is that when we turn the joystick left the robot goes right and vice-versa. Though it goes back and forth perfectly. Any input would be appreciated. When running the program no errors show up.
Code:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
public class RobotTemplate extends SimpleRobot {
RobotDrive chassis = new RobotDrive(1,2);
Joystick mainStick = new Joystick(1);
public void autonomous() {
}
public void operatorControl() {
chassis.setSafetyEnabled(true);
while (isOperatorControl() && isEnabled()) {
double speed;
double rot;
speed = mainStick.getY();
rot = mainStick.getX();
chassis.arcadeDrive (speed, rot);
}
}
public void test() {
}
}
|
|
#8
|
||||
|
||||
|
Re: [cRIO] Robot Drive... Output not updated often enough.
How can this work with the following addresses? Did you fix this?
... Host JVM: Java HotSpot(TM) Client VM 24.51-b03 Target IP: 10.49.39.2 Network interfaces on host: Intel(R) Centrino(R) Wireless-N 2200: address: 10.49.39.64 netmask: 255.255.255.254 WARNING: Host is not on same subnet as robot. May not be able to complete all communication with robot. ... Your computer (if you are also running the driver station) needs to be 10.49.39.5 or 10.49.39.9 and the netmask wide enough to cover all the relevant addresses, so maybe 255.255.255.0 or wider. If another computer is used as the DS you still need to fix that netmask. HTH |
|
#9
|
|||
|
|||
|
Re: [cRIO] Robot Drive... Output not updated often enough.
I'm not sure what you mean, could you please expand. If you are talking about changing the IP address when transferring code and using the driver station we make sure of this every time. We use the classmates for the driver stations and personal laptops for running the code.
|
|
#10
|
||||
|
||||
|
Re: [cRIO] Robot Drive... Output not updated often enough.
Quote:
HTH |
|
#11
|
||||
|
||||
|
Re: [cRIO] Robot Drive... Output not updated often enough.
Quote:
A quick fix for your turning backwardness is to invert the sign of your stick values (value * -1): Code:
rot = -mainStick.getX(); Last edited by Ty Tremblay : 04-02-2014 at 16:24. |
|
#12
|
|||
|
|||
|
Re: [cRIO] Robot Drive... Output not updated often enough.
Thank you everybody we were able to fix our problems. We really appreciate it.
|
|
#13
|
||||
|
||||
|
Re: [cRIO] Robot Drive... Output not updated often enough.
Good luck!
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|