![]() |
Issue with autonomous mode and some newbie questions
Hi,
Our code for autonomous is not working properly. We programmed the robot to drive straight for 3 seconds and then stop. Instead of driving forward for 3 seconds and then stopping, the robot waits 10 seconds and drives forward for half a second, then waits another 10 seconds and then drives forward for half a second. We believe that it has to be something wrong with feeding the watchdog since we receive the watchdog not fed error on the dashboard. 4 Questions. 1. Could anyone take a look at the code below and tell us what our problem is with the autonomous code? 2. Also, if someone could take a look at our line sensor code to see if it will work or not, that would be great :) 3. I'm new to netbeans, how do you save as project (not .java file) on a usb drive or on a different location from where it was originally saved? 4. How can I debug the code using System.out.println? It never prints out anything. Are there other ways for debugging the code or knowing what values you get from sensors? Code:
package edu.wpi.first.wpilibj.templates; |
Re: Issue with autonomous mode and some newbie questions
Your problem lies here:
Code:
for(int i =0; i < 10; i=+1){Code:
Timer timer = new Timer(); // you should put this in your constructor. |
Re: Issue with autonomous mode and some newbie questions
Quote:
I think the issue is that the watchdog is not being fed during the pause so the robot shuts down. Could this be the issue and how could it be fixed? |
Re: Issue with autonomous mode and some newbie questions
email me at mwtidd@gmail.com
I converted your code to my ADK which does most the work for you. Lets you focus on the important stuff. |
Re: Issue with autonomous mode and some newbie questions
Quote:
Code:
Watchdog.getInstance().setEnabled(false); |
Re: Issue with autonomous mode and some newbie questions
Thanks for the help. I will let you know how it goes when I test out the code on Monday.
Can someone answer questions 3 & 4 in the first post? 3. How do you save as project (not .java file) on a usb drive or on a different location from where it was originally saved? 4. How can I debug the code using System.out.println? It never prints out anything. Are there other ways for debugging the code or knowing what values you get from sensors? |
Re: Issue with autonomous mode and some newbie questions
Quote:
The System.out.println function output should show right up in the Netconsole. Are you getting any output in the Netconsole (e.g. the cRIO spitting out all its boot up stuff)? |
Re: Issue with autonomous mode and some newbie questions
Quote:
4.) println will print to the netconsole (eg the output section of netbeans while it is running). If you don't see output you may need to check your subnet mask. If it is not 255.0.0.0 then you will not see output from the robot. I also agree that it appears that you are tripping the watchdog. You set the watchdog to get hungry every 0.5 seconds but only feed it every 3. |
Re: Issue with autonomous mode and some newbie questions
4) I use to stop my builds before switching over to the driver station. I actually only (very) recently discovered that I can keep it running to debug my code! :eek:
So to answer your question, let's say I have a teleop function like so: Code:
public void operatorControl() { |
| All times are GMT -5. The time now is 22:17. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi