motion.py

Use Case

motion.py can be used for configuring and moving the AXIBO. It can be used to home the AXIBO, configure the AXIBO's motors, switch from high speed to high torque and vice versa, move absolutely and relatively, and stop all motion.

Available Functions

configure_motion(axis, accel = 1, current = 12, maxPos = 150, minPos = -150, maxVel = 40, speed = 10)

Used to configure the AXIBO axis.

Valid axis entries:

  • "tilt"

  • "pan"

  • "slide"

  • "focus"

  • "zoom"

Valid accel entries:

Valid current entries:

  • 1 <= current <= 16

Valid maxPos & minPos entries:

Valid maxVel entries:

Valid speed entries:

  • Tilt: up to 15 degrees/second

  • Pan: up to 15 degrees/second

  • Slide: up to 10 millimetres/second

  • Focus: up to 10 millimetres/second

  • Zoom: up to 10 millimetres/second

configue_motion_all(json_format)

Configure all the axis using json formatting.

Valid json_format entries:

  • json formatted python object

json example:

config_all = {
        "tilt": {
            "accel": 1,
            "current": 12,
            "maxPos": 45,
            "maxVel": 40,
            "minPos": -45,
            "speed": 15,
        },
        "pan": {
            "accel": 1,
            "current": 12,
            "maxPos": 180,
            "maxVel": 40,
            "minPos": -180,
            "speed": 15,
        },
        "slide": {
            "accel": 1,
            "current": 12,
            "maxPos": 500,
            "maxVel": 10,
            "minPos": 0,
            "speed": 10,           
        }
    }

configure_homing(axis, dir = 0, speed = 40, maxPos = 10, minPos = -10, useTorque = 0)

Configure the homing settings.

Valid axis entries:

Valid dir entries:

Valid speed entries:

Valid maxPos & minPos entries:

Valid useTorque entries:

configure_homing_all(json_format)

Configure homing using json formatted python object.

Valid json_format entries:

  • json formatted python object

json example:

homing_all = { 
        "pan": {
                "direction": 0,
                "homingSpeed": 40,
                "maxPos": 30,
                "minPos": -30,
                "useTorque": 0},
        "tilt": {
                "direction": 0,
                "homingSpeed": 40,
                "maxPos": 30,
                "minPos": -30,
                "useTorque": 0}, 
        "slide": {
                "direction": 0,
                "homingSpeed": 10}
}

switch_modes(mode)

Switch the AXIBO motors from high speed to high torque or vice versa.

Valid mode entries:

  • "highspeed"

  • "hightorque"

packet_conf(mode)

Choose the packet confirmation.

Valid mode entries:

  • 1:

  • 2:

set_absolute_move(axis, pos=0, speed=0)

Set the next absolute move to be performed. Waits for move_setAxies in order to perform move.

Valid pos entries:

Valid speed entries:

  • Tilt: up to 15 degrees/second

  • Pan: up to 15 degrees/second

  • Slide: up to 10 millimetres/second

  • Focus: up to 10 millimetres/second

  • Zoom: up to 10 millimetres/second

set_relative_move(axis, pos=0, speed=0)

Set the next relative move to be performed. Waits for move_setAxies in order to perform move.

Valid pos entries:

Valid speed entries:

move_json(type, json_format):

Move the AXIBO by using a json formatted object. Will immediately perform move after being called.

Valid type entries:

  • "absolute": Move around the absolute axis

  • "relative": Move around the relative axis.

Valid json_format entries:

  • json formatted python object

move_set_axies(type)

Perform the set moves.

Valid type entries:

  • "absolute": Move around the absolute axis

  • "relative": Move around the relative axis.

trigger_control(trigCase=0, timeSpacing=5000, pauseAmount=5000, count=10, bulb=0.1, focus=0)

Set the trigger settings.

Valid trigCase entries:

Valid timeSpacing entries:

Valid pauseAmount entries:

Valid count entries:

Valid blub entries:

Valid focus settings:

stop_motion()

Stop all current motion.

get_motion_status()

Returns the motion status of AXIBO.

get_config_hardware()

Gets the current hardware configuration of AXIBO.

get_location()

Returns the current location of pan, tilt, slide, focus, and zoom.

move_wait()

Waits for the current move to be completed.

Example

from axibo import Axibo
import time

if __name__ == '__main__':    
    #Change for you Axibos IP Address
    x = Axibo("10.0.0.176")

    x.motion.set_absolute_move("slide", 0, 10)
    x.motion.set_absolute_move("pan", 0, 15)
    x.motion.set_absolute_move("tilt", 0, 15)

    x.motion.move_set_axies("absolute")

    x.motion.move_wait()

    x.motion.set_absolute_move("slide", 250, 10)
    x.motion.set_absolute_move("pan", 45, 15)
    x.motion.set_absolute_move("tilt", 45, 15)

    x.motion.move_set_axies("absolute")

    x.motion.move_wait()

    x.motion.set_relative_move("tilt", -45, 15)

    x.motion.move_set_axies("relative")

Last updated