Code Examples

Start, Walk & Sit

in following code example you connect to bysense, show the E-Stop button, activate its joints, standup, walk for 120 sec in x direction, sit down and deactivate its joints.

python
#import the SDK module
import bysense_sdk as bysense
import time

# Create a boolean connection variable of the start class
bysense_connection = bysense.start.connect()
walking_vector = (0.5, 0.0, 0.0)

if bysense_connection.is_connected():

    #print successfull connection
    print(bysense_connection.lastlog())
    
    #open UI in a seperate process to be able to use it
    bysense.start.estop_UI()
    
    #once estop is avaible the joints can be activated
    bysense_active_joints = bysense.start.activate_joints()
    
    #stantup bysense
    bysense.movs.standup()
    
    #turn on the walk bling function with given vector
    bysense.movs.walkblind(walking_vector)
    
    #walk for 120 seconds
    time.sleep(120.0)
    
    #sitdown bysense
    bysense.movs.sitdown()
    
    #once estop is avaible the joints can be activated
    bysense_deactive_joints = bysense.start.deactive_joints()
    

else:
    print(bysense_connection.lastlog())
    # Handle connection failure as needed

With this python code you have written your first application to bring your sensors to walk!

Last updated