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 Ports couldn't be read(Lego EV3)
Lego Ports couldn't be read [message #1805322] Thu, 11 April 2019 14:49 Go to next message
Mario Krizic is currently offline Mario KrizicFriend
Messages: 6
Registered: April 2019
Junior Member
Hello, I have tried to create a simple application similar to the PID Controller tutorial. The function blocks are the same as in the documentation, but I get an error after deploying the program onto the EV3.

When the program starts, the console gives me the following ERROR: T#6894: Port in1 wasn't found.ERROR:

When I attach watches to my FBs, I can see that the sensor could not be read and the motors are not initialized.
Due to the cycle this Error repeats itself indefinetly until forte gets stopped. I have tried addressing all kinds of ports and only have managed to get the emb ports for the buttons running.

The error does not go away after running forte with sudo or as root. I have tried all ports and checked all cable connections. The files in the class folder show that the sensors and motors are being recognized.
I have attached some screenshots below if it helps.

Can somebody help me fix this issue? Thank you in advance.
index.php/fa/35294/0/
index.php/fa/35295/0/
index.php/fa/35296/0/
Re: Lego Ports couldn't be read [message #1805417 is a reply to message #1805322] Mon, 15 April 2019 06:49 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 160
Registered: February 2016
Senior Member
what's the content of /sys/class/tacho-motor/motor0/address and /sys/class/tacho-motor/motor1/address?

$ cat /sys/class/tacho-motor/motor0/address
$ cat /sys/class/tacho-motor/motor1/address
Re: Lego Ports couldn't be read [message #1805592 is a reply to message #1805417] Thu, 18 April 2019 09:46 Go to previous messageGo to next message
Mario Krizic is currently offline Mario KrizicFriend
Messages: 6
Registered: April 2019
Junior Member
Here it is: https://imgur.com/a/wzbbqOG. I hope this helps.

Edit: Added the screenshot as an attachment
index.php/fa/35389/0/

Edit: I have played around in the processorinterface.cpp file and added various error messages to functions that are being called when initialising.

In the findNumberFromPort function, the motors cannot be found, because !mAddressFile.fail in the if statement evaluates to false every time. This is probably the reason, why the motors cannot be initialised. Is it possible that I have to set write permissions in the class folder for groups and other?

For the sensors, I have seen that paIsInput is always true. Why is this? In the code it says output is not allowed for sensors, but it does not make sense as the if statement checks whether the paIsInput value is true. Am I misinterpreting the name of the variable? Also I have seen multiple comparisons between boolean variables and true/false.

[Updated on: Tue, 23 April 2019 14:32]

Report message to a moderator

Re: Lego Ports couldn't be read [message #1805794 is a reply to message #1805592] Wed, 24 April 2019 08:19 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 160
Registered: February 2016
Senior Member
Hi,

thanks for the detailed information. It really helps!

Regarding your issue: I think you already found the issue. If !mAddressFile.fail isnot true, it means that reading the file failed. You can see http://www.cplusplus.com/reference/istream/istream/read/ for more information. Maybe the error occurs before reading (at seekg or clear()). Write permissions are not the problem here I'd say. Unfortunately I cannot help more here.

Regarding paIsInput, this is comes from the FB (IX, IW, ID). The if statement are to prevent using it incase someone uses for example a QX with sensor. Now, this could probably be done before calling setupSensor().

And, as you pointed out, there are some weird things in the code. This code was writen 3 years ago and never again maintaned. There are many "if (true == VARIABLE)" that can be replace for "if(VARIABLE)" and lot of logging errors are missing that would make debugging quicker (as in your case for example).

we are always happy to see new people contributing to the code. If you want improve C++ skills, this is a great opportunity. I guarantee you that you'll get good reviewers. See https://www.eclipse.org/4diac/en_help.php?helppage=html/development/contributeToForte.html for more information.
Re: Lego Ports couldn't be read [message #1805820 is a reply to message #1805794] Wed, 24 April 2019 18:59 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 907
Registered: January 2014
Senior Member
Hi,

I had a look on the documentation for stream. It seams that fail will return true also if it could not read the required number of bytes. Could you try if something chagnes when you replace the if in question with the following if: if (!mAddressFile.fail() || mAddressFile.eof()){

Thanks,
Alois
Re: Lego Ports couldn't be read [message #1805833 is a reply to message #1805322] Thu, 25 April 2019 07:54 Go to previous message
Mario Krizic is currently offline Mario KrizicFriend
Messages: 6
Registered: April 2019
Junior Member
Thank you, I will try it out on monday.

Edit: It did not work. I have added an error message in case eof was reached, but it did not display it.

[Updated on: Mon, 29 April 2019 07:09]

Report message to a moderator

Previous Topic:How to change the font type and size in 4DIAC editors?
Next Topic:Error in fboot when there are seven publish or subscribe block using SFP
Goto Forum:
  


Current Time: Mon Nov 18 05:58:19 GMT 2019

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

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

Back to the top