View unanswered posts | View active topics It is currently Sat Jul 12, 2014 12:47 am






Reply to topic  [ 7 posts ] 
RobotC and AMT102 V encoder 
Author Message
Novice

Joined: Sun Feb 24, 2008 6:15 pm
Posts: 50
Post RobotC and AMT102 V encoder
Hi,

I want to connect more accurate encoder(AMT102) instead of the internal motor encoder to my NXT. I want to know if the robotC firmware could easly read the 4000 pulse by turn of this sensor?

Thank you :)

Thibaud.

_________________
My Eurobot team website :
http://blog.mlrobotic.com/


My MOCs :
http://nxtgen.6mablog.com


Mon Nov 14, 2011 12:23 pm
Profile WWW
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3155
Location: Rotterdam, The Netherlands
Post Re: RobotC and AMT102 V encoder
I am not sure it could handle that many when the motor is running at 100%. The most the NXT needs to handle when the motor is turning at 100% is 720 pulses per 360 degrees at about 160-170RPM. Roughly half of what your encoder does.

There is only one way to find out, really.

- 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]


Mon Nov 14, 2011 3:02 pm
Profile WWW
Expert

Joined: Thu Sep 29, 2011 11:09 pm
Posts: 184
Location: Michigan USA
Post Re: RobotC and AMT102 V encoder
I think it should work. Read the last two paragraphs of this blog post. Note that all my testing was done with enhanced Lego FW, not ROBOTC FW.

_________________
Matt


Mon Nov 14, 2011 5:18 pm
Profile WWW
Novice

Joined: Sun Feb 24, 2008 6:15 pm
Posts: 50
Post Re: RobotC and AMT102 V encoder
thanks for your answer.

I've buy the AMT102 encoder and test them.

I've used two motor, two AMT102 (4096 pulse/tr), two Hitechnic ANgle encoder. Motor, AMT and HTAngle are on the same axle.

I run the two motor for 100 turns (4096*100) at 100% and 70% of power.

And the results are :

[url]https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=0AtspgBeFwXBIdGoxODRYTFE2VU9vX0wwbVRoMzRJV2c&single=true&gid=0&output=pdf
[/url]

The code is :

Code:
#pragma config(Sensor, S1,     ANG1,                sensorI2CCustom)
#pragma config(Sensor, S2,     ANG2,                sensorI2CCustom)
#pragma config(Motor,  motorA,          ,              tmotorNormal, openLoop)
#pragma config(Motor,  motorC,          ,              tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "drivers/HTANG-driver.h"

task main()
{
  nMotorEncoder[motorA] = 0;
  nMotorEncoder[motorC] = 0;
  HTANGresetAngle(ANG1);HTANGresetAccumulatedAngle(ANG1);
  HTANGresetAngle(ANG2);HTANGresetAccumulatedAngle(ANG2);
  motor[motorA] = 100;
  motor[motorC] = 100;
  long motorEncA = 0, motorEncB = 0, htEncA = 0, htEncB = 0;

  while((nMotorEncoder[motorA]+motorEncA)>-(4096*100))
  {

    if(nMotorEncoder[motorA] < -65000) {motorEncA+=nMotorEncoder[motorA];nMotorEncoder[motorA] = 0;}
    if(nMotorEncoder[motorC] > 65000){ motorEncB+=nMotorEncoder[motorC];nMotorEncoder[motorC] = 0;}
    wait1Msec(500);
  }
  motor[motorA] = 0;
  motor[motorC] = 0;

  nxtDisplayClearTextLine(0);

  nxtDisplayStringAt(0,63, "A :M %d", nMotorEncoder[motorA]+motorEncA);
  nxtDisplayStringAt(0,53, "   A %d", HTANGreadAccumulatedAngle(ANG1));
  nxtDisplayStringAt(0,43, "B :M %d", nMotorEncoder[motorB]+motorEncB);
  nxtDisplayStringAt(0,33, "   A %d", HTANGreadAccumulatedAngle(ANG2));

  while(nNxtButtonPressed != kLeftButton){endtimeslice();}
}


The HTAngle seems to lose some degrees, is it possible?

Thibaud.

_________________
My Eurobot team website :
http://blog.mlrobotic.com/


My MOCs :
http://nxtgen.6mablog.com


Sun Dec 11, 2011 12:44 pm
Profile WWW
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3155
Location: Rotterdam, The Netherlands
Post Re: RobotC and AMT102 V encoder
At what RPM were you losing ticks?

- 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 Dec 11, 2011 4:00 pm
Profile WWW
Novice

Joined: Sun Feb 24, 2008 6:15 pm
Posts: 50
Post Re: RobotC and AMT102 V encoder
I don't know the RPM all that i know is that I write 100 or 70 in the motor[motorA] variable.

_________________
My Eurobot team website :
http://blog.mlrobotic.com/


My MOCs :
http://nxtgen.6mablog.com


Sun Dec 11, 2011 5:57 pm
Profile WWW
Expert

Joined: Thu Sep 29, 2011 11:09 pm
Posts: 184
Location: Michigan USA
Post Re: RobotC and AMT102 V encoder
Due to the design of the HT rotation sensor, I don't think it has the ability to lose position (unless it is very poorly programmed).

Try running the motor at lower speeds, and check to see if the difference between the rotation sensors is linear. If so, then you should be able to adjust your math a little to make it accurate.

_________________
Matt


Sun Dec 11, 2011 6:10 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 7 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.