Skip to content
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

Version 2 #184

Merged
merged 387 commits into from
Feb 2, 2021
Merged

Version 2 #184

merged 387 commits into from
Feb 2, 2021

Conversation

glipR
Copy link
Contributor

@glipR glipR commented Oct 27, 2020

Required / Easy changes

Wishlist

=======================

Update:
I've got pretty much all the features I was hoping for/thought were reasonable in the branch now (open to suggestions however, of course)

Here's a final checkbox of things to do before this branch is safe to merge and release (stuff might be added, but adding small things as comments won't happen anymore):

Documentation

  • Installation (Windows)
  • PyInstaller distributable installation (Mac/Linux) Not happening for now.
  • pip installation / usage
  • Object Hierarchy updated (sims, bots, presets) and simplified
  • Console Usage / Features
  • Custom preset definitions

Executable

  • Make workflows for and test pyinstaller directories for mac and linux Not happening for now.
  • Update installer to use new logo if available

Cleanup

  • Abstract button events in all pygame_gui code.
  • Remove generateObjects and sizeObjects, and just define each object once. Add a method to update the theming based on state.
  • Remove unused imports from all files.
  • Review the introduced structure and see if there's a better way of going about the gui design
  • Simplify the preset surface (The code is currently very verbose, and making future presets is currently annoying).

Touchup

  • New logo (V happy with outside input on this).
  • Redesign Bot/Batch select screens (I have ideas).
  • Redesign Rescue screen (if worthwhile, maybe just change colours). Not happening for now.
  • Push requirements up where appropriate.

System changes

  • Make presets able to create visuals with pygame gui (Give interactors an applyToScreen method or something)
  • Ultrasonics seem broken?
  • Move ScreenObjectManager methods to Sim menu where appropriate. Decided against this.
  • Extend the events system.
  • Fix bugs with pressing delete in edit modes.
  • Allow rectangular baseplates.
  • Fix rotation bug with devices in bot editor.

Doesn't seem like tests are going to happen, not from me at least :).

@glipR glipR added documentation Improvements or additions to documentation enhancement New feature or request future Future/Stretch features that would be nice to have labels Oct 27, 2020
@peter-drew peter-drew marked this pull request as draft October 30, 2020 07:57
@emilytrau
Copy link
Contributor

Crash when closing the bot script selection dialog without a file selected

Traceback (most recent call last):
  File "/home/angus/Documents/git/MHSRobotics/ev3sim/venv/bin/ev3sim", line 33, in <module>
    sys.exit(load_entry_point('ev3sim', 'console_scripts', 'ev3sim')())
  File "/home/angus/Documents/git/MHSRobotics/ev3sim/ev3sim/gui.py", line 224, in main
    raise error
  File "/home/angus/Documents/git/MHSRobotics/ev3sim/ev3sim/gui.py", line 213, in main
    StateHandler.instance.mainLoop()
  File "/home/angus/Documents/git/MHSRobotics/ev3sim/ev3sim/simulation/loader.py", line 347, in mainLoop
    events = ScreenObjectManager.instance.handleEvents()
  File "/home/angus/Documents/git/MHSRobotics/ev3sim/ev3sim/visual/manager.py", line 247, in handleEvents
    self.screens[self.screen_stack[-1]].handleEvent(event)
  File "/home/angus/Documents/git/MHSRobotics/ev3sim/ev3sim/visual/settings/menu.py", line 128, in handleEvent
    obj.handlePressed(idx - index)
  File "/home/angus/Documents/git/MHSRobotics/ev3sim/ev3sim/visual/settings/elements.py", line 157, in handlePressed
    filename = askopenfilename().replace("/", "\\")
AttributeError: 'tuple' object has no attribute 'replace'

@glipR
Copy link
Contributor Author

glipR commented Jan 28, 2021

Crash when closing the bot script selection dialog without a file selected ...

Fixed @angustrau

Using the backspace key in the radius field of the bot editor (on a new bot) causes simulator to crash.

ev3sim\visual\menus\bot_edit.py", line 206, in removeSelected raise ValueError("The remove button should not be visible at the moment.") ValueError: The remove button should not be visible at the moment.

This was fixed a while back. You probably have an old version installed. Just use the .exe from https://github.com/MelbourneHighSchoolRobotics/ev3sim/releases/tag/untagged-028dedf37b832215eb1f

Should we throw an error when no bot selected or fail gracefully?

ev3sim\presets\rescue.py", line 464, in locateBots raise ValueError("No robots loaded.") ValueError: No robots loaded.

Will do this tonight, need to add functionality for some error dialogs in generic menus.

How is lack of progress in rescue determined? At least using the controllable bot, it appears that it might be too aggressive. But further testing needed.

Possibly. The getting stuck in lack of progress issue I can possibly fix, but tweaking the lack of progress stuff is probably best for 2.1. I can point you towards where these calibration constants are defined.

(@peter-drew @angustrau thanks for the comments)

@glipR
Copy link
Contributor Author

glipR commented Jan 28, 2021

Ok, the no bots error has also been fixed, and furthermore I've gone through and removed any other explicit raise ValueErrors which should instead be gui error dialogs. That being said its very likely I'm assuming certain things about input, and so more errors are likely to occur.

@peter-drew lmk if you run into any more bugs. I think for now we can leave the rescue lack of progress stuff, you can always reset when this occurs.

@peter-drew
Copy link
Member

Thanks @glipR , will take another look tomorrow.

@glipR
Copy link
Contributor Author

glipR commented Jan 31, 2021

The site link change looks good to me, will build and try the installer in a sec.
Going to set up some simple error logging tonight on the exe as I'm sure we'll get some bug reports, then provided you don't have any more bugs to add am happy to merge.

@peter-drew
Copy link
Member

Haven't actually had an opportunity to look again yet, will take a look and let you know.

@glipR
Copy link
Contributor Author

glipR commented Jan 31, 2021

Error logging seems to work, will add a small line in the issue template to mention that this exists.

The only current outstanding thing atm it seems is the rescue thing, which I'm fine for keeping as is, at least until 2.1.

The font warning takes a bit of effort to get around and has 0 effect on the exe, as the warning is suppressed. So for now I'll ignore that too.

As for anything else I've avoided for 2.0 release and might want to revisit:

  • Anything from the checkboxes at the top of the PR
  • Rescue fixes
  • Support randomisation through the GUI

Otherwise lmk if you run into anything @peter-drew

@peter-drew
Copy link
Member

Got this error when editing a bot plate, can't remember specifics:
Traceback (most recent call last):
File "c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\ev3sim\gui.py", line 213, in main
StateHandler.instance.mainLoop()
File "c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\ev3sim\simulation\loader.py", line 352, in mainLoop
ScreenObjectManager.instance.applyToScreen()
File "c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\ev3sim\visual\manager.py", line 231, in applyToScreen
self.screens[self.screen_stack[-1]].draw_ui(blit_screen)
File "c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\ev3sim\visual\menus\bot_edit.py", line 1582, in draw_ui
ScreenObjectManager.instance.applyToScreen(to_screen=self.bot_screen)
File "c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\ev3sim\visual\manager.py", line 228, in applyToScreen
self.objects[key].applyToScreen(blit_screen)
File "c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\ev3sim\visual\objects.py", line 591, in applyToScreen
self._applyToScreenGfx(screen)
File "c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\ev3sim\visual\objects.py", line 572, in _applyToScreenGfx
pygame.gfxdraw.aaellipse(screen, *self.point, self.h_radius, self.v_radius, self.stroke)
OverflowError: signed short integer is greater than maximum

Got this one when putting a negative plate diameter:
Traceback (most recent call last):
File "c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\ev3sim\gui.py", line 213, in main
StateHandler.instance.mainLoop()
File "c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\ev3sim\simulation\loader.py", line 352, in mainLoop
ScreenObjectManager.instance.applyToScreen()
File "c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\ev3sim\visual\manager.py", line 231, in applyToScreen
self.screens[self.screen_stack[-1]].draw_ui(blit_screen)
File "c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\ev3sim\visual\menus\bot_edit.py", line 1582, in draw_ui
ScreenObjectManager.instance.applyToScreen(to_screen=self.bot_screen)
File "c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\ev3sim\visual\manager.py", line 228, in applyToScreen
self.objects[key].applyToScreen(blit_screen)
File "c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\ev3sim\visual\objects.py", line 591, in applyToScreen
self._applyToScreenGfx(screen)
File "c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\ev3sim\visual\objects.py", line 572, in _applyToScreenGfx
pygame.gfxdraw.aaellipse(screen, *self.point, self.h_radius, self.v_radius, self.stroke)
pygame.error: Surface doesn't have a colorkey

@peter-drew
Copy link
Member

Neither of these are blocking bugs

Copy link
Member

@peter-drew peter-drew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to merge, no critical bugs. I'm sure the students will find any issues.

@glipR
Copy link
Contributor Author

glipR commented Feb 2, 2021

Fixed both bugs you mentioned, thanks for that.
Have also made it so that the scrolling feature for values doesn't accrue small amounts (So 1.4 goes to 1.5 always, not 1.49999 or 1.500001)

Going to merge now.

@glipR glipR merged commit e9c33e6 into main Feb 2, 2021
@glipR glipR deleted the version_2 branch February 2, 2021 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request future Future/Stretch features that would be nice to have
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants