Start

Initial Connection

To start using the bysense SDK, follow these steps to initialize the connection to your quadruped robot:

python
#import the SDK module
import bysense_sdk as bysense

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

# Verify the connection status
if bysense_connection.is_connected():
    print(bysense_connection.lastlog())
else:
    print(bysense_connection.lastlog())
    # Handle connection failure as needed
C++
#include "bysense_sdk.hpp"  // Include the SDK's main header file

int main() {
    // Create an instance of the 'start' class (assuming 'start' is a class in the SDK)
    bysense::start myStartInstance;

    // Call the 'connect' method and store the result in a connection variable
    auto bysense_connection = myStartInstance.connect();

    // Verify the connection status by calling the 'is_connected' method
    if (bysense_connection.is_connected()) {
        std::cout bysense_connection.lastlog() std::endl;
    } else {
        std::cout bysense_connection.lastlog() std::endl;
        // Handle connection failure as needed
    }

    return 0;
}

With those lines of code you will connect to bysense and will get its connection status as feedback.

If you struggle with the connection after few seconds of turning the robot on. It might be that the robot is still in booting sequence which can take up to one minute. Also make sure bysense is connected to your router or the ethernet cable is connected properly.

E-Stop

There will be moments where a E Stop especially during development is required. Therefore we provide a command based version and a UI based version. In all scenarios the joint torque is set to zero. To shut down the power would required a new starting protocol procedure.

E-Stop - UI

we recommend to use have a E-Stop in reachable area

Idea with the UI based E stop is to have a single button on your keyboard dedicated for this exceptional situation to protect not only the hardware but also others.

python
#import the SDK module
import bysense_sdk as bysense

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

if bysense_connection.is_connected():
    #open UI in a seperate process to be able to use it
    bysense.start.estop_UI()

else:
    print("Failed to connect.")
    # Handle connection failure as needed

Here the UI will appear with a button. Once this button has been pressed you E-Stop is active and all joints will be turned off. The power is not cut off.

E-Stop - Command based

If you plan to use an external device as E stop or some other device like a remote control, you can use following lines of code to direct activate the estop.

python
#import the SDK module
import bysense_sdk as bysense

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


if bysense_connection.is_connected():
    #open UI in a seperate process to be able to use it
    bysense_stop = bysense.stop.estop()

else:
    print("Failed to connect.")
    # Handle connection failure as needed
C++
//import the SDK module
#include "bysense_sdk.hpp"

int main() {
    // Create an instance of the 'core' class
    bysense::core myCoreInstance;

    // Call the 'estop' method on the 'core' instance
    myCoreInstance.estop();

    return 0;
}

we have build the estop function right into the core class of bysense. The python code does access the core class.

Activate & Deactivate Joints

You can only activate the joints once a E-Stop button is in place. If you try just to activate the joints you will get a error message. With the activate joints you are able to use the joints for your application. Once your program is finished you can deactivate the joints as in the example below:

python
#import the SDK module
import bysense_sdk as bysense

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


if bysense_connection.is_connected():
    #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()
    
    #placeholder for some activity
    
    #once estop is avaible the joints can be activated
    bysense_deactive_joints = bysense.start.deactive_joints()
    

else:
    print("Failed to connect.")
    # Handle connection failure as needed

Last updated