Skip to content

blueye.sdk.motion

motion

Classes:

  • Motion

    Control the motion of the drone, and set automatic control modes

Motion

Motion(parent_drone)

Control the motion of the drone, and set automatic control modes

Motion can be set one degree of freedom at a time by using the 4 motion properties (surge, sway, heave and yaw) or for all 4 degrees of freedom in one go through the send_thruster_setpoint method.

Methods:

Attributes:

  • auto_altitude_active (Optional[bool]) –

    Enable or disable the auto altitude control mode

  • auto_depth_active (Optional[bool]) –

    Enable or disable the auto depth control mode

  • auto_heading_active (Optional[bool]) –

    Enable or disable the auto heading control mode

  • boost (float) –

    Get or set the boost gain

  • current_thruster_setpoints

    Returns the current setpoints for the thrusters

  • heave (float) –

    Set force reference for the heave direction

  • slow (float) –

    Get or set the "slow gain" (inverse of boost)

  • station_keeping_active (Optional[bool]) –

    Enable or disable the station keeping control mode

  • surge (float) –

    Set force reference for the surge direction

  • sway (float) –

    Set force reference for the sway direction

  • weather_vaning_active (Optional[bool]) –

    Enable or disable the weather vaning control mode

  • yaw (float) –

    Set force reference for the yaw direction

Source code in blueye/sdk/motion.py
15
16
17
18
19
def __init__(self, parent_drone):
    self._parent_drone = parent_drone
    self.thruster_lock = threading.Lock()
    self._current_thruster_setpoints = {"surge": 0, "sway": 0, "heave": 0, "yaw": 0}
    self._current_boost_setpoints = {"slow": 0, "boost": 0}

auto_altitude_active property writable

auto_altitude_active: Optional[bool]

Enable or disable the auto altitude control mode

When auto altitude is active, the drone will attempt to maintain its current altitude above the seabed. Input for the heave direction to the thruster_setpoint function specifies a speed set point instead of a force set point. A control loop on the drone will then attempt to maintain the wanted speed in the heave direction as long as auto altitude is active.

Arguments: * Enable (bool): Activate auto altitude mode if true, de-activate if false. If the drone does not have a valid altitude reading this command will be ignored.

Returns:

  • Auto altitude state (bool): True if auto altitude is active, false if not

auto_depth_active property writable

auto_depth_active: Optional[bool]

Enable or disable the auto depth control mode

When auto depth is active, input for the heave direction to the thruster_setpoint function specifies a speed set point instead of a force set point. A control loop on the drone will then attempt to maintain the wanted speed in the heave direction as long as auto depth is active.

Arguments:

  • Enable (bool): Activate auto depth mode if true, de-activate if false

Returns:

  • Auto depth state (bool): True if auto depth is active, false if not

auto_heading_active property writable

auto_heading_active: Optional[bool]

Enable or disable the auto heading control mode

When auto heading is active, input for the yaw direction to the thruster_setpoint function specifies a angular speed set point instead of a moment set point. A control loop on the drone will then attempt to maintain the wanted angular velocity in the yaw direction as long as auto heading is active.

Arguments:

  • Enable (bool): Activate auto heading mode if true, de-activate if false

Returns:

  • Auto heading state (bool): True if auto heading mode is active, false if not

boost property writable

boost: float

Get or set the boost gain

Arguments:

  • boost_gain (float): Range from 0 to 1.

current_thruster_setpoints property writable

current_thruster_setpoints

Returns the current setpoints for the thrusters

We maintain this state in the SDK since the drone expects to receive all of the setpoints at once.

For setting the setpoints you should use the dedicated properties/functions for that, trying to set them directly with this property will raise an AttributeError.

heave property writable

heave: float

Set force reference for the heave direction

Arguments:

  • heave (float): Force set point in the heave direction in range <-1, 1>, a positive set point makes the drone move downwards

slow property writable

slow: float

Get or set the "slow gain" (inverse of boost)

Arguments:

  • slow_gain (float): Range from 0 to 1.

station_keeping_active property writable

station_keeping_active: Optional[bool]

Enable or disable the station keeping control mode

When station keeping is active, the drone will attempt to maintain its current position and orientation in the water as long as the mode is active.

Arguments:

  • Enable (bool): Activate station keeping mode if true, de-activate if false

Returns:

  • Station keeping state (bool): True if station keeping mode is active, false if not

surge property writable

surge: float

Set force reference for the surge direction

Arguments:

  • surge (float): Force set point in the surge direction in range <-1, 1>, a positive set point makes the drone move forward

sway property writable

sway: float

Set force reference for the sway direction

Arguments:

  • sway (float): Force set point in the sway direction in range <-1, 1>, a positive set point makes the drone move to the right

weather_vaning_active property writable

weather_vaning_active: Optional[bool]

Enable or disable the weather vaning control mode

When weather vaning is active, the drone will attempt to maintain its current position in the water and orient itself parallel to the current.

Arguments:

  • Enable (bool): Activate weather vaning mode if true, de-activate if false. If the drone does not have a valid altitude reading this command will be ignored.

Returns:

  • Weather vaning state (bool): True if weather vaning mode is active, false if not

yaw property writable

yaw: float

Set force reference for the yaw direction

Arguments:

  • yaw (float): Moment set point in the sway direction in range <-1, 1>, a positive set point makes the drone rotate clockwise.

send_thruster_setpoint

send_thruster_setpoint(surge, sway, heave, yaw)

Control the thrusters of the drone

Set reference values between -1 and 1 for each controllable degree of freedom on the drone. The reference values are mapped linearly to a thruster force, a set point of -1 correspons to maximum negative force and a set point of 1 corresponds to maximum positive force. For the yaw direction the reference is a moment not a force, as the yaw direction is rotational not translational.

Arguments:

  • surge (float): Force set point in the surge direction in range <-1, 1>, a positive set point makes the drone move forward
  • sway (float): Force set point in the sway direction in range <-1, 1>, a positive set point makes the drone move to the right
  • heave (float): Force set point in the heave direction in range <-1, 1>, a positive set point makes the drone move down.
  • yaw (float): Moment set point in the yaw direction in range <-1, 1>, a positive set point makes the drone rotate clockwise.
Source code in blueye/sdk/motion.py
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
def send_thruster_setpoint(self, surge, sway, heave, yaw):
    """Control the thrusters of the drone

    Set reference values between -1 and 1 for each controllable degree of freedom on the drone.
    The reference values are mapped linearly to a thruster force, a set point of -1 correspons
    to maximum negative force and a set point of 1 corresponds to maximum positive force. For
    the yaw direction the reference is a moment not a force, as the yaw direction is rotational
    not translational.


    Arguments:

    * **surge** (float): Force set point in the surge direction in range <-1, 1>,
                         a positive set point makes the drone move forward
    * **sway** (float): Force set point in the sway direction in range <-1, 1>,
                         a positive set point makes the drone move to the right
    * **heave** (float): Force set point in the heave direction in range <-1, 1>,
                         a positive set point makes the drone move down.
    * **yaw** (float): Moment set point in the yaw direction in range <-1, 1>,
                         a positive set point makes the drone rotate clockwise.
    """
    with self.thruster_lock:
        self._current_thruster_setpoints["surge"] = surge
        self._current_thruster_setpoints["sway"] = sway
        self._current_thruster_setpoints["heave"] = heave
        self._current_thruster_setpoints["yaw"] = yaw
        self._send_motion_input_message()