-
Notifications
You must be signed in to change notification settings - Fork 13
Estop and bumper use active #281
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
base: main
Are you sure you want to change the base?
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.
There are some round brackets that should be removed
as well as two member variables that could be removed...
super().__init__(robot_brain=robot_brain, | ||
lizard_code=lizard_code, | ||
core_message_fields=core_message_fields, | ||
estop=estop) | ||
|
||
def handle_core_output(self, time: float, words: list[str]) -> None: | ||
active_bumpers = [pin for pin in self.pins if int(words.pop(0)) == 1] | ||
active_bumpers = [pin for pin in self.pins if (words.pop(0)) == 'true'] |
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.
active_bumpers = [pin for pin in self.pins if (words.pop(0)) == 'true'] | |
active_bumpers = [pin for pin in self.pins if words.pop(0) == 'true'] |
super().__init__(robot_brain=robot_brain, lizard_code=lizard_code, core_message_fields=core_message_fields) | ||
|
||
async def set_soft_estop(self, active: bool) -> None: | ||
await super().set_soft_estop(active) | ||
await self.robot_brain.send(f'en3.level({"false" if active else "true"})') | ||
|
||
def handle_core_output(self, time: float, words: list[str]) -> None: | ||
corelist = [int(words.pop(0)) == 0 for _ in self.pins] | ||
corelist = [(words.pop(0)) == 'true' for _ in self.pins] |
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.
corelist = [(words.pop(0)) == 'true' for _ in self.pins] | |
corelist = [words.pop(0) == 'true' for _ in self.pins] |
self.name = name | ||
self.pins = pins | ||
self.inverted = inverted |
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.
This member variable isn't used. Should we remove it?
self.name = name | ||
self.pins = pins | ||
self.inverted = inverted |
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.
This member variable isn't used. Should we remove it?
The bumper and estops still use the
level
of the Inputs. With the introduction of theactive
property to Lizard in zauberzeug/lizard#38 we can make the code more readable and understandable. This also allows us to invert the inputs for specific robot configurations.With this change we will need to reconfigure our robots to use
active
instead oflevel
. This is a breaking change.