Open omichel opened 4 years ago
I checked your general_image-fetch example, the Makefile has several issues:
cppcodec
library is wrong.opencv
library is missing.opencv
library is wrong.ws2_32
on Windows.LIBRARIES
variable is not used for the link pass.Here is an example with all this corrections (of course you may need to adjust path and version of opencv):
CXX := g++
CXXFLAGS := -pedantic-errors -Wall -std=c++14
BUILD := ./build
OBJ_DIR := $(BUILD)/objects
TARGET := general_image-fetch
INCLUDE := -I../common -I../../extlibs/cppcodec/include -I../../extlibs/opencv/include
LIBRARIES := -L../../extlibs/opencv/x64/vc16/bin -lopencv_core346 -lopencv_highgui346 -lws2_32
SRC := general_image-fetch.cpp ../common/participant.cpp
OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o)
all: build $(TARGET)
@echo "Done."
$(OBJ_DIR)/%.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ -c $<
$(TARGET): $(OBJECTS)
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBRARIES)
.PHONY: all build clean debug release
build:
@mkdir -p $(OBJ_DIR)
debug: CXXFLAGS += -DDEBUG -g
debug: all
release: CXXFLAGS += -O2
release: all
clean:
-@rm -rvf $(BUILD)
-@rm -rvf $(TARGET)
I am not an expert of opencv, so maybe some libraries links are still missing, but the structure is now correct. Let me know if you still have issues with this.
Thank you. I have found that mainly $(LIBRARIES) part missing was where I could not locate the issue.
Regarding ws2_32, I think we should modify Makefiles a bit to make it not try to link the windows library on Linux.
Were you able to locate the issue making the displayed image incorrectly on image-fetch C++ example?
From tomorrow, I will not be on work for 4 weeks for my country's military service. @lfelipesv will continue from here working on this project.
Regarding ws2_32, I think we should modify Makefiles a bit to make it not try to link the windows library on Linux.
You are completely right, this should be included only in the Windows case (i.e. encapsulated in a if condition).
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)
I am not able to compile it (because of missing dependencies, such as opencv on my system). But the handeling method should be very similar to the previous version (except that the A channel is sent too, but I saw you already updated this). I checked in particular this part: https://github.com/omichel/test_world/blob/feature/new_examples/examples_new/general_image-fetch_cpp/general_image-fetch.cpp#L46 and everything seems fine. How does look like the image displayed?
Hi, I am developing a C++ reporter example and I found some problems:
(solved.) The GAME_END flag is received in the finish() method.
When a robot is kicking a penalty, if the ball enter the goal and go out the goal before the game is restarted, the simulator does not count the goal and the game is not restarted.
The touch still does not seem to work well, as the robots seems to always wait 3s before unlock again in Kickoff, CornerKick and Goalkick situations. (I think this problem is already related to the issue list)
Regards.
Hi Felipe, nice to see you posting here. I see that you resolved (1). Did you patch the python supervisor? If so, it would be nice to create a new PR to commit your changes here: https://github.com/omichel/test_world
I will investigate (2) and (3) today and revert back to you about it.
I cannot reproduce (3). For me at the kick-off, as soon as a robot hits the ball, all the other robots start moving. Are you sure you are up-to-date with https://github.com/omichel/test_world on the develop branch?
About (2): I believe it might happen if the time step at which the supervisor is monitoring the ball position is too high. Lowering this time step might fix the problem. I will try to implement this next week.
Hi Olivier =),
I will create another branch from Chansol's one in the https://github.com/omichel/test_world repository.
About (3), test if you can reproduce for Cornerkicks and Goalkicks situations.
I will check the supervisor about the time step problem with (2), thanks.
I just tested both the corner kick and goal kick situations and still cannot reproduce (3). The other players start moving as soon as the ball is hit.
Interesting. I tested in two computers and it seems that it never enter the loop from line 457 (supervisor.py). Also I printed the touch vector from line 1006 and is always False (for all the robots).
I think (2) and (3) are related to the touch problem, because if there is no touch in the penalty kick, the game is never back to STATE_DEFAULT.
Are sure you recompiled the physics plugin in https://github.com/omichel/test_world/tree/develop/plugins/physics/collision_detector?
It was the compilation. Thanks! (1), (2), (3) solved.
Hi @omichel,
I was checking the issue number 17. To solve: _"If any of AI Soccer participant was not ready within WAIT_READYMS seconds, the game should be terminated." would be possible to create a wait_ready_ms variable in the else loop of the lines 959-961 of the supervisor? Add self.timeStep to the variable and then compare with constants.WAIT_READY_MS, finishing the program if the participants are not ready after the waiting time?
Would be possible to add the feature: "Improve the sound effects (ball kick, ball bounce on borders, poles, players, player to player contacts, etc.)" for the recording of the matches of the competition that will be held in upcoming November?
Best Regards.
Hi @omichel,
Regarding sound recording, yes, this is an issue. We currently have no solution to record a movie and sound at the same time. The only way would be to display Webots in full screen and record both the video and audio using some external video/audio recording tool, not the built-in Webots movie feature.
@omichel, i sent a pull request with a simple fix for (17).
Regards.
I just reviewed, accepted and merged your pull request for (17).
@omichel , I found a bug: when the "deadlock" is changed to false in config.json, the deadlock is still enforced.
The solution is to change line 730 of the supervisor.py file to:
if not config['rule']['deadlock']:
Regards.
Hi @lfelipesv: I just applied you patch here: https://github.com/omichel/test_world/pull/31 In the future, feel free to create a pull request yourself to fix bugs you may find. Thank you!
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:
[x] 1. Commentator and Reporter APIs: Fixed by @stefaniapedrazzi.
[x] 2. The Python supervisor does not transfer image frames to the participant programs (also image_buffer.cpp/hpp is not in Python counterpart). Fixed by @davidmansolino.
[ ] 3. C++ participant example program is missing.
player_random-walk_py
was converted to C++ by @davidmansolino,[x] 4. Robot positions reset are not matched to the formations. Fixed by @chshong.
[x] 5. The sample participant program is not working as intended: If the program is correct, F2 robot should move toward and kick the ball to initiate the kickoff. Instead, F2 robot seems to move away from the ball (it seems like it is highly possible that either incorrect position/orientation data are sent to the participant or the wheel speeds sent from the participant programs are not applied to the robots correctly. Fixed by @omichel.
[x] 6. The key string is not used in validation of the participant programs' credentials. The only place the key is used is in Line 171. Since this only checks if the key is same with Team RED's key, the commentator and the reporter will be able to control Team BLUE's robots if they use 'aiwc.set_speeds'. In the cpp program, 'aiwc.set_speeds' can only be used by red and blue participants, 'aiwc.comment' by commentator, and 'aiwc.report' by reporter. Fixed by @stefaniapedrazzi .
[x] 7. Rules do not seem to be applied accordingly.
[x] 8. The timestamp (one updated by update_label()) is not updated in real time but once in a second. Fixed by @chshong.
[x] 9. 'address already in use' error seems to happen occasionally. Fixed by @stefaniapedrazzi.
[x] 10. reset_reason messages are sent to the client programs multiple times instead of just one. Fixed by @stefaniapedrazzi.
[x] 11. frame messages sent could be concatenated and truncated when reading them from the socket buffer in the client program. Fixed by @stefaniapedrazzi and @DavidMansolino.
[x] 12. Remove the dependency on
boost
from thesoccer_robot
controller. Fixed by @omichel.[x] 13. 'data path' not handed over to AI Soccer programs. Fixed by @stefaniapedrazzi.
[x] 14. The simulation runs slower than when C++ controllers were used (with C++ controllers, the simulation usually ran in x1.0. with Python controllers, the simulation runs in about x0.66). Simulation not running in real-time can greatly affect participant programs since the simulation should be asynchronous. (additional note: This looks like a bug. The simulation returns to x1.0 speed when a goal is made and game is resumed. Only the "beginning->first goal of the game" segment is slowed down) (additional note 2: The issue looks more severe on Windows. The simulation speed even drops to about x0.33. The simulation returns to normal speed just like on Linux after a goal is made.). Fixed by @omichel.
[x] 15. The reporter's report is not received by the supervisor.
[x] 16. Participant programs seem to start operate 0.2-0.5 seconds (in simulation game_time) after the game begins. This can be seen by the timestamp put on the comments and the robots not moving for about first 0.2-0.5 seconds. Fixed by @omichel (note: after fixing 14, I could not reproduce this problem).
[ ] 17. The supervisor does not start or terminate the game after WAIT_READY_MS seconds have passed when one of programs does not send aiwc.ready. If at least two AI Soccer participants are ready, the supervisor should drop not responding commentator/reporter and start the game. If any of AI Soccer participant was not ready within WAIT_READY_MS seconds, the game should be terminated.
[x] 18. The goalkeeper behavior of rulebased when put on Team B seems to imply that the team acts as if they are located on left in view of spectators. The data sent to Team B should be rotated by 180 degrees.
[x] 19. When the supervisor launches the participant program, it ignores the shebang on Linux. (Although the shebang specified python3, the python launched is python2 - can be checked by print(sys.version))
[ ] 20. The supervisor publishes frames 10 ms period (basic time step) instead of 50 ms period (PERIOD_MS). (In the C++ AIWC system, we have
game::step(std::size_t ms)
method to be used instead of directly using Webots' supervisor step method.) This mismatch between the basic time step and supervisor step was an intended one so that the simulator can have more continuous simulation (such as minimizing the chance for the ball to pierce through robots due to the simulation step being too large) while the participants can control the robot with 50 ms period (50 ms is the control period of real AI Soccer robots).[ ] 21. The comments made by commentator are handled bit delayed. When a goal is made, the commentator's "Team Red Scored!!" message was shown immediately in C++ system. In current Python system, the message is displayed only after the field is reset and the game resumes. (I checked that the commentator program receives the frame as soon as the goal is made. However, when the commentator program sends the comment to the supervisor,
callback(self, client, message)
method is called after the game resumes instead of before the game goes in halt.)[ ] 22. In the game_info json, unnecessary information are handed over to the participants (team_info and key). In the case of 'key', TeamA's key is distributed to the commentator and reporter in game_info that this makes a door for the commentator and reporter algorithms to masquerade as Team A.