From 02cf5d3c4e352821b7ce249c1ba71e79508abd19 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 6 Dec 2024 15:45:38 +0800 Subject: [PATCH] Removed abstracted RobotAdapter, to be added only after Nav1RobotAdapter is implemented Signed-off-by: Aaron Chong --- free_fleet_adapter/CMakeLists.txt | 1 - .../free_fleet_adapter/nav2_robot_adapter.py | 8 +- .../free_fleet_adapter/robot_adapter.py | 100 ------------------ 3 files changed, 5 insertions(+), 104 deletions(-) delete mode 100644 free_fleet_adapter/free_fleet_adapter/robot_adapter.py diff --git a/free_fleet_adapter/CMakeLists.txt b/free_fleet_adapter/CMakeLists.txt index a26f1c10..414011c5 100644 --- a/free_fleet_adapter/CMakeLists.txt +++ b/free_fleet_adapter/CMakeLists.txt @@ -8,7 +8,6 @@ ament_python_install_package(${PROJECT_NAME}) install(PROGRAMS ${PROJECT_NAME}/fleet_adapter.py - ${PROJECT_NAME}/robot_adapter.py ${PROJECT_NAME}/nav2_robot_adapter.py DESTINATION lib/${PROJECT_NAME} ) diff --git a/free_fleet_adapter/free_fleet_adapter/nav2_robot_adapter.py b/free_fleet_adapter/free_fleet_adapter/nav2_robot_adapter.py index ada63922..dd5602d4 100644 --- a/free_fleet_adapter/free_fleet_adapter/nav2_robot_adapter.py +++ b/free_fleet_adapter/free_fleet_adapter/nav2_robot_adapter.py @@ -37,7 +37,6 @@ make_cancel_all_goals_request, namespacify, ) -from free_fleet_adapter.robot_adapter import RobotAdapter from geometry_msgs.msg import TransformStamped import numpy as np @@ -96,7 +95,7 @@ def get_transform(self) -> TransformStamped | None: return None -class Nav2RobotAdapter(RobotAdapter): +class Nav2RobotAdapter: def __init__( self, @@ -108,7 +107,10 @@ def __init__( fleet_handle, tf_buffer ): - RobotAdapter.__init__(self, name, node, fleet_handle) + self.name = name + self.node = node + self.fleet_handle = fleet_handle + self.update_handle = None self.execution = None self.configuration = configuration diff --git a/free_fleet_adapter/free_fleet_adapter/robot_adapter.py b/free_fleet_adapter/free_fleet_adapter/robot_adapter.py deleted file mode 100644 index 91a34261..00000000 --- a/free_fleet_adapter/free_fleet_adapter/robot_adapter.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright 2024 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from abc import ABC, abstractmethod -from typing import Annotated - -import rmf_adapter.easy_full_control as rmf_easy -from rmf_adapter.robot_update_handle import ActivityIdentifier - - -class RobotAdapter(ABC): - """Abstract Robot Adapter to be used by the free fleet adapter.""" - - def __init__( - self, - name: str, - node, - fleet_handle - ): - self.name = name - self.node = node - self.fleet_handle = fleet_handle - self.update_handle = None - - """ - This method returns the battery state of charge as a float, with value - between 0 and 1.0. - """ - @abstractmethod - def get_battery_soc(self) -> float: - ... - - """ - This method returns the name of the current map that the robot is - localized on. - """ - @abstractmethod - def get_map_name(self) -> str: - ... - - """ - This method returns the last known 2D position in meters and orientation - (yaw) of the robot in radians as a list of 3 floats, in the form of - [x, y, yaw]. If the last known position of the robot is not available, - returns None. - """ - @abstractmethod - def get_pose(self) -> Annotated[list[float], 3] | None: - ... - - """ - This method is called to update RMF with the latest robot state. - """ - @abstractmethod - def update(self, state: rmf_easy.RobotState): - ... - - """ - This method is called to send a navigation command to the robot. - """ - @abstractmethod - def navigate( - self, - destination: rmf_easy.Destination, - execution: rmf_easy.CommandExecution - ): - ... - - """ - This method is called to stop the execution/continuation of the provided - activity. - """ - @abstractmethod - def stop(self, activity: ActivityIdentifier): - ... - - """ - This method is called to send a custom action command to the robot. - """ - @abstractmethod - def execute_action( - self, - category: str, - description: dict, - execution: ActivityIdentifier - ): - ...