Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize motor power state in mocks #101

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions spot_wrapper/testing/mocks/power.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright (c) 2024 Boston Dynamics AI Institute LLC. See LICENSE file for more info.

from typing import Any

import grpc
from bosdyn.api.power_pb2 import (
FanPowerCommandFeedbackRequest,
Expand All @@ -21,6 +23,10 @@
class MockPowerService(PowerServiceServicer, MockRobotStateService):
"""A mock Spot power service."""

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)
self.robot_state.power_state.motor_power_state = PowerState.MotorPowerState.MOTOR_POWER_STATE_OFF

def PowerCommand(self, request: PowerCommandRequest, context: grpc.ServicerContext) -> PowerCommandResponse:
response = PowerCommandResponse()
if request.request == PowerCommandRequest.Request.REQUEST_ON_MOTORS:
Expand Down