robotology / peripersonal-space

This repository deals with the implementation of peripersonal space representations on the iCub humanoid robot.
GNU General Public License v2.0
1 stars 3 forks source link

PPS visualization #23

Closed matejhof closed 7 years ago

matejhof commented 8 years ago

We're working with @towardthesea on how we can visualize the PPS that has already been learned - as a volume in 3D space surrounding the robot. First, we're starting in Matlab. Here come some questions for @alecive:

  1. Where can we find the code that was used to generate and plot the simulation results for the IROS paper (distance only representation). There should be an implementation of the Parzen windows there too?
  2. For representations learned in the real robot, we'd like to plot what is in a sample .ini file, such as learned_all. Here:
    • Do you have code to parse the .ini file in Matlab and to run the Parzen window on it and then plot?
    • Is this how the plots for individual taxels in the paper were generated?

Thanks!

towardthesea commented 8 years ago

Another question for @alecive is that: What is the exact angle of the cone you used for the experiment? I tried to find in the paper but it was not mentioned.

Thanks.

alecive commented 8 years ago

Sorry for the delay in answering, today was a busy demo day :)

Everything related to data processing and plotting (for the 1D version) should be in the following repositories: https://github.com/alecive/pps-gitlab/tree/master/2015_IROS (@towardthesea I added you to the repo - which is private - in case you need it) and this one https://github.com/alecive/peripersonal-space-margin-of-safety-data/ (which is a dependency for the first one, so if you download the first one you should get also the latter as a submodule).

I didn't try to run the code (no time), but everything should be there. I'm not sure if and how much is going to be working because we moved things around in the past months (different repositories, different changes to the software, etc), so many things can be broken (as a matter of fact, I fixed a little issue about this already).

Anyhow, here are my answers:

  1. Here https://github.com/alecive/pps-gitlab/blob/master/2015_IROS/montecarloSimulation/parzenExample1D.m#L37 I do the Parzen for drawing from simulation.
  2. I just checked the code. I don't have a way to read the matrices from ini file (at least as far as I saw) because apparently what we did for the IROS paper was to record the data, do the training on matlab, create an ini file from there and deploy it on the robot. I think there was a reason for doing this - probably to be consistent with the montecarlo simulation. For that matters, here is the code to load an empty .ini file and save a "learned" one https://github.com/alecive/pps-gitlab/blob/master/2015_IROS/realData/loadAndTrainTaxels.m#L242 . Anyway, whenever you devise the code to read from ini file, you can still use the code I shown above to plot it :+1:
  3. @towardthesea the angle is predefined and fixed to ~41°. I did some experiments by spanning the angle between 0 and pi and I decided on that value for some reason, but that was not our focus (even though it would have been better to put it on the paper). Obviously, the same angle is used in the C++ code (and in the SVG pictures).
towardthesea commented 8 years ago

Thanks @alecive for your value detail information. I had a brief look through the repo and they seems really good. I will try to exploit them and will inform you if I get any trouble :+1:

Actually I handled to plot the parzen drawing based on your 2D code that @matejhof shared me, but I will double check with your code to make sure everything fine.

Thanks again!

alecive commented 8 years ago

Great! If you then tell me in detail what you are going to need next, I can share it to you :+1:

matejhof commented 8 years ago

Great thanks! Btw., the angle seems to be 40 deg, guessing from here: https://github.com/robotology/peripersonal-space/blob/master/lib/src/utils.cpp#L300 No?

matejhof commented 8 years ago

I'll reopen this - the visualization enhancement is yet to be done.

alecive commented 8 years ago

Sorry, I forgot what was the real reason of the issue :)

Ok so there is a slight misalignment between the cpp and the matlab I think.

matejhof commented 8 years ago

Ok, so perhaps we can try to realign everything to 40 deg (a nicer number) - from now on?

alecive commented 8 years ago

No problem for me :+1:

towardthesea commented 8 years ago

A screen shot of PPS representation for the left forearm. For the color bar, please don't consider the minus sign! https://www.dropbox.com/s/zlwwe67ljr7h668/PPS-left%20forearm.bmp?dl=0

A short video of PPS representation with different view points to make it easier to understand https://www.dropbox.com/s/b9oadz0s949yh9h/Figure%206%208_22_2016%203_53_56%20PM.mp4?dl=0

matejhof commented 8 years ago

This is beautiful! We can still polish it, but this will IMHO be a priceless tool! Well done!

pattacini commented 8 years ago

Awesome! Well done!

It's worth an animated GIF :smile:

ezgif com-optimize

alecive commented 8 years ago

Wow, great job @towardthesea !!! Two comments:

Anyway, good job @towardthesea , it's a very nice visualization :+1:

towardthesea commented 8 years ago

This will answer @alecive 's question but is also an explanation:

alecive commented 8 years ago

I think we have a misunderstanding here: the RF angle of 41° is between the vertical (z axis in Fig 5 of the paper https://alecive.github.io/papers/[Roncone%20et%20al.%202015]%20-%20Learning%20peripersonal%20space%20representation%20through%20artificial%20skin%20for%20avoidance%20and%20reaching%20with%20whole%20body%20surface.pdf) and the external bounds of the RF (i.e. the line in which I wrote r=20cm in the same figure). So if you have an angle of 80° you should have a full hemisphere around the taxel (which is different from what you linked me).

The arc should be independent from the RFangle, because its curvature should be dependent to the radius, i.e. distance from taxel. The RFangle should impact the length of the arc and not its curvature.

alecive commented 8 years ago

I did a quick depiction of what I mean:

rf

Red should be with RFangle at 80°, green at 41° (please be aware that I did not measure them, I only draw them to give you the idea). The black lines should be the bins at constant distance from the taxel: you see how their curvature does not change according to the angle?

towardthesea commented 8 years ago

I actually misunderstand what you meant for 41deg, which I thought is the whole angle of the RF. What I did show for the first time was 20.5deg as you defined (meaning 41deg of the whole angle); and due to this small angle of 20.5deg, it created the feeling of flat (but it is still arc) as I mentioned in the explanation comment above.

In the explanation comment, what I showed was approximately equal to what you defined for the RF angle: You defined 41deg and I accidentally showed 40deg (equal to 80deg for the whole angle).

Hope it is clear :)

towardthesea commented 8 years ago

My persional repo for PPS visualization https://github.com/towardthesea/PPS-visualization. Please have a look and inform me if you get any problem in using it.

pattacini commented 8 years ago

@towardthesea @matejhof @alecive I wouldn't keep those scripts apart from this main repository, but rather create a sub-directory and maintain the code here.

matejhof commented 7 years ago

Will have to be adapted to allow for the new way of RF representation - see #32 and #24.

towardthesea commented 7 years ago

The issue is solved with the PPS-visualization repository. Close this now!