Closed francesco-romano closed 8 years ago
I'll fix this. I already had to do some pending improvements.
:+1: thanks a million @jeljaik
I have addressed this issue by adding a checkbox called Autoconnect
. When checked, the user can't specify the destination source, but only the source and size of its output. When unchecked, the user can type the name of a port to be created. Upon entering this data, the block will simply create a port and it's up to the user to connect it to any other port via terminal as yarp connect [source] [dest]
. In-block documentation has also been updated.
Hope this is what you desired :smile:
Cheers!
:+1:
A couple of issues were identified. We need testers!
Autoconnect
make sure that the now-hidden field From
is filled with some string, e.g. '...'
, otherwise you get the error "Cannot retrieve string from parameter 1!!
. This behavior will be nevertheless improved. Autoconnect
option while specifying the name of a port that you don't want to connect just yet.Hi Jorh, well done. I think, however, that it could be useful to add an additional output to this block, which informs the user that the port is actually connected. For instance, if the port is disconnected, we receive zeros, but the user does not know if these zeros are actually sent by a sender. Can we add a binary output that acknowledges the connection?
@DanielePucci in which of the two cases (or both) you want this output?
Both cases? If the autoconnect flag is active, then the binary output can be always true.
I think the additional output is just a temporary workaround (an I am not really sure necessary right now). The real solution would be to have a visual output (certain Simulink blocks can change their icon) when data are available on the port.
@iron76 an additional "real" value can be really useful to deal with data still not available on that port (for example: don't start the controller until data is available).
@DanielePucci it is possible that the port never received anything even if you use the "autoconnect" option.
@traversaro there is an issue here related to the fact that Simulink always assumes that data are available while YARP does not. I think any solution would be a workaround. In any case I don't really like the additional output solution. I am tempted by using NaN.
NaN would be fine for me. The main point is to distinguish data sent by someone from fake data. I agree with @traversaro, however, that in some cases it would be useful to have an additional output, which may help develop a diagnostics logic in the controller.
In "Simulink language", missing data should be represented by NaN. This could definitely be done in conjunction with a change in the color of the block ... although, since the blocks are all colored I'd rather go for a particular icon for this block.
In this case, as @traversaro mentioned, a connected port that does not stream data would also be clearly visible in the model. Kind of a time-saver...
to be honest I'm a bit scared about the use of NaN
s
I am more scared about using conventions which might difficult to interpret, such as using an additional binary output. Of course we can document things to allow users retrieving the correct meaning of things.
I agree with the general principle. In this specific case, however, I think that it would be more misleading to have NaNs than outputs like "connection" and "readFailure". In the @iron76 direction, we might stream NaNs if either connection = 0, or readFailure=1. In this case, the conventions should be clear enough.
@jeljaik your issues here: https://github.com/robotology-playground/WBI-Toolbox/issues/83#issuecomment-87736511 should have been fixed now. Can you check it?
@francesco-romano regarding the issue https://github.com/robotology-playground/WBI-Toolbox/issues/83#issuecomment-87736511 =>(1), and the symmetric issue:
I'm checking if these have been resolved by your fix #90 .
I never reproduced the second issue mentioned by Jorh, even with commit 3123960 from Daniele, before your fix.
I'm still seeing this issue:
I've just test it and it works.. but I was in the fix/yarpRead
branch. Can you test that you get the same behaviour there?
Just to understand if it was a merge issue.
Well, I did a git diff between your branch and the master branch and there are no diffs.
This is good then :)
But how did you test that?
On 09 Apr 2015, at 18:25, Nuno Guedelha notifications@github.com wrote:
Well, I did a git diff between your branch and the master branch and there are no diffs.
— Reply to this email directly or view it on GitHub https://github.com/robotology-playground/WBI-Toolbox/issues/83#issuecomment-91280678.
Can we make a simple model-test?
I tested with a very basic model that just uses the default yarpRead block. I checked that the "to" field is filled with the default "..." if it is masked (after I check "Autoconnect" and click OK).
That doesn't happen with the "from" field (if I uncheck "Autoconnect" instead).
Looking at the code WBCLibrary.mdl
I actually see the line missing (as far as I can understand)...
Don't loose your time with this, I'll make a quick check...
Works fine now. I just pushed the branch "fix/yarpRead_default_from_field" for you to review?
@nunoguedelha the from
field is unused if don't set the autoconnect
flag. This is way we don't care about it. Further more, leaving the name the user set will allow a faster switch between autoconnect
values.
To explain better this is the "terminal" behaviour we want to replicate in the yRead
block:
1) $ yarp read ... /source/port
2) $yarp read /destination/port
So if autoconnect
is on we want to replicate the first behaviour: we want the user to set an already existent port in the from
field.
If autoconnect
is off, we want the user to specify only the destination port. And we don't really care about the from
port.
Lastly, putting ...
in the from port is wrong. There will never exist a port called ...
.
Yes, you're absolutely right.
So we do agree that the cleanest behaviour of the yard Read bock would be not to check the from
field or try to create a source port at all when the autoconnect
flag is set. But currently, it is doing this check, right? Do you get the same error as I do?
@nunoguedelha yes ok. I never thought about leaving completely empty the field. I think I will edit the C++ anyway. I have to add another feature to the yRead port, so i put you in stand-by :smile: I will ping you again when I finish adding the feature.
ok thanks :wink:
@nunoguedelha I completely change the yarp read. I added a new yarp read block. The old is still present but is considered deprecated. I don't know if you want to test it, for us is low priority.
I'll test it this week end if I have some time.
Given the new yarp read has been quite stable during the last 6 months of work, I think we can close this issue.
We need to extend the behaviour of
yarpRead
block. Currently the name of the port specified is the port to which the block will connect. We should link this behaviour (together with the temp port support) only to anautoconnect
option (checkbox). In case the user does not set the behaviour to beautoconnect
, the block should only create the port. This will ensure the compatibility with the usual yarp modules procedure.cc @jeljaik