aiwc / test_world

AI World Cup simulation environment
MIT License
7 stars 12 forks source link

Support for Windows #58

Open omichel opened 4 years ago

omichel commented 4 years ago

An effort to port AIWC simulation to Windows is being conducted at https://github.com/omichel/test_world. Basically, the communication system between the simulation supervisor and competitor code was changed. The supervisor was ported to Python and uses a simplified network protocol without any dependency on boost or bonefish libraries. This issue lists all the remaining problems and bugs that need to be fixed to complete the support for Windows:

chshong commented 4 years ago

Currently the rulebased python example is not working (robots do not move at all and "Error: participant.py: Invalid JSON object." message is displayed many times). Is this an issue tied with 11?

stefaniapedrazzi commented 4 years ago

Yes. This message is displayed when the received frames cannot be handled correctly because they are truncated.

It is very likely that fixing the main loop in supervisor.py (related to issues 10. and 7.) will also fix this issue.

chshong commented 4 years ago

In compiling the C++ example program (which seems to use Unix headers), should I use MSYS environment? Could there be an easier way to compile on Windows?

DavidMansolino commented 4 years ago

Using MSYS should indeed fix the problem (can you confirm that please?). We can write a Makefile so that it will be possible to use Webots to compile the program, would this be fine for you?

chshong commented 4 years ago

I am not sure how I can use cmake on MSYS console to generate makefile and build the program. I used MinGW64 console, cmake -G "MSYS Makefiles", make and the result says it cannot find "arpa/inet.h"

chshong commented 4 years ago

and yes, if we can build the program using Webots + makefiles, it would be more convenient for the participants

stefaniapedrazzi commented 4 years ago

I will also fix 13. 'data path' not handed over to AI Soccer programs.

DavidMansolino commented 4 years ago

and yes, if we can build the program using Webots + makefiles, it would be more convenient for the participants

I will add a makefile in #8

omichel commented 4 years ago

I believe all the major issues are now fixed. @chshong: can you test it? I will investigate 9.1 now.

chshong commented 4 years ago
[supervisor]   File "supervisor.py", line 1368, in <module>
[supervisor]     controller.run()
[supervisor]   File "supervisor.py", line 918, in run
[supervisor]     self.tcp_server.spin(self)
[supervisor]   File "supervisor.py", line 109, in spin
[supervisor]     game_supervisor.callback(s, data.decode())
[supervisor]   File "supervisor.py", line 245, in callback
[supervisor]     speeds = [float(i) for i in speeds.split(',')]
[supervisor] ValueError: could not convert string to float: 
WARNING: 'supervisor' controller exited with status: 1.

I got this error when I ran the simulation right after the start. Could it be only happening on Linux?

omichel commented 4 years ago

Are you using Python 2?

chshong commented 4 years ago

Yes I do, we currently support both Python 2 and 3.

omichel commented 4 years ago

I see, it's probably a Python 2 issue. I will investigate and try to fix it.

omichel commented 4 years ago

Meanwhile can you test with Python 3?

omichel commented 4 years ago

I just tested on a fresh Ubuntu 18.04 with Python 2.7.15+, Webots R2019b and the current version of AIWC from https://github.com/omichel/test_world and I don't get any error. The rulebased-B python program seems to work fine and is able to score goals. I get no error. Can you try again and let me know?

chshong commented 4 years ago

I have tried again with print commands to locate the issue. It seems like the message is sometimes not a complete message as can be seen below (role: True means Team Red - rulebased-B and False means Team Blue - random-walk). It looks like the connection between the supervisor and participant programs is not stable. I ran the same setting several times and observed that the program sometimes run correctly but crashes like below occasionally.

Case 1

[supervisor] Traceback (most recent call last):
[supervisor]   File "supervisor.py", line 1369, in <module>
[supervisor]     controller.run()
[supervisor]   File "supervisor.py", line 919, in run
[supervisor]     self.tcp_server.spin(self)
[supervisor]   File "supervisor.py", line 109, in spin
[supervisor]     game_supervisor.callback(s, data.decode())
[supervisor]   File "supervisor.py", line 246, in callback
[supervisor]     speeds = [float(i) for i in speeds.split(',')]
[supervisor] ValueError: could not convert string to float: -
[supervisor] ('Role: ', False, ' Message received to split: ', u' 0.793643353317, 1.73699993703, 1.27201089653, 1.92776450033, 1.78566228763, 1.35845655587, 1.60706625009, -1.53683277559, -1.05533897153, 2.46122045843')
[supervisor] ('Role: ', False, ' Message received to split: ', u' -0.817598474881, -0.393538677105, 1.18629227742, -0.619832761918, 0.117035903087, 0.47500720918, 1.2700671649, -0.160436069376, -1.32681555854, -0.164168912824')
[supervisor] ('Role: ', False, ' Message received to split: ', u' -0.639982528729, -1.35098411394, 1.34600229547, -0.368081583583, 1.87518300798, -0.50845565348, -1.37320663802, 0.628441467972, -1.94345325374, 2.44777278243')
[supervisor] ('Role: ', False, ' Message received to split: ', u' -0.973450556943, -1.71392057337, -0.619133167566, 1.92882713395, -0.224762435429, -0.324615712064, 1.17314159236, 0.922825288809, 0.708797863002, 2.53989859372')
[supervisor] ('Role: ', False, ' Message received to split: ', u' 0.780658625474, -0.325832405436, -0.8135886439, -0.606678106332, -0.502235162816, 0.444931243152, -0.248071414388, 0.30581451815, -0.642865722686, 2.00835645537')
[supervisor] ('Role: ', False, ' Message received to split: ', u' -1.11873367099, 0.785748591479, -2.05673863084, -1.59483426861, -0.969473648258, -1.25016702781, 0.847111090582, -1.96018073931, -2.51587674958, 0.682503499166')
[supervisor] ('Role: ', False, ' Message received to split: ', u' -0.419485746728, -0.0319858246695, -1.77358043943, 1.00328971313, 1.95778536801, -2.0572219908, -0.932080716535, -0.608885006187, 1.30274862599, -1.94488123926')
[supervisor] ('Role: ', False, ' Message received to split: ', u' 0.0827961125212, 0.554252553553, 1.94330854372, 1.00879318018, 0.444503189964, 2.07985308256, 0.169269125297, -2.09621564773, 2.44216669789, 0.965941705581')
[supervisor] ('Role: ', False, ' Message received to split: ', u' 1.06618804039, -1.66816245, 1.81840687986, 0.393160382621, 1.74676440302, 0.585275658503, -1.78742813051, -0.949271592013, 1.0295763781, -0.740713480369')
[supervisor] ('Role: ', False, ' Message received to split: ', u' 1.32648243264, 0.55491002429, 1.37135599021, 1.64693229387, -0.0357995999925, -1.226279594, 1.03443960592, -2.53408267526, -0.36526753254, 0.97058134599')
[supervisor] ('Role: ', False, ' Message received to split: ', u' 0.230363242053, 0.0703741957169, -1.02956955406, -1.58986865097, 0.0194498267489, 0.700593293756, -2.2852464126, -1.66305177744, -0.332459052181, -0.212916196843')
[supervisor] ('Role: ', False, ' Message received to split: ', u' -1.62740120963, -0.558982552721, 0.530678208966, 1.36576550916, 2.05116839375, -1.68022576365, 1.01413767207, -2.27318566747, 2.19643955378, 2.16832816994')
[supervisor] ('Role: ', False, ' Message received to split: ', u' -1.75941719357, 0.898341806637, 0.719696732856, 0.178484895717, -1.38100472714, -1.31552511097, 0.101119956659, -1.89269978533, 1.0903918208, -0.083480102348')
[supervisor] ('Role: ', False, ' Message received to split: ', u' -0.667188065938, 1.52189298325, -1.63641553505, -1.13982990476, -0.247805095905, -0.215667483055, -0.651729077249, -0.634010672381, 1.65210782759, -2.29610389852')
[supervisor] ('Role: ', False, ' Message received to split: ', u' 1.02152199776, -0.157363339322, 0.272790214923, 1.59241899118, 1.38870210434, -0.00105461563213, -2.28940456024, -0.206344324666, 0.970801535492, 2.00985649759')
[supervisor] ('Role: ', False, ' Message received to split: ', u' 0.354643172393, 1.70120638754, -0.485606287044, 0.63607505375, 0.530184231488, 1.34844453733, -1.17251230846, -0.263329510026, 2.36740538983, -1.40560591411')
[supervisor] ('Role: ', False, ' Message received to split: ', u' 1.10735529266, -0.255259984149, 1.29701335573, -0.330659746428, 0.816597920375, 1.31280468144, -1.31547680499, 1.20741556326, 2.54567273037, 1.82020399588')
[supervisor] ('Role: ', False, ' Message received to split: ', u' 0.189366127109, 0.559617266816, 2.08637022089, 0.162724875244, -1.80836078853, 2.09152818593, -0.271419824961, 0.21667935124, 0.753593356563, -0.863779898916')
[supervisor] ('Role: ', False, ' Message received to split: ', u' 0.627802283463, 1.38720503327, 1.33671704783, 0.640127816009, -0.0475528004774, 1.57586440211, 0.760461140838, 0.83424923228, 0.963475665358, -0.0683017415056')
[supervisor] ('Role: ', False, ' Message received to split: ', u' 1.55254677323, 1.73375627809, -0.706542320656, 0.688692850404, -0.20193947549, -1.18375680517, 0.797138838188, 2.29814918992, -1.66270382781, 0.0792566738189')
[supervisor] ('Role: ', False, ' Message received to split: ', u' 1.74339131038, 0.387537079014, 0.107985686577, -1.30571109527, -0.211342823655, -1.71119808353, -0.413665098827, 0.983137134522, -0.224752120308, -0.829281181583')
[supervisor] ('Role: ', False, ' Message received to split: ', u' -0.487182343644, -0.571924232064, -0.273997151894, 0.721396168378, 0.563313602419, 1.23103156146, -0.994349832276, -')
WARNING: 'supervisor' controller exited with status: 1.

Case 2

[supervisor] Traceback (most recent call last):
[supervisor]   File "supervisor.py", line 1369, in <module>
[supervisor]     controller.run()
[supervisor]   File "supervisor.py", line 919, in run
[supervisor]     self.tcp_server.spin(self)
[supervisor]   File "supervisor.py", line 109, in spin
[supervisor]     game_supervisor.callback(s, data.decode())
[supervisor]   File "supervisor.py", line 246, in callback
[supervisor]     speeds = [float(i) for i in speeds.split(',')]
[supervisor] ValueError: could not convert string to float: 
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75806660849, 1.75806660849')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75806660849, 1.75806660849')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75771940501, 1.75771940501')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75736702824, 1.75736702824')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75730832176, 1.75730832176')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75725866073, 1.75725866073')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75721644873, 1.75721644873')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75718056834, 1.75718056834')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75715006998, 1.75715006998')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75712414642, 1.75712414642')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75710211151, 1.75710211151')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75708338198, 1.75708338198')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75706746203, 1.75706746203')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75705393023, 1.75705393023')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75704242835, 1.75704242835')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75703265188, 1.75703265188')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75702434202, 1.75702434202')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75701727875, 1.75701727875')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75701127508, 1.75701127508')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75700617205, 1.75700617205')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75700183455, 1.75700183455')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75699814775, 1.75699814775')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75699501403, 1.75699501403')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75699235042, 1.75699235042')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75699008639, 1.75699008639')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75698816201, 1.75698816201')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75698652632, 1.75698652632')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75698513602, 1.75698513602')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75698395428, 1.75698395428')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75698294983, 1.75698294983')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75698209606, 1.75698209606')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75698137037, 1.75698137037')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75698075355, 1.75698075355')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75698022926, 1.75698022926')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697978363, 1.75697978363')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697940485, 1.75697940485')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697908289, 1.75697908289')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697880923, 1.75697880923')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697857663, 1.75697857663')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697837892, 1.75697837892')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697821087, 1.75697821087')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697806803, 1.75697806803')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697794662, 1.75697794662')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697784343, 1.75697784343')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697775571, 1.75697775571')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697768115, 1.75697768115')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697761778, 1.75697761778')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697756392, 1.75697756392')
[supervisor] ('Role: ', True, ' Message received to split: ', u' 0, 0, 0, 0, 0, 0, 0, 0, 1.75697751814, 1.75697751814')
[supervisor] ('Role: ', True, ' Message received to split: ', u'')
WARNING: 'supervisor' controller exited with status: 1.
omichel commented 4 years ago

:eyes: (I suspect that a message from a socket is not fully read in some cases, I will try to reproduce and fix this)

omichel commented 4 years ago

I assume this happens on Linux with Python 2.7, right?

chshong commented 4 years ago

Yes, my testing environment was Ubuntu 16.04, Python 2.7

omichel commented 4 years ago

I believe I fixed the problem here: https://github.com/omichel/test_world/pull/14 Can you check it and approve the PR if that works for you as well?

chshong commented 4 years ago

This maybe an unrelated issue but I keep getting below message even when I change the shebang of supervisor.py to #!/usr/bin/python3

[supervisor] DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of Webots will drop support for Python 2.7.

Does Webots print the message regardless of the Python version using?

chshong commented 4 years ago

Can you make a working example of image-fetch in python? It seems like simply migrating the old example to new example does not work. Are the contents of 'subimages' sent by the supervisor different from the old one?

DavidMansolino commented 4 years ago

Can you make a working example of image-fetch in python? It seems like simply migrating the old example to new example does not work. Are the contents of 'subimages' sent by the supervisor different from the old one?

The format is similar (same base64 encoding and same sub-image resolution) however, it is encoded in a JSON string. I will create a simple image-fetch example in python.

omichel commented 4 years ago

Webots is ignoring the shebang line in controller programs. Rather, it is using the python version specified in the Webots preferences, regardless of the shebang. So, if the Webots preferences specify python2, it will use python2 even though the shebang request python3. We could possibly fix that in Webots, but it will be integrated only in the next version.

chshong commented 4 years ago

Okay, I think I should notify this along with AIWC simulation program distribution since the message may confuse the participants

DavidMansolino commented 4 years ago

It may be possible to force the use of python3 using a runtime.ini file close to the controller: https://cyberbotics.com/doc/guide/controller-programming#languages-settings

omichel commented 4 years ago

About the speed of execution, we investigated but found that webots uses 90% of the CPU of one core while the python controllers use about 15% of the CPU on another core. Therefore, the Python controllers are not the performance bottleneck. So, I don't understand why you get such a bad performance with the python controller. Can you provide more detail about your configuration (operating system, Python version, number of CPU cores, graphics card, etc.)? Thank you.

chshong commented 4 years ago

My OS: Ubuntu 16.04, Windows 10 (the issue happens on both) Python version: 2.7.12, 3.7.3 (the issue happens on both) CPU Cores: 8 GPU: GTX1080ti

However, I believe this is an issue happening inside the supervisor controller because the simulation slows down at the beginning of the game only and returns to normal speed when a goal happens and the field is reset. Regardless of when the first goal happened, the speed returned to normal so I think the issue is happening due to some part of the initialization of the system that are reset when a goal happens.

p.s. from tomorrow until upcoming Sunday, I am on a vacation that I would not be able to respond

omichel commented 4 years ago

We just fixed the support of Python shebang here: https://github.com/omichel/webots/pull/800.

omichel commented 4 years ago

We just fixed the performance problem you reported (14) here: https://github.com/omichel/test_world/pull/16

omichel commented 4 years ago

We just fixed the time of the end of the game (7.6) here: https://github.com/omichel/test_world/pull/17.

omichel commented 4 years ago

We cannot reproduce 9.1 on Linux. So I will consider it's fixed unless you can still reproduce the problem.

chshong commented 4 years ago

Now I am back on work.

Regarding issue 9.1, I think this issue was fixed when commit 2cec48 happened.

Other fixes, I will check from now and get back to you if I find something

chshong commented 4 years ago

About issue 2.1, replacing PIL to cv2 is simple as below

Replace from PIL import Image to import cv2

Replace

            for j in range(h):
                for k in range(w):
                    self.ImageBuffer[j + y, k + x, 0] = image[j, k, 2]  # red channel
                    self.ImageBuffer[j + y, k + x, 1] = image[j, k, 1]  # green channel
                    self.ImageBuffer[j + y, k + x, 2] = image[j, k, 0]  # blue channel
        # Uncomment this part to display the image
        img = Image.fromarray(self.ImageBuffer, 'RGB')
        img.show()

to

            for j in range(h):
                for k in range(w):
                    self.ImageBuffer[j + y, k + x, 0] = image[j, k, 0]  # blue channel
                    self.ImageBuffer[j + y, k + x, 1] = image[j, k, 1]  # green channel
                    self.ImageBuffer[j + y, k + x, 2] = image[j, k, 2]  # red channel
        # Uncomment this part to display the image
        cv2.imshow('image', self.ImageBuffer / 255.0)
        cv2.waitKey(1)
DavidMansolino commented 4 years ago

Yes indeed, since the buffer is a numpy buffer, it should be directly compatible with opencv.

chshong commented 4 years ago

I added general_check-variables_py example to this branch. This program can be useful in debugging data managements as it prints all value based items the participant program receives.

omichel commented 4 years ago

About (19): only the nightly build version of Webots takes into account the shebang on Linux. Webots R2019b doesn't. Can you test with a nightly build and confirm?

chshong commented 4 years ago

@omichel I just tested with the cpp version of the aiwc system and confirmed that the shebang is taken into account. Shouldn't it be taken into account on the participant programs since they are run as child processes run separately from the supervisor which is directly launched by Webots?

(I put shebang of one example to use python2 and the other to use python3)

[supervisor] 2019-08-22T10:13:36+0900 I am the reporter for this game!
[supervisor] 3.5.2 (default, Nov 12 2018, 13:43:14) 
[supervisor] [GCC 5.4.0 20160609]
[supervisor] 2019-08-22T10:13:36+0900 I am ready for the game!
[supervisor] 2019-08-22T10:13:36+0900 I am the commentator for this game!
[supervisor] Starting a new game
[supervisor] 2.7.12 (default, Nov 12 2018, 14:36:49) 
[supervisor] [GCC 5.4.0 20160609]
[supervisor] 2019-08-22T10:13:42+0900 I am ready for the game!
omichel commented 4 years ago

You are right. I misread (19), unlike previous versions, the new version of Webots actually takes into account the shebang to start Webots controllers. But what you report is about the Python supervisor starting participant programs ignoring the shebang. I will investigate this problem now.

omichel commented 4 years ago

I just proposed a fix for (19) in https://github.com/omichel/test_world/pull/22. Can you review it and approve it if that works for you?

DavidMansolino commented 4 years ago

I can indeed reproduce the issue 2.1, that's very strange because at some point it was working fine, I will fix it and try to switch to opencv instead of pil.

DavidMansolino commented 4 years ago

The issue 2.1 is caused by omichel/test_world#16, if I remove this patch then it works fine: Capture du 2019-08-26 13-36-45

DavidMansolino commented 4 years ago

2.1 should now be fixed, @chshong can you please confirm it is now working for you too?

chshong commented 4 years ago

@DavidMansolino Yes the images are updated accordingly. However, 1) Currently the R channel and B channel in the numpy buffer are flipped 2) Please leave the imshow() part uncommented so that the participants can see the image directly when the program is run without any edits.

DavidMansolino commented 4 years ago
  1. Currently the R channel and B channel in the numpy buffer are flipped
  2. Please leave the imshow() part uncommented so that the participants can see the image directly when the program is run without any edits.

This is now fixed in omichel/test_world#25

chshong commented 4 years ago

@omichel Can you give @lfelipesv permissions to make changes on Python porting fork? He will join us reviewing this work from this Wednesday or Thursday.

omichel commented 4 years ago

Done. I just added @lfelipesv as a developer on our repo.

chshong commented 4 years ago

Issue 7.8 seems to be still existing, I will investigate this more and reply back

nevermind

chshong commented 4 years ago

Regarding the image data sent from supervisor to participants, does the supervisor send image with RGBA channels instead of RGB channels? If so, how should the supervisor be changed to make the supervisor send RGB image instead of RGBA image? This is because since the AIWC system does not use the alpha channel, it would be more efficient to send RGB only.

Also, can you check the C++ general_image-fetch example pushed here? It currently has two issues. 1) The program cannot be compiled with Makefile & Webots combination (probably library path with opencv libraries are not handled correctly in the Makefile). 2) The received data look correct, but how the received image is displayed on the screen implies the pixel data order is not handled correctly (I copied the image handling method from general_image-fetch_cpp of old example so it can be possible that the data order was changed when the supervisor system was ported to python version)

DavidMansolino commented 4 years ago

Yes, the supervisor does indeed send RGBA channels, this is done for efficiency reason, on the supervisor side we do send all the image in a bulk, this avoid having to loop through each pixels and therefore speedup the sending of images (we do indeed send a bit more data, but this is still more efficient than having to loop through each pixels).

I will check your C++ general_image-fetch example.