View unanswered posts | View active topics It is currently Thu Jul 24, 2014 5:18 am






Reply to topic  [ 7 posts ] 
Robot only runs when plugged into comp. w/ USB to Serial 
Author Message
Rookie
User avatar

Joined: Wed Jan 25, 2012 1:44 pm
Posts: 4
Post Robot only runs when plugged into comp. w/ USB to Serial
My class is using RobotC 1.08 on computers running Windows XP. One of the students squarebot w/ PIC will only run while it is connected to the computer. This problem persists on more then one computer. We tried reloading the firmware, but no difference.

_________________
Riedinger
Reseda Regents Robotics
R cubed
VEX Team 20
FRC 2584


Wed Jan 25, 2012 2:37 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: Robot only runs when plugged into comp. w/ USB to Serial
It would help to give more details. What exactly are you doing?

_________________
sudo rm -rf /


Wed Jan 25, 2012 4:10 pm
Profile
Rookie
User avatar

Joined: Wed Jan 25, 2012 1:44 pm
Posts: 4
Post Re: Robot only runs when plugged into comp. w/ USB to Serial
The robot has a sonar sensor on the front. The goal is to drive forward to within 5 inches from a barrier, turn 180 degrees,and then return to the starting area until another barrier is detected and stop. Would you like to see the code? The students have left but I could rewrite it myself.

_________________
Riedinger
Reseda Regents Robotics
R cubed
VEX Team 20
FRC 2584


Wed Jan 25, 2012 5:39 pm
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 403
Post Re: Robot only runs when plugged into comp. w/ USB to Serial
Try going to Robot > VEX Cortex Download Method, and choosing "Download using USB Only". Then redownload your program, and turn the robot off and back on. Your program should then immediately run any time you turn the robot on.

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Thu Jan 26, 2012 12:41 pm
Profile
Rookie
User avatar

Joined: Wed Jan 25, 2012 1:44 pm
Posts: 4
Post Re: Robot only runs when plugged into comp. w/ USB to Serial
My students are not using a cortex, they are using a PIC. Two of our robots are having this problem.

_________________
Riedinger
Reseda Regents Robotics
R cubed
VEX Team 20
FRC 2584


Thu Jan 26, 2012 3:17 pm
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 403
Post Re: Robot only runs when plugged into comp. w/ USB to Serial
Sonar sensors return a value of -1 when they don't get a sound echo. Sound takes time to travel, so for the first fraction of a second of any program, the sensor value will be -1 until the sensor gets a sound echo.

If the first thing in your program happens to be something along the lines of...

while(SensorValue[sonar] > 5)
{
}

...this condition will never be met, since it will have a value of -1. If this is the problem, you can fix the condition or put a brief wait statement at the beginning. If you go here: http://www.robotc.net/vex_full/ to the Sensing > Ultrasonic section, you'll find some tutorials that might help.

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Thu Jan 26, 2012 3:22 pm
Profile
Rookie
User avatar

Joined: Wed Jan 25, 2012 1:44 pm
Posts: 4
Post Re: Robot only runs when plugged into comp. w/ USB to Serial
jbflot wrote:
Sonar sensors return a value of -1 when they don't get a sound echo. Sound takes time to travel, so for the first fraction of a second of any program, the sensor value will be -1 until the sensor gets a sound echo.


Yes we realized this last week, the sonar was not working till we made this change. Here is the code we are using.

const tSensors sonarSensor = (tSensors) in5; //sensorSONAR //*!!!!*//
//*!!CLICK to edit 'wizard' created sensor & motor configuration. !!*//

task main ()
{
wait1Msec(2000);
bMotorReflected[port2] = 1;

while (SensorValue[sonarSensor] > 5 || SensorValue[sonarSensor] < 0 ) // drive to far wall
{
motor [port2] = 63;
motor [port3] = 63;
}

motor [port2] = 0; //pause
motor [port3] = 0;
wait1Msec(500);

motor [port2] = 63; //turn 180
motor [port3] = -63;
wait1Msec(1143);

while (SensorValue[sonarSensor] > 5 || SensorValue[sonarSensor] == -1) // drive to near wall
{
motor [port2] = 63;
motor [port3] = 63;
}

}

While hooked to the computer, the program runs well. First the time delay, then the first while loop until we trigger the sensor, then the turn, then the last while loop. When off the computer it just does the "wait1Msec(2000);" and the turn.

_________________
Riedinger
Reseda Regents Robotics
R cubed
VEX Team 20
FRC 2584


Fri Jan 27, 2012 5:24 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.