View unanswered posts | View active topics It is currently Wed Sep 23, 2020 2:56 pm

Reply to topic  [ 1 post ] 
tetrix PID motor controller question 
Author Message

Joined: Thu Jan 21, 2010 3:08 pm
Posts: 2
Post tetrix PID motor controller question
I want to be able to determine how far my robot goes based on the PID control in the tetrix motors. Is this like the NXT motor, where it polls how many degrees of rotation the motor has gone? Is this possible, and if so, what is wrong with my code?

#pragma config(Hubs, S1, HTMotor, HTServo, HTMotor, none)
#pragma config(Sensor, S2, ultra, sensorSONAR)
#pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C3_1, motorF, tmotorNormal, PIDControl, encoder)
#pragma config(Motor, mtr_S1_C3_2, motorG, tmotorNormal, PIDControl, encoder)
#pragma config(Servo, srvo_S1_C2_1, , tServoNormal)
#include "JoystickDriver.c"

void initializeRobot()
servo[servo1] = 80;

void move (int x, int y);
void move (int x, int y)
int target1;
target1 = x * 360 / 12.56;
nMotorEncoder[motorF] = 0;
nMotorEncoderTarget[motorF] = target1;
motor[motorF] = -y;
int target2;
target2 = x * 360 / 12.56;
nMotorEncoder[motorG] = 0;
nMotorEncoderTarget[motorG] = -target2;
motor[motorG] = y;

task main()

while (true)
move (20,-100);

Fri Jan 22, 2010 10:09 am
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

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.