Ev3 Motors in lejos 0.5.0

This is where you talk about the EV3 software itself, installation issues, and programming talk.

Moderators: roger, gloomyandy, skoehler

Ev3 Motors in lejos 0.5.0

Postby daspfanni2000 » Tue Feb 04, 2014 7:07 am

Hi,

I built a nice robot that uses both the large and the medium ev3 motors.

Now I am starting to dive into lejos for writing the first program for it.

Reading the forum I conclude that for 0.5.0 it is advised to use the nxtregulatedmotor class. Is this true and true for the large and the medium motor?

I read the online lejos API and found a ev3large and medium regulated motor classes. Unfortunately those are not available in 0.5.0, right?

How should I proceed and what should I focus on using right now?

Thanks and best regards,
Pfanni
daspfanni2000
New User
 
Posts: 23
Joined: Sun Dec 22, 2013 5:34 pm

Re: Ev3 Motors in lejos 0.5.0

Postby Aswin » Tue Feb 04, 2014 8:41 am

Hi,

The API doc is a bit ahead of the 0.5.0-alpha release. The classes you refer to are new and still under development. They are indeed not part of the 0.5.0-alpha release. Instead you should use the NXTRegulatedMotor class. This class works relatively well. Sometimes it can give some problems tha most often can be solved easily, see other posts in this forum.

Aswin
My NXT blog: http://nxttime.wordpress.com/
Aswin
leJOS Team Member
 
Posts: 206
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands

Re: Ev3 Motors in lejos 0.5.0

Postby daspfanni2000 » Tue Feb 04, 2014 1:10 pm

Hi Aswin,

thank you very much for your reply and information.

Is there a plan on when the new code will be released as a new tag? I understand that this is often not a possible or easy thing to answer - but maybe a release is imminent:-)

I am looking forward to it - and finally breathing life in my robot:-)

Best regards
daspfanni2000
New User
 
Posts: 23
Joined: Sun Dec 22, 2013 5:34 pm

Re: Ev3 Motors in lejos 0.5.0

Postby Aswin » Tue Feb 04, 2014 6:42 pm

Hi,

There is no target date for a new release.
My NXT blog: http://nxttime.wordpress.com/
Aswin
leJOS Team Member
 
Posts: 206
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands

Re: Ev3 Motors in lejos 0.5.0

Postby fuzzycow » Sun Feb 09, 2014 4:01 pm

Hi,

Not sure if this question warrants a new thread.

In my robot grip design I'm using the classic touch-sensor method to reset the grip "zero" position (fully closed, in my case).

This video: http://www.youtube.com/watch?v=anE3rqQPNA0 demonstrates additional method, which (to my understanding) is based on comparison of "intended" rotation (tachocount), with the actual rotation angle read from the motor. Its actually quite amazing how well this method works. I believe this is basically the same method as one used in lejos motor stall detection.

Edited:
I looked both through 0.5.0 sources of lejos motor code, but couldn't find an way to implement the second method directly ("getPower" on motor ?) without going through "stalled". In trunk the situation is different, I'm a little confused with getTachoCount vs getPosition vs the javadoc for those functions.

Would it be possible to do something like this with lejos ?
With limited number of sensor ports on ev3, it would be a real saver for building anything with limited rotation angle (e.g.: rotating IR/Ultrasonic sensor "turret").

Thank you,
FuzzyCow
Last edited by fuzzycow on Sun Feb 09, 2014 4:19 pm, edited 1 time in total.
fuzzycow
Novice
 
Posts: 28
Joined: Sun Sep 08, 2013 4:33 pm

Re: Ev3 Motors in lejos 0.5.0

Postby gloomyandy » Sun Feb 09, 2014 4:17 pm

Why can't you use the stall detect code to do this? You can adjust the stall time and error values to make it detect the stall more quickly when homing the motor.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4172
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Ev3 Motors in lejos 0.5.0

Postby fuzzycow » Sun Feb 09, 2014 4:37 pm

Thanks for the quick reply!

As far as I understand stall detection in 0.5.0 runs in a different thread, and has a cycle of ~4ms.
In my (admittedly limited and potentially faulty tests) stall detection didn't work very well at "high resolution" (e.g.: 10ms).
I wanted to experiment with initial calibration done at high (10-50ms) resolution, perhaps completely bypassing the regulator code to get the current reading.

If I can make this work fast & safe enough (not overheating the motor) - this could be useful beyond initial calibration.
In my construction there are two potential "stall-like" conditions - one is grip trying something too heavy (lesser drift between reading and actual tacho count), and second one is hard stop (currently done using touch sensor).
Hard stop is used for calibration, and delta between tacho reading on hard-stop during calibration and operation is used to determine if "grab" has been succesful.

BTW: some pictures if anyone's interested, grip is towards the bottom of the page http://www.fuzzycow.org/fuzzybots/holon ... w/gallery1 (temporary link).
fuzzycow
Novice
 
Posts: 28
Joined: Sun Sep 08, 2013 4:33 pm

Re: Ev3 Motors in lejos 0.5.0

Postby gloomyandy » Sun Feb 09, 2014 6:50 pm

Hi,
There is no such thing as a current reading available on the EV3. If you bypass the regulator then all this allows you to do is to specify the motor power values directly (which basically varies the PWM on period). I'm not really sure how this will help you.

I'm not sure what you mean by "high resolution" as far as stall detection goes. The stall detection code simply detects the error term in the motor position code, if it exceeds the preset error for more then the specified time then a stall is detected. You have control over both of these terms. If you want you can compare the error directly by using getPosition and getTachoCount, the position is the internal regulator calculated position while TachoCount is the actual tachometer reading. The Lego regulator runs at a similar frequency so you should be able to create results similar to the video you posted.

What tests did you actually perform and what results do you expect and get?
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4172
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Ev3 Motors in lejos 0.5.0

Postby fuzzycow » Sun Feb 09, 2014 10:14 pm

Originally I was very careful about not overloading the medium motor used for the grip, or breaking a gear, and thus the testing of stall threshold was very limited.

Right now being a bit more bold - I run more tests with different stall threshold values (1 - 20 tacho error, 5 - 50 ms).
It seems that due to high gear reduction in the grip mechanism - I ether get false stall detection, or gears start slipping with loud clicks.
I guess the problem was with me and not lejos :)

For the next set of tests I'll do some runs dumping getPosition() vs getTachoCount() delta, and I hope that'll give me a better idea of what setStallThreshold would work.
Its also quite possible that setStallThreshold will not work here, due to mechanics.

Thanks again for the help :)
fuzzycow
Novice
 
Posts: 28
Joined: Sun Sep 08, 2013 4:33 pm

Re: Ev3 Motors in lejos 0.5.0

Postby gloomyandy » Sun Feb 09, 2014 10:24 pm

Hi,
let me know how you get on. One thing we have talked about in the past is to allow an upper power limit to be set on the regulator. This would mean that you can choose not to apply full power during a move which may help in situations like yours where gears etc. start to jump due to the stall not being detected yet. If all else fails you can always use the basic NXTMotor class to control the motor which will allow the use of lower power levels when detecting the end points. You could even test this yourself by modifying the regulator class to see if limiting the maximum power would help. Oh and you may also want to consider lowering the acceleration used by the motor as this may help in reducing false stalls during motor start and stop operations. The default acceleration is very high and may be causing problems.

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

Re: Ev3 Motors in lejos 0.5.0

Postby hugheaves » Sat Feb 22, 2014 11:14 pm

I'd just like to add my "+1 Me Too" to the idea of a max power setting for a regulated motor. I have the same situation with a geared down motor and the fact that the motor is powerful enough to damage the mechanics of my model before stall is detected. (Even using the most sensitive stall parameters).

BTW, I saw there was a PWM offset setting for the regulator, which I thought might help. I went looking through the source (for 0.6.0) to try and figure out what the parameter did, but couldn't find the source for the regulator anywhere. (The kernel module is d_pwm.ko, right?) Am I missing something here, or is the kernel module source not published at the moment?

Thanks,

Hugh
hugheaves
New User
 
Posts: 16
Joined: Sun Dec 29, 2013 5:35 pm

Re: Ev3 Motors in lejos 0.5.0

Postby gloomyandy » Sun Feb 23, 2014 8:02 am

The kernel module source is in the SD card repository. https://sourceforge.net/p/lejos/ev3sdca ... 08/d_pwm.c
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4172
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Ev3 Motors in lejos 0.5.0

Postby gloomyandy » Sun Feb 23, 2014 8:24 am

The offset parameter is unlikely to help. It is intended to help with motors that have a large deadband but I'm still looking into the best way to handle them.

Limiting the power may help, but it may also mess up the motor regulation side of things so I'm a little reluctant to just add it at the moment. Remember you don't have to use the motor regulation code, you can always control the motors directly if you need to detect stall conditions on grippers etc.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4172
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Ev3 Motors in lejos 0.5.0

Postby jorrge » Fri Apr 04, 2014 6:36 pm

Hi, one problem related with motors, I have two of them and my problem is that when I start both one has to be first so this works first. I would like that both work at the same time, so what can I do? Thanks.
jorrge
New User
 
Posts: 14
Joined: Wed Mar 19, 2014 9:19 pm

Re: Ev3 Motors in lejos 0.5.0

Postby gloomyandy » Fri Apr 04, 2014 8:43 pm

What do you mean "one has to be first"? Please post the code you are using and describe the actual problem you are seeing.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4172
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Next

Return to EV3 Software

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff