Skip to content

Commit

Permalink
Adapt Tornado and Safety to Lizard 0.5.2 (#205)
Browse files Browse the repository at this point in the history
Add fix for zauberzeug/lizard#66 for the
tornado.

---------

Co-authored-by: Pascal Schade <pascal@zauberzeug.com>
Co-authored-by: Pascal Schade <165774906+pascalzauberzeug@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 21, 2024
1 parent a5ac67c commit 2254fc0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 56 deletions.
1 change: 0 additions & 1 deletion field_friend/hardware/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from .imu import IMUHardware
from .led_eyes import LedEyesHardware
from .safety import Safety, SafetyHardware, SafetySimulation
from .safety_small import SmallSafetyHardware
from .status_control import StatusControlHardware
from .teltonika_router import TeltonikaRouter
from .tornado import Tornado, TornadoHardware, TornadoSimulation
Expand Down
10 changes: 2 additions & 8 deletions field_friend/hardware/field_friend_hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from .imu import IMUHardware
from .led_eyes import LedEyesHardware
from .safety import SafetyHardware
from .safety_small import SmallSafetyHardware
from .status_control import StatusControlHardware
from .tornado import TornadoHardware
from .y_axis_canopen_hardware import YAxisCanOpenHardware
Expand Down Expand Up @@ -426,13 +425,8 @@ def __init__(self) -> None:
else:
self.status_control = None

safety: SafetyHardware | SmallSafetyHardware
if 'small_safety' in config_hardware:
safety = SmallSafetyHardware(robot_brain, wheels=wheels, estop=estop, bumper=bumper,
y_axis=y_axis, z_axis=z_axis, flashlight=flashlight)
else:
safety = SafetyHardware(robot_brain, estop=estop, wheels=wheels, bumper=bumper,
y_axis=y_axis, z_axis=z_axis, flashlight=flashlight, mower=mower)
safety: SafetyHardware = SafetyHardware(robot_brain, estop=estop, wheels=wheels, bumper=bumper,
y_axis=y_axis, z_axis=z_axis, flashlight=flashlight, mower=mower)

modules = [bluetooth, can, wheels, serial, expander, can_open_master, y_axis,
z_axis, mower, flashlight, bms, estop, self.battery_control, bumper, self.imu, eyes, self.status_control, safety]
Expand Down
3 changes: 2 additions & 1 deletion field_friend/hardware/safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def __init__(self, robot_brain: rosys.hardware.RobotBrain, *,
for name in estop.pins:
lizard_code += f'when estop_{name}.level == 0 then stop(); end\n'
if isinstance(bumper, rosys.hardware.BumperHardware):
for name in bumper.pins:
for name in bumper.pins:
# TODO: remove level = 0 when lizard issue 66 is fixed. https://github.com/zauberzeug/lizard/issues/66
lizard_code += f'bumper_{name}.level = 0\n'
lizard_code += f'when bumper_{name}.level == 1 then stop(); end\n'

Expand Down
46 changes: 0 additions & 46 deletions field_friend/hardware/safety_small.py

This file was deleted.

7 changes: 7 additions & 0 deletions field_friend/hardware/tornado.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ def __init__(self, robot_brain: rosys.hardware.RobotBrain, *,
{name}_ref_knife_ground.inverted = true
{name}_z = {expander.name + "." if motors_on_expander and expander else ""}MotorAxis({name}_motor_z, {name + "_end_bottom" if is_z_reversed else name + "_end_top"}, {name + "_end_top" if is_z_reversed else name + "_end_bottom"})
# TODO: remove when lizard issue 66 is fixed. https://github.com/zauberzeug/lizard/issues/66
{name}_ref_motor.level = 0
{name}_ref_gear.level = 0
{name}_ref_knife_stop.level = 0
{name}_ref_knife_ground.level = 0
{name}_ref_knife_ground.active = false
bool {name}_is_referencing = false
bool {name}_ref_motor_enabled = false
bool {name}_ref_gear_enabled = false
Expand Down

0 comments on commit 2254fc0

Please sign in to comment.