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

nMotorEncoderTarget[] not working..
http://robotc.net/forums/viewtopic.php?f=52&t=2774
Page 3 of 3

Author:  hongyeus [ Sun Mar 17, 2013 12:44 pm ]
Post subject:  Re: nMotorEncoderTarget[] not working..

I am still experiencing the same problems outlined above and I am on the updated RobotC 3.54 version.

I am using the nMotorEncoderTarget[] function with the while loop, but the robot just keeps going forward indefinitely( I used the debug stream also and I see that my encoder values are reading, and they keep going on past the targeted value).

Is anyone else having these problems/know the fix?

Author:  SergeantFTC [ Tue Mar 19, 2013 4:42 pm ]
Post subject:  Re: nMotorEncoderTarget[] not working..

Same issue on RobotC 3.55.2 beta. (I know there's a new beta, we'll be updating soon)

Author:  JohnWatson [ Mon Mar 25, 2013 4:09 pm ]
Post subject:  Re: nMotorEncoderTarget[] not working..

hongyeus wrote:
I am still experiencing the same problems outlined above and I am on the updated RobotC 3.54 version.

I am using the nMotorEncoderTarget[] function with the while loop, but the robot just keeps going forward indefinitely( I used the debug stream also and I see that my encoder values are reading, and they keep going on past the targeted value).

Is anyone else having these problems/know the fix?



SergeantFTC wrote:
Same issue on RobotC 3.55.2 beta. (I know there's a new beta, we'll be updating soon)


Would you be willing to post the simplest form of code that can replicate the problem (meaning, not a full competition program, just a program that can replicate the issue) using the [code] tags? This way we will be able to see if it is a coding issue or a different underlying issue.

Thank you in advance!

Author:  SergeantFTC [ Mon Mar 25, 2013 6:08 pm ]
Post subject:  Re: nMotorEncoderTarget[] not working..

We had PID disabled. Enabling it fixed the problem. I think. We've since moved on to a different solution not using nMotorEncoderTarget. Is it supposed to require PID?

Author:  WilliamB7664 [ Sun Jan 19, 2014 9:50 pm ]
Post subject:  Re: nMotorEncoderTarget[] not working..

The nMotorEncoderTarget[] command still does not work in version 3.62 for Matrix motors.
If we run it, the motor doesn't move. While it is running and you manually move the motor, it will fight you and return to its previous position when you let go. If we stop the program in the debugger and manually move the motor, and then restart the program, the motor will return to its previous position.
Code:
#pragma config(Hubs,  S1, MatrxRbtcs, none,     none,     none)
#pragma config(Hubs,  S2, MatrxRbtcs, none,     none,     none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Sensor, S2,     ,               sensorI2CMuxController)
#pragma config(Motor,  mtr_Matrix_S1_1, motorD,        tmotorMatrix, openLoop)
#pragma config(Motor,  mtr_Matrix_S1_2, motorE,        tmotorMatrix, openLoop)
#pragma config(Motor,  mtr_Matrix_S1_3, motorF,        tmotorMatrix, openLoop)
#pragma config(Motor,  mtr_Matrix_S1_4, motorG,        tmotorMatrix, openLoop)
#pragma config(Motor,  mtr_Matrix_S2_1, motorH,        tmotorMatrix, openLoop)
#pragma config(Motor,  mtr_Matrix_S2_2, motorI,        tmotorMatrix, openLoop)
#pragma config(Motor,  mtr_Matrix_S2_3, EncoderTestMotor, tmotorMatrix, PIDControl, encoder)
#pragma config(Motor,  mtr_Matrix_S2_4, motorK,        tmotorMatrix, openLoop)
#pragma config(Servo,  srvo_Matrix_S1_1, servo1,               tServoNone)
#pragma config(Servo,  srvo_Matrix_S1_2, servo2,               tServoNone)
#pragma config(Servo,  srvo_Matrix_S1_3, servo3,               tServoNone)
#pragma config(Servo,  srvo_Matrix_S1_4, servo4,               tServoNone)
#pragma config(Servo,  srvo_Matrix_S2_1, servo5,               tServoNone)
#pragma config(Servo,  srvo_Matrix_S2_2, servo6,               tServoNone)
#pragma config(Servo,  srvo_Matrix_S2_3, servo7,               tServoNone)
#pragma config(Servo,  srvo_Matrix_S2_4, servo8,               tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "joystickDriver.c"

task main()
{
nMotorEncoder[EncoderTestMotor] = 0;
nMotorEncoderTarget[EncoderTestMotor] = 720;
motor[EncoderTestMotor] = 75;
while(nMotorRunState[EncoderTestMotor] != runStateIdle)  // while Motor B is still running:
{
     //do not continue sequential execution
}
motor[EncoderTestMotor] = 0;
}

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