|
Page 1 of 1
|
[ 6 posts ] |
|
Author |
Message |
ninjaphoenix
Rookie
Joined: Sat Jan 05, 2013 12:45 pm Posts: 1
|
 Lock NXT Motor in place
I am looking for a way to keep my robot's motor locked at a certain position. Right now what happens is the motor is stopped, and it falls back down to the lowest position. Is there any way I can keep this from happening? Thank you! Arm Code Chunk: //ROBOT ARM GRAB CODE int buttonValues = joystick.joy1_Buttons; int grabUp = buttonValues & 16; int grabDown = buttonValues & 64; int closeGrabber = buttonValues & 32; int openGrabber = buttonValues & 128;
if ((grabUp + grabDown + closeGrabber + openGrabber) == 0) { // No buttons pressed, stop motors. motor[motorWrist] = 5; motor[motorGrab] = 0; return; }
if (grabUp) { motor(motorWrist) = 50; }
if (grabDown) { motor(motorWrist) = -50; }
if (closeGrabber) { motor(motorGrab) = 25; }
if (openGrabber) { motor(motorGrab) = -25; }
|
Sat Jan 05, 2013 12:49 pm |
|
 |
amcerbu
Novice
Joined: Sun Oct 21, 2012 10:01 pm Posts: 76
|
 Re: Lock NXT Motor in place
I would suggest changing the gear ratio to increase the torque on the joint. Otherwise, I can't see anything wrong with your code. Although, why do you set the wrist motor to 5% power?
Also, it helps if you post code between [code] and [/code] tags; this will preserve indentation and use a fixed-width font.
|
Sat Jan 05, 2013 1:27 pm |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: Lock NXT Motor in place
Is PID control on?
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
Sat Jan 05, 2013 2:34 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Lock NXT Motor in place
The most efficient and effective way of locking an arm in place is by the use of a worm-wheel construction, where you have a worm-wheel drive a cog, which moves the arm. The arm cannot drive the worm-wheel in reverse because it is physically impossible. That way you spare your motor and batteries as well. = Xander
_________________| Professional Conduit of Reasonableness| (Title bestowed upon on the 8th day of November, 2013) | My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
Sun Jan 06, 2013 3:24 am |
|
 |
LP123
Rookie
Joined: Sat Jul 24, 2010 6:06 am Posts: 5
|
 Re: Lock NXT Motor in place
you should set both motors to 0 so the nxt actually brakes them I think, and in the preferences under NXT, uncheck use Float / Coast (vs Brake) for inactive motor PWM if checked!
|
Mon Jan 07, 2013 10:17 am |
|
 |
Coder A
Moderator
Joined: Thu Jan 03, 2013 5:10 pm Posts: 207 Location: The plateau north of the Ohio River Valley, also known as Cave Country.
|
 Re: Lock NXT Motor in place
First, set 'bfloatwhenmotorpwminactive' to false, and then set on motor PID speed control. PID keeps motor at same speed, so when the motor starts to move, it will not be moving at zero, right? So, the motor wil correct to its previous position.
I hope this helps!
_________________ I'm not a robot! I'm british! ~ quote from an asparagus I am not a robot! I am a unicorn! ~ quote from a robot
|
Sat Jan 12, 2013 10:17 pm |
|
|
|
Page 1 of 1
|
[ 6 posts ] |
|
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
|
|