Joined: Fri Nov 18, 2011 1:59 pm
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)
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;
(I also have tryed Textrix Moving Forward as a sample program, but still nothing)
Last edited by PanthersRage on Thu Nov 24, 2011 11:24 pm, edited 1 time in total.
Joined: Mon Feb 14, 2011 10:37 am
Location: The Pitts(burgh)
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.
Robot Virtual Worlds Technical Lead
Robotics Academy - CMU