Tracking wheel movement

Post your NXJ projects, project ideas, etc here!

Moderators: 99jonathan, roger, imaqine

Tracking wheel movement

Postby mbenz1 » Fri Feb 08, 2008 8:26 am

Hi for my project i am doing a virtual pet robot controlled by a mobile phone.

i am able to send commands to move the motors.

However i would like to track how far the motors have moved in each movement (to track its path). how can i do this as i dont want to try to use speed/time to get distance as i guess this wouldnt be very accurate timing each move...

tx
Ben
________
Honda Canada Inc. specifications
Last edited by mbenz1 on Thu Feb 03, 2011 1:20 pm, edited 1 time in total.
mbenz1
New User
 
Posts: 10
Joined: Mon Oct 08, 2007 5:22 pm

Tracking Motor count

Postby ft.zimmermann » Fri Feb 08, 2008 6:23 pm

Hi Ben,

I cant understand your problem. Why cant you use getTachoCount?

Frank
ft.zimmermann
Novice
 
Posts: 35
Joined: Sat Sep 01, 2007 7:18 pm
Location: Hamburg, Germany

Postby lawrie » Sun Feb 10, 2008 6:06 pm

Hi Ben,

Are you using LCP commands or are you sending commands that you have defined yourself?
lawrie
leJOS Team Member
 
Posts: 842
Joined: Mon Feb 05, 2007 1:27 pm

Postby mbenz1 » Mon Feb 11, 2008 9:53 pm

sorry i have changed my strategy i was sending commands straight to the nxt, but now im going to use a lejos app to interpret my commands so will be able to use tacho.

i will be implementing a feature so the car can track where its going. so it can do the reverse to get back to teh start position. would tracking each movement in this way be the best solution?

tHanks
Ben
________
Celica XX
Last edited by mbenz1 on Thu Feb 03, 2011 1:20 pm, edited 1 time in total.
mbenz1
New User
 
Posts: 10
Joined: Mon Oct 08, 2007 5:22 pm

Postby lawrie » Tue Feb 12, 2008 1:43 pm

You can get the tacho count from LCP commands - from OutputState.tachoCount, but you are best off doing what you are now doing, and interpreting your own commands.

One option is to use a Navigator such as TachoNavigator. This keeps track of position for you and can send the robot straight home.
lawrie
leJOS Team Member
 
Posts: 842
Joined: Mon Feb 05, 2007 1:27 pm

Postby westes » Thu Jul 23, 2009 2:08 am

I have made a program that moves in a circle very slowly then when it sees something inside its protection circle, it charges at it. When it sees something it calls:

Code: Select all
Motor.A.resetTachoCount


I only track one Motor because tracking two motors will take more memory and may cause it to run slower. After it has reset the angle value of the motor it rotates to Angle 1000 while facing the object it is attacking. After it has moved the object out of the way, it goes back the angle of the motor.

Code: Select all
Motor.A.rotate(-Motor.A.getTachoCount(),true);
Motor.B.rotate(-Motor.A.getTachoCount());


HOPE THIS HELPS
westes
New User
 
Posts: 21
Joined: Wed Jul 22, 2009 12:38 am

Postby kirkpthompson » Thu Jul 23, 2009 3:44 am

I don't think you need to worry about running slower. LeJOS is pretty darn fast. Search for balancing NXT lejos robots on U tube.

-K
Leg Godt!
User avatar
kirkpthompson
leJOS Team Member
 
Posts: 304
Joined: Wed Dec 05, 2007 1:27 am
Location: New Mexico, USA

Postby westes » Thu Jul 23, 2009 4:13 pm

What I have learned is that writing to the LCD can take more time than you think.
westes
New User
 
Posts: 21
Joined: Wed Jul 22, 2009 12:38 am

Postby gloomyandy » Thu Jul 23, 2009 4:18 pm

What I have learned is that writing to the LCD can take more time than you think.


Really? Do you have an example? when you write to the LCD all you are actually doing is writing to memory, which is normally pretty fast... But then I guess it depends on how fast you expect such an operation to be...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3645
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby westes » Fri Jul 24, 2009 3:54 pm

In my case it was.
I was writing to the LCD when it was checking a sensor's value. The program was delayed. My instructor suggested that I get rid of the LCD.drawString where it is checking the values. It got rid of the delay and ran perfectly. The source is at school. I wish I could show you.
westes
New User
 
Posts: 21
Joined: Wed Jul 22, 2009 12:38 am


Return to NXJ Projects

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff