This commit is contained in:
ywb
2026-06-08 11:42:41 +08:00
parent 696bf2ef6e
commit a4f4be4c8e
8 changed files with 141 additions and 52 deletions
+7 -7
View File
@@ -76,7 +76,7 @@ class AGVController:
if rc != 0:
logger.warning(f"发布 cmd_vel 失败: {err}")
def move_forward(self, speed: float = 0.5, duration: float = None):
def move_forward(self, speed: float = 1.0, duration: float = None):
"""前进"""
if not self.is_connected():
return
@@ -85,7 +85,7 @@ class AGVController:
time.sleep(duration)
self.stop()
def move_backward(self, speed: float = 0.5, duration: float = None):
def move_backward(self, speed: float = 1.0, duration: float = None):
"""后退"""
if not self.is_connected():
return
@@ -94,7 +94,7 @@ class AGVController:
time.sleep(duration)
self.stop()
def turn_left(self, speed: float = 0.5, duration: float = None):
def turn_left(self, speed: float = 1.0, duration: float = None):
"""左转"""
if not self.is_connected():
return
@@ -103,7 +103,7 @@ class AGVController:
time.sleep(duration)
self.stop()
def turn_right(self, speed: float = 0.5, duration: float = None):
def turn_right(self, speed: float = 1.0, duration: float = None):
"""右转"""
if not self.is_connected():
return
@@ -112,7 +112,7 @@ class AGVController:
time.sleep(duration)
self.stop()
def move_left_lateral(self, speed: float = 0.5, duration: float = None):
def move_left_lateral(self, speed: float = 1.0, duration: float = None):
"""向左横向移动"""
if not self.is_connected():
return
@@ -121,7 +121,7 @@ class AGVController:
time.sleep(duration)
self.stop()
def move_right_lateral(self, speed: float = 0.5, duration: float = None):
def move_right_lateral(self, speed: float = 1.0, duration: float = None):
"""向右横向移动"""
if not self.is_connected():
return
@@ -176,7 +176,7 @@ class AGVController:
return self._position
return None
def go_to_point(self, x: float, y: float, rz: float = None, speed: float = 0.5) -> bool:
def go_to_point(self, x: float, y: float, rz: float = None, speed: float = 1.0) -> bool:
"""移动到目标点(需要 ROS2 导航栈)"""
logger.warning("go_to_point 需要 ROS2 Nav2 支持,当前仅记录目标")
return True