ROBOTC.net forums
http://www.robotc.net/forums/

Could someone help me understand what I'm doing wrong?
http://www.robotc.net/forums/viewtopic.php?f=55&t=3771
Page 1 of 1

Author:  PanthersRage [ Mon Nov 21, 2011 9:19 pm ]
Post subject:  Could someone help me understand what I'm doing wrong?

I am currently unable to work on my auntonomous program because I am waiting on the Robot to be finished and my coach to order a new lincence for the year...So I've been trying to work out (at least a general pathway) from within the Robot Virtual Worlds. I am currently on a 60 day trial and just trying to get a feel for it.

Here is my problem: It isn't working.

I made a basic program just to test out, and the virtual world will open, but my Robot won't move...could anybody help me?

Thanks for any of the responces...Enjoy your Thanksgivings!

Here is my code:

#pragma config(Hubs, S1, HTMotor, HTServo, none, none)
#pragma config(Sensor, S1, touch, sensorI2CMuxController)
#pragma config(Sensor, S2, compass, sensorNone)
#pragma config(Sensor, S3, light, sensorNone)
#pragma config(Sensor, S4, sonar, sensorNone)
#pragma config(Motor, mtr_S1_C1_1, leftmotor, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C1_2, rightmotor, tmotorNormal, openLoop)
#pragma config(Servo, srvo_S1_C2_1, servo1, tServoNone)
#pragma config(Servo, srvo_S1_C2_2, servo2, tServoNone)
#pragma config(Servo, srvo_S1_C2_3, servo3, tServoNone)
#pragma config(Servo, srvo_S1_C2_4, servo4, tServoNone)
#pragma config(Servo, srvo_S1_C2_5, servo5, tServoNone)
#pragma config(Servo, srvo_S1_C2_6, servo6, tServoNone)

task main()
{

{
motor[mtr_S1_C1_1] = 50; // leftmotor is to run at a power level of 50.
motor[mtr_S1_C1_2] = 50; // rightmotor is to run at a power level of 50.
wait1Msec(1000); // The program waits 1000 milliseconds (1 seconds) before running further code
}
{
motor[mtr_S1_C1_1] = 0;
motor[mtr_S1_C1_2] = 50;
wait1Msec(1000);
}
}

(I also have tryed Textrix Moving Forward as a sample program, but still nothing)

Author:  magicode [ Tue Nov 22, 2011 1:13 am ]
Post subject:  Re: Could someone help me understanfd what I'm doing wrong?

Try using motor[leftmotor] and motor[rightmotor] instead of your current calls.

Author:  PanthersRage [ Thu Nov 24, 2011 11:25 pm ]
Post subject:  Re: Could someone help me understand what I'm doing wrong?

Nope. Still not responding when I hit "run RobotC program." Thanx for the suggestion though!

Any other thoughts?

Author:  rshoop [ Mon Nov 28, 2011 12:53 pm ]
Post subject:  Re: Could someone help me understand what I'm doing wrong?

I copied and pasted your code and my Tetrix robot moved. Have you selected the correct platform type. Go to Robot/PlatformType/LEGO MINDSTORMS NXT + TETRIX.

Author:  PanthersRage [ Mon Nov 28, 2011 10:25 pm ]
Post subject:  Re: Could someone help me understand what I'm doing wrong?

Alright guys. Thank you for the help. the Virtual Robot now moves, but instead of the set amount it just kind of crawl a couple inches.

Any idea what that could be? Thanks guys!!

Author:  Ed Paradis [ Thu Jan 12, 2012 11:36 am ]
Post subject:  Re: Could someone help me understand what I'm doing wrong?

In your code, you turn the motors on to about half speed for one second. If you'd like to travel a certain distance, you should use the encoders to measure how many times the wheels have turned.

Try looking at the sample code provided with ROBOTC in the file "Forward for Distance.c". You'll want to use the one in the "Virtual Worlds\Shaft Encoder\" folder.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/