Skip to content

Commit

Permalink
Update airo-tulip to 0.0.3 for compliant mode
Browse files Browse the repository at this point in the history
  • Loading branch information
m-decoster committed Aug 14, 2024
1 parent 6dcbbcd commit 952999e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
19 changes: 16 additions & 3 deletions airo-robots/airo_robots/drives/hardware/kelo_robile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import time

from airo_tulip.platform_driver import PlatformDriverType
from airo_tulip.server.kelo_robile import KELORobile as KELORobileClient

from airo_robots.awaitable_action import AwaitableAction
from airo_robots.drives.mobile_robot import MobileRobot
from airo_tulip.server.kelo_robile import KELORobile as KELORobileClient


class KELORobile(MobileRobot):
Expand All @@ -22,11 +24,22 @@ def __init__(self, robot_ip: str, robot_port: int):
robot_port: Port to connect on."""
self._kelo_robile = KELORobileClient(robot_ip, robot_port)

def set_platform_velocity_target(self, x: float, y: float, a: float, timeout: float) -> AwaitableAction:
self._kelo_robile.set_platform_velocity_target(x, y, a, timeout)
def set_platform_velocity_target(self, x: float, y: float, a: float, timeout: float,
align_drives_first: bool = False) -> AwaitableAction:
if align_drives_first:
self._kelo_robile.set_platform_velocity_target(x, y, a, timeout=1.0, instantaneous=False,
only_align_drives=True)

self._kelo_robile.set_platform_velocity_target(x, y, a, timeout=timeout, instantaneous=True)

def timeout_awaitable() -> bool:
time.sleep(timeout)
return True

return AwaitableAction(timeout_awaitable)

def enable_compliant_mode(self, enabled: bool):
if enabled:
self._kelo_robile.set_driver_type(PlatformDriverType.COMPLIANT)
else:
self._kelo_robile.set_driver_type(PlatformDriverType.VELOCITY)
11 changes: 10 additions & 1 deletion airo-robots/airo_robots/drives/mobile_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,23 @@ class MobileRobot(ABC):
"""

@abstractmethod
def set_platform_velocity_target(self, x: float, y: float, a: float, timeout: float) -> AwaitableAction:
def set_platform_velocity_target(self, x: float, y: float, a: float, timeout: float,
align_drives_first: bool = False) -> AwaitableAction:
"""Set the desired platform velocity.
Args:
x: Linear velocity along the X axis.
y: Linear velocity along the Y axis.
a: Angular velocity.
timeout: After this time, the platform will automatically stop.
align_drives_first: Align drives before moving (default: False, will start driving instantly).
Returns:
An awaitable action."""

@abstractmethod
def enable_compliant_mode(self, enabled: bool):
"""Enable compliant mode on the robot.
Args:
enabled: If true, will enable compliant mode. Else, will disable compliant mode."""
2 changes: 1 addition & 1 deletion airo-robots/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"click",
"airo-typing",
"airo-spatial-algebra",
"airo-tulip==0.0.1a0",
"airo-tulip==0.0.3",
],
packages=setuptools.find_packages(),
package_data={"airo_robots": ["py.typed"]},
Expand Down

0 comments on commit 952999e

Please sign in to comment.