Quick Start¶
This is a quick start section to help developers understand the process of controlling the robot using SDK commands. Follow the steps below, the robot can eventually stand and perform "say hello" to you.
Following topics are covered:
- Installing Python Client SDK
- Preparation Before Powering on
- Powering on Robot
- Joining the Hotspot Network of Robot
- Running Example Code
- Starting Backend Service
- Setting Robot to Initial State
- Landing Robot
- Commanding Robot to Stand
- Commanding Robot to Wave Hands
- Powering off Robot
Installing Python Client SDK¶
The RoCS server is already installed in the embedded robot computer before delivery. Ensure that you have already installed and configured both Python
and pip
correctly. If not, please consult the appropriate resources for guidance on their installation. The recommended Python versions are 3.8 and above.
The RoCS Client Python packages can be easily installed or upgraded from PyPI with the following command.
Run the following command to verify the installation:
Windows Users:
Linux Users:
The following output signifies a successful installation.
Preparation Before Powering on¶
After setting up the software environment, it comes to some necessary preparation work before powering on the robot.
Preparation work includes:
- Charging
- Environmental Inspection
- Robot Inspection
- Calibration Positioning
1. Charging¶
Before the initial use, it's essential to ensure that the robot, Remote Controller, and protective lift (if purchased) are fully charged using the provided chargers.
2. Environmental Inspection¶
The environment should meet the following criteria:
- The ground must be level and non-slippery to prevent accidental movements or falls.
- A minimum of 4 meters of free space around the robot is recommended to ensure a safe operating area and to accommodate the robot's range of motion.
3. Robot Inspection¶
Prior to use, perform a comprehensive check of the robot:
- Ensure the robot is properly fastened to the protective lift.
- Inspect for any loose or damaged parts that could hinder the robot's smooth and unobstructed movement.
- Check that the robot's battery and the battery of any connected mobile devices have sufficient power for the operation.
- Remove the calibration pin, if present, to allow for proper movement.
4. Calibration Positioning¶
Before activating the robot, it's critical to set it to its calibration pose. This includes:
- Align shoulder slots.
- Keep the arms hanging straight down with the palms facing inward.
- Ensure a 10 cm interval between palms and hips.
- Ensure that the robot bows down while keeping the waist upright, which facilitates a stable startup.
Powering on Robot¶
Follow the steps to power on the robot:
- Long press actuator power-on button.
- Press embedded computer power-on button.
- Release Emergence Stop switch.
- Observe the robot's indicator light. A steady breathing blink pattern indicates that the robot is starting up normally.
Note
The Emergency Stop switch should be released only after the calibration pose has been set. Once released, maintain the calibration pose for at least 5 seconds to ensure stability.
Joining the Hotspot Network of Robot¶
Before running the example code, make sure that the robot is under the same network environment. A simple solution is to join the hotspot network of the robot. The ssid aligns with the SN number of robot and password remains "66668888". It is also feasible to connect to robot under other network environment and the host ip needs to be configured accordingly.
For more network environment options, please refer to Network Choice.
For guidance on specifying host ip in programming, please refer to Host IP Configuration
Running Example Code¶
Danger
Always remember to press the red emergency switch in case of unexpected situations.
This is a simple example code using SDK commands to control the robot, the workflow is similar to that of app control. It is very important to follow the workflow chart in the SDK document before executing motions. Always remember to press the red emergency switch in case of unexpected situations.
After running the script, it will create a Websocket connection to the server if all preliminary steps are completed. A common mistake is that the host ip is not correctly configured according to the network environment. Once 'Please enter command:' is shown in the terminal, you can type in a control command to test the performance of a unit SDK function.
Input command and corresponding SDK function:
server: _control_svr_start()
start: start()
stand: stand()
wave: upper_body_arm(arm=ArmAction.HELLO)
close: _control_svr_close()
and exit()
import time
from rocs_client import Human
from rocs_client.robot.human import ArmAction
# Websocket fuctions
async def on_connected():
print("WebSocket opened...")
# SDK functions
# The startup process of control server will normally take some time.
def control_server_start():
human._control_svr_start():
time.sleep(10)
def start():
res = human.start()
print(f'start: {res}')
def stand():
res = human.stand()
print(f'stand: {res}')
def upper_body_arm():
res = human.upper_body(arm=ArmAction.HELLO)
print(f'arm: {res}')
# user input module
def execute_function(user_input):
func_to_execute = function_mapping.get(user_input)
if func_to_execute:
func_to_execute()
else:
print(f"no match found: '{user_input}' ")
function_mapping = {
"server": control_server_start,
"start": start,
"stand": stand,
"wave": upper_body_arm,
}
# Instance creation of Human class
human = Human(on_connected=on_connected, host="192.168.12.1")
time.sleep(1)
# Input loop will not end until user type in 'close' command.
while True:
print('Please enter command:')
user_input = input()
if (user_input=='close'):
break
else:
execute_function(user_input)
# After 'close' command is executed, the workflow will come to the Ending phase.
print('close_control_svr: ', human._control_svr_close())
human.exit()
Starting Backend Service¶
Once "WebSocket opened..." is shown in the terminal, it indicates that the WebSocket connection is successfully established and user can type in commands to control the robot.
First, type in following command to start backend service:
This command initiates the full-body control service in the system. The initiation process takes several seconds to complete, which includes encoder checks, startup of functional modules, actuator power enablement, and self-checks. Once completed, the actuators can move.
Setting Robot to Initial State¶
The initial state, which is a prerequisite for starting the motion control, ensures that the robot is in a defined and known position before beginning operations.
Type in following command to set the robot to initial state:
Upon executed successfully, the actuators in the waist, hips and legs will adjust based on the encoder values.Landing Robot¶
This involves a series of actions to ensure the robot transitions safely from an inactive to an active state:
-
Set Robot to Initial State : As outlined in the preceding section.
-
Control the Descent : Use the protective lift descent button to control the robot's descent to the ground. This should be done slowly to prevent any impact or damage.
- Confirm Stability : Once the robot has landed, gently shake it to confirm that it is stable and there are no issues with its balance or the surface it is on. Ensure that the torso is perpendicular to the ground before executing this command.
Commanding Robot to Stand¶
After landing the robot, type in following command to make robot stand:
Upon execution, the robot control algorithm will automatically control body balance to achieve a stable standing posture.Commanding Robot to Wave Hands¶
After assuming a standing posture, commands in the motion library can be used to control the robot. In this section, a simple arm action is chosen for demonstration.
Type in following command to make robot wave hands:
Upon execution, the robot will wave its hands to perform "say hello".Powering off Robot¶
To ensure the safe shutdown of the robot, follow these steps:
- Securing the Robot: Before initiating the shutdown process, make sure the robot is secured to the protective lift. Ensure the robot is in a stable position and not in the middle of a task that requires completion.
-
Return to Initial State: Bring the robot back to its initial state. This step is crucial for ensuring that the robot is in a safe and neutral position, which prevents any issues when it is powered back on.
Type in following command to set the robot to initial state:
Warning
Once the command is successfully executed, the robot will be unable to stand.
-
Close backend service and WebSocket connection: Closing backend service helps prevent unexpected issues in future cases.
Type in following command to close backend service and Websocket connection:
-
Press Emergency Stop Switch: This action ensures an immediate cessation of all operations and is a safety measure to prevent any unintended movements during the shutdown.