ev3dev-python-tools / ev3dev2simulator

Simulator for an EV3 robot; a program using the ev3dev2 API can run both on the rover and on the simulator without any modifications to the code
MIT License
6 stars 9 forks source link

Update the simulator to the version used in ev3dev Stretch R3 #43

Closed jchmrt closed 2 years ago

jchmrt commented 2 years ago

This commit updates the API used to the one that is used in ev3dev-stretch R3. This is the python API version 2.1.0.

The reason this has been done, is because their were problems with bluetooth on the real robots, which should be fixed by the new R3 release. Since the robots used in the lab and the simulator need to support the same API, this commit helps update the simulator. It includes a lot of style changes to the code. This makes the PR a bit harder to review, but incorporating these changes is useful so that we will have less merge conflicts when updating the code in the future.

I'm making this PR already, so that the code can already be looked at. However, before this is merged it is probably best if the new simulator is also tested with the submissions of students from this year, to ensure that everything works correctly.

Method:

First I went through all the commits (24) between the tags ev3dev-stretch/2.0.0_beta5 and ev3dev-stretch/2.1.0, to see which changes their were. Most of the commits were changes to the documentation only. Next there were three commits which mostly changed code style (c4cbe75, 659f539, a4ed6b7).

Finally, there were 5 commits that actually changed functionality/fixed bugs:

Secondly, I used the method described in the wiki to implement the changes into the simulator:

  1. I cloned the ev3dev-lang-python repository.
  2. I checked out the old version that the current simulator is based on (ev3dev-stretch/2.0.0_beta5).
  3. I copied the files from the current simulator onto this repository and committed these changes on a new branch.
  4. I rebased this branch on the new release of the ev3dev-lang-python repository (ev3dev-stretch/2.1.0), using git rebase
  5. I fixed all merge conflicts using the understanding of the changes I gained during the first phase. I took all code style changes from the new release of the original library, so that in the future it will be easier to upgrade to a new version. For the functional changes, I implemented those that had effect and removed those that concerned classes or functions that are not supported by the simulator.
  6. Once the merging was complete, I copied the ev3dev2 folder from the combined repository into a clean repository of the simulator, checked the changes and made this commit.

Testing:

I have tested this commit in a limited way manually, to ensure that the basic functions are working. Furthermore, I have run the automated tests. Through these I discovered a bug in the way I had updated the sound.py script, but this is fixed now. All automated tests now pass.