View unanswered posts | View active topics It is currently Wed Oct 21, 2020 6:26 pm

Reply to topic  [ 2 posts ] 
getMotorEncoder not reporting correct value? 
Author Message

Joined: Thu Feb 18, 2016 5:56 pm
Posts: 1
Post getMotorEncoder not reporting correct value?
I have two motors (4 and 10) trying to lift a shovel up. When shovel is empty, 625 encoder value stops at the top which is what I want. However, when there is some weight in the shovel, it only goes half as high but returns some encoder value. The problem is that I don't know how much weight I'll have in the shovel, but I always want to move it to same height. Any other to do the same will be appreciated.
Here is the code:

#pragma config(Sensor, port2, touchLED, sensorNone)
#pragma config(Sensor, port3, colorDetector, sensorNone)
#pragma config(Sensor, port7, distanceMM, sensorNone)
#pragma config(Sensor, port8, bumpSwitch, sensorVexIQ_Touch)
#pragma config(Motor, motor1, rightMotor, tmotorVexIQ, openLoop, reversed, driveRight, encoder)
#pragma config(Motor, motor4, leftarm, tmotorVexIQ, PIDControl, reversed, encoder)
#pragma config(Motor, motor6, leftMotor, tmotorVexIQ, openLoop, driveLeft, encoder)
#pragma config(Motor, motor10, rtarm, tmotorVexIQ, openLoop, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main()
displayMotorValues(line1, leftarm);
setMultipleMotors(50, motor4, motor10, , );
while (getMotorEncoder(leftarm) <= 625) {
wait(0.1, seconds);
displayMotorValues(line2, leftarm);
displayMotorValues(line3, leftMotor);
stopMultipleMotors(motor4, motor10, , );
displayMotorValues(line4, leftarm);
wait(30, seconds);

Thu Feb 18, 2016 6:08 pm

Joined: Sat Mar 26, 2016 1:49 pm
Posts: 1
Post Re: getMotorEncoder not reporting correct value?
This is a mechanical issue. The motor still moves 625 units, the encoder sees 625 units. The shovel is lower due to the flexing of the parts and wear on the gears (if you have any). Try running your program to the point motor reports 625, then remove the weight from the shovel - it would likely raise to the expected height without the motor axle moving.
The typical causes are the square holes becoming loose and the axles twisting. You'll need to improve your mechanical design,
but there will always be some tolerances, so your best course of action is to use the bumper switch to establish more realistic zero point.
As in, have the bumper in the lower position, start the shovel raising motor, but wait till the bumper releases. That becomes your "zero under load and current wear level". Then add your desired height (which would be less that 625, since there was some load even in your previous open-loop control attempts) and move motor there. Not perfect (the load might only contribute enough at certain angle), but self-calibrating.
Or, in a much simpler case that 625 is your highest position, add bumper, or even hard stop there.

Sat Mar 26, 2016 2:36 pm
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

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.