RobotC firmware enters a motor in "active PID regulation mode" when both nEncoderTarget value is set and motor power is set. RobotC firmware exits a motor of "active PID regulation mode" when nEncoderTarget value is reached.

1. Does RobotC firmware exits a motor of "active PID regulation mode" if motor power is changed ? (ie to go slower)

Code:

nMotorEncoder[motorB] = 0; // Reset the Motor Encoder of Motor B.nMotorEncoderTarget[motorB] = 360; // Set the target for Motor Encoder of Motor B to 360.motor[motorB] = 75; // Motor B is run at a power level of 75.wait1Msec(1);motor[motorB] = 50;; // Motor B is run at a power level of 50. DOES THE POWER CHANGE MODIFY FIRMWARE REGULATION ???while(nMotorRunState[motorB] != runStateIdle); motor[motorB] = 0; // Motor B is stopped at a power level of 0.

2. Does RobotC firmware exits a motor of "active PID regulation mode" if motor power is stopped the restarted ?

Code:

nMotorEncoder[motorB] = 0; // Reset the Motor Encoder of Motor B.nMotorEncoderTarget[motorB] = 360; // Set the target for Motor Encoder of Motor B to 360.motor[motorB] = 75; // Motor B is run at a power level of 75.wait1Msec(1);motor[motorB] = 0; // Motor B is run at a power level of 0. DOES THE MOTOR STOP CANCEL µTHE PREVIOUS GOAL (REACH 360) ???wait1Msec(1);motor[motorB] = 75; // Motor B is run at a power level of 75. DOES THE FIRMWARE MAINTAIN ITS PREVIOUS GOAL (REACH 360) ???while(nMotorRunState[motorB] != runStateIdle); motor[motorB] = 0; // Motor B is stopped at a power level of 0.

3. What are all conditions possible to cancel the nEncoderTarget ( except to reach it )4. Is there a safe way to abort a nEncoderTarget while motor is turning and target is not reached ?.

Thank you for your help.Miki.

I think that your first two statements are wrong. It's my understanding that PID is on only when you've set it to be on, and off when you've set it to be off. But, I might be wrong.

My answers to your questions (again, these are just my answers, take them as you will. ):

1. If by regulation you mean the PID, then no. The PID just tries to keep the motor going at the speed you set.2. It doesn't cancel the target. That code is fine. (as far as I know)3. None, I think (other than writing a new target).4. I'm not exactly sure what you mean. Could you possibly explain better?

Anyway, these are correct as far as I know. Do they satisfy?

_________________A.K.A. inxt-generationSelf-proclaimed genius, and future world dominator.My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth DoctorBow down to Nikola Tesla, King of the Geek Gods.

I set the motor to turn until an encoder target is reached AND while a Contact Sensor is not pressed.A contact occurs on sensor (the robot front bumper) and I stop the motor. Internally, the firmware keeps the encoder target set.Then I want to 'push' the obstacle for 5 secondes. So I set the motor to turn during 5 seconds. But if encoder target is reached before the 5 seconds the firmware will stop motor.

My questions are related to my project (see my signature) where I created a small simulation of sensors and motors in order to validate my code first in PC-emulator then in real world. Understanding internal firmware behavior will help me to get an accurate motor simulation.

Thank for your help.

Ah, okay. To remove the target, simply set the target to "0". That means that you get full control of the motor back.

if(SensorValue(touch) == 1){ nMotorEncoderTarget[motorA] = 0; //Resets the encoder so that there is no target. wait1Msec(5000); motor[motorA] = 0;}

_________________A.K.A. inxt-generationSelf-proclaimed genius, and future world dominator.My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth DoctorBow down to Nikola Tesla, King of the Geek Gods.

_________________A.K.A. inxt-generationSelf-proclaimed genius, and future world dominator.My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth DoctorBow down to Nikola Tesla, King of the Geek Gods.

Who is online

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum