Skip to content

Commit

Permalink
Revert duplicate commit change
Browse files Browse the repository at this point in the history
  • Loading branch information
andchiind committed Jan 17, 2024
1 parent 36cac33 commit e9a4e7e
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions src/isar_exr/api/energy_robotics_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,43 +502,6 @@ def is_robot_awake(self, exr_robot_id: str) -> bool:
status: AwakeStatus = AwakeStatus(result["currentRobotStatus"]["awakeStatus"])
success: bool = status in [AwakeStatus.Awake]
return success

def get_battery_level(self, exr_robot_id: str) -> float:
params: dict = {"robotID": exr_robot_id}

variable_definitions_graphql: DSLVariableDefinitions = DSLVariableDefinitions()

check_battery_query: DSLQuery = DSLQuery(
self.schema.Query.currentRobotStatus.args(
robotID=variable_definitions_graphql.robotID
).select(
self.schema.RobotStatusType.isConnected,
self.schema.RobotStatusType.batteryStatus.select(
self.schema.BatteryStatusType.percentage
),
)
)

check_battery_query.variable_definitions = variable_definitions_graphql

try:
result: Dict[str, Any] = self.client.query(
dsl_gql(check_battery_query), params
)
except Exception:
message: str = "Could not check robot battery level"
self.logger.error(message)
raise RobotMissionStatusException(
error_description=message,
)

if not result["currentRobotStatus"]["isConnected"]:
raise RobotMissionStatusException(
error_description="Robot is not connected",
)

battery_level: float = result["currentRobotStatus"]["batteryStatus"]["percentage"]
return battery_level

def get_battery_level(self, exr_robot_id: str) -> float:
params: dict = {"robotID": exr_robot_id}
Expand Down

0 comments on commit e9a4e7e

Please sign in to comment.