|
Page 1 of 1
|
[ 8 posts ] |
|
Read servo position with MindStorms?
Author |
Message |
cyman
Rookie
Joined: Tue Mar 13, 2012 1:18 am Posts: 8
|
 Read servo position with MindStorms?
Hi there,
Very new to MindStorms, tho I've coded up AVRs and microcontrollers... Question- For the NXT servo motors, can I read the current position? To clarify, there could be an obstruction that makes the motor move less than it's been told. My goal is to use it to aid in detecting whether an object is gripped.
I read that the NXT servos have tachometers built in.
|
Tue Mar 13, 2012 1:25 am |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Read servo position with MindStorms?
Hi cyman, You read correctly. You can easily read the current tacho count with: You can reset the count simply by assigning 0 to nMotorEncoder, like this: - 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]
|
Tue Mar 13, 2012 3:02 am |
|
 |
sumasmreq
Rookie
Joined: Fri Jan 27, 2012 6:57 pm Posts: 40
|
 Re: Read servo position with MindStorms?
You're hilarious, Xander 
|
Wed Mar 14, 2012 1:45 am |
|
 |
cyman
Rookie
Joined: Tue Mar 13, 2012 1:18 am Posts: 8
|
 Re: Read servo position with MindStorms?
Thanks! Also, one big issue is setting the motor to an absolute position. Can i do that? For example, I have a hand that i want to open and close, but i need the motors to be in the right initial position for it to work. in practice, when i start my robot, the motored hand is typically semi open or semi closed, forcing me to physically calibrate it.. A big pain.
Ive used servo controllers like the ssc32 that will let you set an absolute position. Wondering if thats possible.
|
Thu Mar 22, 2012 3:42 am |
|
 |
magicode
Moderator
Joined: Tue Sep 14, 2010 9:19 pm Posts: 496
|
 Re: Read servo position with MindStorms?
Nope, you 'll need some other way to calibrate the starting position. Perhaps something like a button that's pressed when the hand is at the the limit of it's movement. For absolute position, you need something like a potentiometer.
_________________ sudo rm -rf /
Last edited by magicode on Fri Mar 23, 2012 12:45 am, edited 1 time in total.
|
Thu Mar 22, 2012 8:40 am |
|
 |
cyman
Rookie
Joined: Tue Mar 13, 2012 1:18 am Posts: 8
|
 Re: Read servo position with MindStorms?
ok thanks!
|
Thu Mar 22, 2012 9:11 pm |
|
 |
DiMastero
Expert
Joined: Wed Jun 30, 2010 7:15 am Posts: 181
|
 Re: Read servo position with MindStorms?
A button could work, but that would cost you a sensor port; you could also do something like this That would make it go backwards until it's detected that it has hit something and can't move any further. That would only work if, again, the motor can't physically move past one point like magicode said. Another option is the HiTechnic Angle Sensor which will keep track of the angle of the motor even if the robot has been turned off: http://www.hitechnic.com/cgi-bin/commer ... ey=NAA1030
_________________leonoverweel.com
|
Thu Mar 22, 2012 9:29 pm |
|
 |
cyman
Rookie
Joined: Tue Mar 13, 2012 1:18 am Posts: 8
|
 Re: Read servo position with MindStorms?
Hi dimastero.... Thanks thats handy and will work in my situation!
|
Fri Mar 23, 2012 1:53 am |
|
|
|
Page 1 of 1
|
[ 8 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
|
|