Go to Post Pro: Very easy to build with. Con: HEAVY AS ELEPHANTS - Tetraman [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 31-03-2016, 03:25
jules_TeamTulip jules_TeamTulip is offline
Registered User
FTC #9757
 
Join Date: Mar 2016
Location: The Netherlands, Breda
Posts: 1
jules_TeamTulip is an unknown quantity at this point
[FTC]: [help] can't set the motorPower to zero with encoders

I want to set the power of the motor's to zero when they reaches their target. But now they are stopping but they are still busy. And the encoders aren't resetting.
This is my code, it's in opMode
if (gamepad1.b) { int targetPosition = 0; motorLeft.setMode(DcMotorController.RunMode.RUN_US ING_ENCODERS); motorRight.setMode(DcMotorController.RunMode.RUN_U SING_ENCODERS);
motorLeft.setMode(DcMotorController.RunMode.RESET_ ENCODERS);
motorRight.setMode(DcMotorController.RunMode.RESET _ENCODERS);
//while (motorLeft.getCurrentPosition() != 0){
//}
motorLeft.setTargetPosition(targetPosition);
motorRight.setTargetPosition(targetPosition);

motorRight.setMode(DcMotorController.RunMode.RUN_T O_POSITION);
motorLeft.setMode(DcMotorController.RunMode.RUN_TO _POSITION);
//if (motorLeft.getCurrentPosition() != targetPosition) {
motorLeft.setPower(-0.5);
motorRight.setPower(-0.5);
//}
//motorLeft.setPower(0);
//motorRight.setPower(0);
}
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 17:02.

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