-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
split robot controllers into separate files #30
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact that the filenames are so long is rather unfortunate but what can we do -- I guess this is the price we'll have to pay 🙂
I have only a couple of nitpicks @Adman, most of them left by myself anyway, so feel free to discard any that do not make sense.
Thanks for putting this together!
@mrshu So, I created an abstract robot class, which is located in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this together @Adman!
The bureaucracy at the beginning of the file is a small price to pay for the ability to share code among robots. I think we can live with that.
One last small suggestion: if possible, I think it would make sense to create a two-team folder structure, something like
$ tree team_robots
team_robots/
├── teamA
│ ├── robot1
│ │ └── robot1.py
│ ├── robot2
│ │ └── robot2.py
│ ├── robot3
│ │ └── robot3.py
│ └── utils
│ └── rcj_serializer.py
└── teamB
├── robot1
│ └── robot1.py
├── robot2
│ └── robot2.py
├── robot3
│ └── robot3.py
└── utils
└── rcj_serializer.py
We could then reflect that in the README as well, and make it so that each folder in team_robots
is a separate Git repository on its own. Would that make sense?
@mrshu Regarding directory structure comment: Not sure if this directory structure is going to work. Each robot controller needs to be put into |
You are probably right @Adman, there is a good chance it is not going to work. I checked the docs and it does not seem like I guess that only leaves us with one option: symlinking common code. Since it ought to be supported on (modern) Windows as well, I guess it may actually work. The folder structure we'd end up with would then look as follows:
It's not very pretty, but we could at least get rid of the bureaucracy at the top of files and actually make these work with Webots. On the downside, this will force us to do two other things:
I guess we can live with that, although I must say it really does not look nice -- more like the opposite. |
fde8daf
to
5138e37
Compare
@mrshu We have to decide between two options when we are preparing the match.
If we decide to go with the second option, we effectively destroy the possibility to create symlinks. |
@Adman Good point. I don't see any other way than going with 1., changing the folder/script name can have such a massive amount of unintended consequences due to how Webots implements it, that it does not seem to be worth it in any way. |
@Adman please feel free to let me know if there is anything I ought to take a closer look at here. |
@mrshu Computing the angles has been moved to abstract robot class. Would you like me to create example utils.py scripts as well as symlinks from other controller folders? |
@Adman I'd much appreciate that -- please feel free to go ahead! |
@mrshu I created the file utils.py within B1 and Y1 controller folders and utils.py symlinks from B2,B3 to B1 and Y2,Y3 to Y1. |
@felipenmartins Seems unrelated to this pull request. We probably need to investigate how paths in windows work :( Could you please check if the problem persists on master branch as well? |
The creation of the utils.py also created errors. Now, for all robots I get the following error message:
|
Yes. I just cloned the master again. The errors related to the "utils" disappeared, but the error related to the json file is still there:
|
@felipenmartins Could you try this https://stackoverflow.com/a/59761201 and then clone the repository with demo-players branch again ? |
@Adman Do you want me to enable "Developer mode" and enable symlinks? I guess I could try it, but wouldn't the error persist because of the ":" character in the json file name?
|
@Adman I have enabled Developer Mode, but I don't know how to "enable symlinks". I have GitHub Desktop installed, but the command
does not work. It says "git is not recognized", or something. I tried with
which opens the GitHub desktop app, but does not change any configuration (apparently). After that I cloned the branch again, but the errors with the "utils" persist. |
@felipenmartins let me merge master to this branch, that should fix the
errors. With regards to the GitHub desktop app, do you think it would be possible to open something like a "git" terminal from the app? That is where |
Ah, it seems like what I was thinking of no longer exists... |
@mrshu @felipenmartins I changed the controller structure so that each robot controller folder contains both abstract robot class and utils file. I completely don't like it but it will make the life easier so we are not hacking around the paths and symbolic links. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Adman Now that you copied "utils.py" and "rcj_soccer_robot.py" to all robot folders, it works on my Windows machine. :-)
I wonder: is it possible to make just one file from the content of "utils.py" and "rcj_soccer_robot.py"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Adman Please, ignore my previous comment about merging the files utils and rcj_soccer_player. Now I understand that it is actually appropriate that they are independent files.
So, from me, this is good!
Thanks @Adman but I really don't think we can do it this way. By copying identical code we are teaching the wrong paradigm. I would really prefer us do some bureaucracy in the beginning of the files rather than having verbatim copies of the same code over and over. You know very well how it is: you change one file, forget to change the rest and spend the next three hours debugging what's wrong. There is a good chance this will save us some headaches in the beginning but I worry that we'll have to do a complete overhaul in the future because sharing code between robots will be extremely cumbersome. That said, if despite all this you think it would make more sense this way, I am happy to try it out ;) |
Signed-off-by: Adrian Matejov <ado.matejov@gmail.com>
Signed-off-by: Adrian Matejov <ado.matejov@gmail.com>
Signed-off-by: Adrian Matejov <ado.matejov@gmail.com>
Signed-off-by: Adrian Matejov <ado.matejov@gmail.com>
* others can import it from there Signed-off-by: Adrian Matejov <ado.matejov@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry it took this may tries @Adman -- thanks for pushing it through!
The only small comment I'd have would be about @felipenmartins's variables. I believe he altered the speed a bit in order for the game to be a bit more interesting. I am not sure if that survived but I guess we can update that real quick any time we want in the future.
Let's get this merged in!
Signed-off-by: Adrian Matejov ado.matejov@gmail.com