yvo Geschrieben November 19, 2023 at 13:38 Geschrieben November 19, 2023 at 13:38 Dear List I am using the Rugged Approach approach for programming in C# and in Python. It just works perfectly! Thanks for the great tutorial. Till now, I worked with many bricklets, but each of a different type. For this case, the approach and code in the tutorial works like a charm. Question: But what would be the best-practice, if you have several bricklets of the same type? Of course, I could use the UID of the individual bricklets to make the differentiation of the individual bricklets. But I would like to avoid the usage of the UID in Rugged Approach for several reasons: Lost of the very generic procedure of the Rugged Approach introducing somehow hard-coded UIDs of bricklet. Incompatibility of several installations of hardware having different UIDs. In the specific application I am working on, the bricklets are connected with a HAT Brick. Question: Is there a possibility to avoid the UIDs? Could I use the information of the ports were each of the bricklet is connected to? In this case, I have to make sure, that each bricklet is connected with a well defined port. An approach which could be realistic. The information of the port connected to would be based on the return value of the get_identity() function of each bricklet. If I would use the UIDs, is it reasonable/possible to change the UIDs of the individual bricklets to have the same UIDs of the bricklets in each identical installation of the hardware. Looking forward to any ideas and suggestions. Cheers, Yvo Zitieren
Backdraft007 Geschrieben November 20, 2023 at 09:52 Geschrieben November 20, 2023 at 09:52 Hi Yvo, I think the best way is the position of the bricklet. So you have to plug the bricklets to the same positions and you can identify them with the enumeration callback. It is also possible to override the UID with the Brick Viewer, but for this you have to connect each bricklet and override the UID. I think first way is better because hardware is like it is. It is more plug and play (work) :) Greets Chris 1 Zitieren
yvo Geschrieben November 20, 2023 at 10:38 Autor Geschrieben November 20, 2023 at 10:38 Hi Backdraft007 Perfect. Thank you very much. In this case, I will go with the positions of the bricklets. That sounds the most promising. Cheers, Yvo Zitieren
yvo Geschrieben July 19, 2024 at 08:44 Autor Geschrieben July 19, 2024 at 08:44 Dear list In the meantime, I implemented the proposed approach of Backdraft007 using the connection-position of the bricklet at the HAT. That works perfectly. Usually I am using wrapper-classes for the individual types of bricklets. In this case, I am using multiple IndustrialDualRelais with different jobs each. The rugged-approach is simply extended by a variable and a if-clause to decided, if the bricklet will be connected or not: def _callbackEnumerate(self, uid, connectedUid, position, hardwareVersion, firmwareVersion, deviceIdentifier, enumerationType): if enumerationType == IPConnection.ENUMERATION_TYPE_CONNECTED or \ enumerationType == IPConnection.ENUMERATION_TYPE_AVAILABLE: if deviceIdentifier == BrickletIndustrialDualRelay.DEVICE_IDENTIFIER: if position.upper() == PermanentPower.POSITION_HAT.upper(): self._dualRelais = BrickletIndustrialDualRelay(uid, self._ipcon) The constant value POSITION_HAT defines the position of the connection at the HAT (A ... H). For my applications, this approach solves the requirements, Cheers. Yvo 1 Zitieren
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.