Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Estop and bumper use active #281

wants to merge 3 commits into from

Conversation

Johannes-Thiel
Copy link
Contributor

@Johannes-Thiel Johannes-Thiel commented Apr 28, 2025

The bumper and estops still use the level of the Inputs. With the introduction of the active 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 of level. This is a breaking change.

Copy link
Contributor

@falkoschindler falkoschindler left a 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']
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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
Copy link
Contributor

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
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants