View unanswered posts | View active topics It is currently Sun Apr 20, 2014 6:23 pm






Reply to topic  [ 6 posts ] 
Could someone help me understand what I'm doing wrong? 
Author Message
Rookie

Joined: Fri Nov 18, 2011 1:59 pm
Posts: 6
Post 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)


Last edited by PanthersRage on Thu Nov 24, 2011 11:24 pm, edited 1 time in total.



Mon Nov 21, 2011 9:19 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: Could someone help me understanfd what I'm doing wrong?
Try using motor[leftmotor] and motor[rightmotor] instead of your current calls.

_________________
sudo rm -rf /


Tue Nov 22, 2011 1:13 am
Profile
Rookie

Joined: Fri Nov 18, 2011 1:59 pm
Posts: 6
Post 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?


Thu Nov 24, 2011 11:25 pm
Profile
Site Admin
Site Admin

Joined: Wed Feb 21, 2007 6:09 pm
Posts: 31
Post 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.


Mon Nov 28, 2011 12:53 pm
Profile
Rookie

Joined: Fri Nov 18, 2011 1:59 pm
Posts: 6
Post 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!!


Mon Nov 28, 2011 10:25 pm
Profile
Rookie
User avatar

Joined: Mon Feb 14, 2011 10:37 am
Posts: 49
Location: The Pitts(burgh)
Post 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


Thu Jan 12, 2012 11:36 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 6 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.