View unanswered posts | View active topics It is currently Wed Sep 23, 2020 9:39 pm

Reply to topic  [ 6 posts ] 
Lock NXT Motor in place 
Author Message

Joined: Sat Jan 05, 2013 12:45 pm
Posts: 1
Post 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:
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;

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

Joined: Sun Oct 21, 2012 10:01 pm
Posts: 76
Post 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
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post 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
Profile WWW
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post 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.
ww.JPG [ 8.36 KiB | Viewed 9450 times ]

= 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
Profile WWW

Joined: Sat Jul 24, 2010 6:06 am
Posts: 5
Post Re: Lock NXT Motor in place
motor[motorWrist] = 5;
motor[motorGrab] = 0;

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

Joined: Thu Jan 03, 2013 5:10 pm
Posts: 207
Location: The plateau north of the Ohio River Valley, also known as Cave Country.
Post 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
Display posts from previous:  Sort by  
Reply to topic   [ 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

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.