Overview
The gRPC API protocol is a Remote Procedure Call (RPC) protocol that employs gRPC for communication between the client and the server. The Moby Framework's gRPC server facilitates communication with the Moby through gRPC calls. MobyClient offers a set of functions enabling users to interact with the Moby via the gRPC server. The available functions are outlined below:
Installation and Setup
Before utilizing the gRPC API and Python client, verify that the required software and packages are installed on your system.
Prerequisites
- Python >= 3.6 and <= 3.9
- pip
Package Installation
To install the neuromeka-clients package, execute the following command in your terminal or command prompt:
This command installs the package and its dependencies.
Example Code and Usage
Here is an example of a Python Moby client that checks if the installation was successful:
from neuromeka import MobyClient
moby = MobyClient('192.168.214.20')
# Get current Moby state
moby_state = moby.get_moby_state()
print("Moby state:", moby_state)
# Get current BMS (battery management system) state
bms_state = moby.get_bms()
print("Battery status:", bms_state)
The output will be displayed as follows:
Moby state: {'is_ready': True, 'is_moving': False, 'is_move_finished': True, 'is_emg_pushed': False, 'is_error_state': False, 'is_home_pose': False, 'is_resetting': False, 'is_imu_avail': True, 'is_program_running': False, 'is_program_pause': False, 'is_rotation_zero': False}
Battery status: {'BMS status-1': 98.0, 'BMS status-2': 98.0, 'Pack voltage-1': 55.59, 'Pack voltage-2': 55.8, 'Battery Voltage-1': 55.64, 'Battery Voltage-2': 55.63, 'Pack current1-1': 0.0, 'Pack current1-2': 0.0, 'Pack current2-1': -0.2, 'Pack current2-2': -0.4}
If the above example runs without errors, you can use the entire Moby protocol with MobyClient. For more details on the MobyClient protocol, please refer to API list.