Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » Lego EV3 set tacho-motor speed(Lego EV3)
Lego EV3 set tacho-motor speed [message #1806711] Tue, 14 May 2019 10:11 Go to next message
Mario Krizic is currently offline Mario KrizicFriend
Messages: 6
Registered: April 2019
Junior Member
Hello,

Is there any way to set the motor speed for the Lego EV3 in 4diac? My application is working as expected during debugging, but when outA.motor.enable is called, the motor does not move. I have tried changing the speed manually in the file system, but got a "Permission denied" error even if the file was opened using sudo and write permissions were set. So it stays 0 after every start/reset.

From the documentation, I have seen that there is only a function block to read the speed, but not one to set it. Another thing I've found is that there is the option of reading and writing through custom access, but there is no fileWriter so I assume that is a QW block.

My question is now how to implement such a block that sets the speed to say 100 before calling enable?

I have tried using a QW block with PARAMS=/sys/class/tacho-motor/motor1/speed_sp and OUT=100, but then I get an error:
"terminate called after throwing an instance of 'std::length_error'
what(): basic_string::_S_create
Aborted"

I think I am missing something. Can somebody point me into the right direction?

Thank you in advance.
Re: Lego EV3 set tacho-motor speed [message #1806713 is a reply to message #1806711] Tue, 14 May 2019 10:43 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 136
Registered: February 2016
Senior Member
You should use "pwm" with an QW to write the desired value -> outB.motor.pwm (QW writes the desired pwm, IW reads the actual pwm)

You're right, the fileReader and fileWriter are not in the IDE, this should be added
Re: Lego EV3 set tacho-motor speed [message #1806715 is a reply to message #1806711] Tue, 14 May 2019 10:52 Go to previous messageGo to next message
Mario Krizic is currently offline Mario KrizicFriend
Messages: 6
Registered: April 2019
Junior Member
Ok I found out that it is necessary to write to outA.motor.pwm in order to get the motor working. However reset does not stop the motor in my case, therefore it is necessary to set the pwm to 0 before resetting.
Re: Lego EV3 set tacho-motor speed [message #1806716 is a reply to message #1806713] Tue, 14 May 2019 10:54 Go to previous message
Mario Krizic is currently offline Mario KrizicFriend
Messages: 6
Registered: April 2019
Junior Member
Thank you. I figured it out just as you posted your reply.
Previous Topic:Lock up issue with IEC 61499/Forte when running on Linux
Next Topic:Issue with client/server and vmware
Goto Forum:
  


Current Time: Thu Aug 22 00:49:04 GMT 2019

Powered by FUDForum. Page generated in 0.01493 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top