Go to Post Wow, what a regional at St. Louis! ... It's gonna be a good year for FIRST. - Andy Baker [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-12-2014, 20:09
FRC Team CC FRC Team CC is offline
Registered User
FRC #6560 (Charging Champions)
 
Join Date: Sep 2014
Rookie Year: 2012
Location: Southern California
Posts: 107
FRC Team CC is an unknown quantity at this point
[FTC]: Programming a TETRIX Encoder - Wheel Problem

Hey Chief Delphi,

Today we were testing the beginning portion of our autonomous program, where the robot drives off the ramp. The robot was not going down straight, so we added PIDControl to the pragmas. Although it went down straight this time, it kept going for an unlimited amount of time. In addition, it did not go at the speed that we wanted it to go - it just went at full power.

Code:
#pragma config(Hubs,  S1, HTMotor,  HTMotor,  HTServo,  HTMotor)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Sensor, S2,     HTIRS2,         sensorI2CCustom)
#pragma config(Motor,  mtr_S1_C1_1,     rightTopDrive, tmotorTetrix, PIDControl)
#pragma config(Motor,  mtr_S1_C1_2,     rightBottomDrive, tmotorTetrix, PIDControl)
#pragma config(Motor,  mtr_S1_C4_1,     leftBottomDrive, tmotorTetrix, PIDControl, reversed)
#pragma config(Motor,  mtr_S1_C4_2,     leftTopDrive,  tmotorTetrix, PIDControl, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

i = 0;
task main ()
{
while(i < 7)
	{
		motor[leftBottomDrive] = 5;
		motor[rightBottomDrive] = 5;
		motor[leftTopDrive]=5;
		motor[rightTopDrive]=5;
		wait10Msec(40);
		i = i + 1;
	}
		motor[leftBottomDrive]=0;
		motor[rightBottomDrive]=0;
		motor[leftTopDrive]=0;
		motor[rightTopDrive]=0;
		i = 0;

}
Is it an issue with the program, and if so, what should be fixed?

Also, we were wondering how to program the robot with encoders (on the back wheels). Using the pragmas from the program above, can you create a sample program which tells the robot to move forward for 2 feet (wheel diameter 3.96 in)?

All help is appreciated.

Thanks,
Charging Champions
Reply With Quote
  #2   Spotlight this post!  
Unread 27-01-2015, 15:57
ForgotSemicolon's Avatar
ForgotSemicolon ForgotSemicolon is offline
I always forget those semicolons.
FTC #5998 (Ultraviolet)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Texas
Posts: 12
ForgotSemicolon is an unknown quantity at this point
Re: [FTC]: Programming a TETRIX Encoder - Wheel Problem

Hi Charging Champions!
I would recommend a function like the one below to use encoders.

void forward( int rotations, int power ){
motor[motor1] = 0;
motor[motor2] = 0;
//Resets the motor encoder readings.
while( nMotorEncoder[motor1] < rotations ){
motor[motor1] = power;
motor[motor2] = power;
}//goes forward until one of the two sides has rotated enough
}

Be sure to remember that it takes a lot of rotations to travel any distance at all!
Good Luck!
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:13.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi