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 motion setters (set_surge,
set_sway, set_heave and set_yaw, and on the Blueye X7 also set_roll and set_pitch) or for all
degrees of freedom in one go through the send_thruster_setpoint method.
A setpoint of 1 or -1 is full stick, not the most the thrusters can give. The force it asks
for depends on set_boost and
set_slow; see
Control from a Python script for the levels per axis.
The drone holds the last setpoint until it gets a new one, or until it zeroes the input 3
seconds after the client in control stops sending its watchdog.
Only the Blueye X7 has thrusters that can produce roll and pitch moments. The other models ignore roll and pitch input, so the setters are safe to call on any drone.
Methods:
-
enable_auto_altitude–Enable or disable the auto altitude control mode
-
enable_auto_depth–Enable or disable the auto depth control mode
-
enable_auto_heading–Enable or disable the auto heading control mode
-
enable_station_keeping–Enable or disable the station keeping control mode
-
enable_weather_vaning–Enable or disable the weather vaning control mode
-
get_boost–Get the boost gain.
-
get_current_thruster_setpoints–Get the setpoints the SDK last sent, per axis.
-
get_heave–Get the force reference for the heave direction
-
get_pitch–Get the moment reference for the pitch direction
-
get_roll–Get the moment reference for the roll direction
-
get_slow–Get the slow gain.
-
get_surge–Get the force reference for the surge direction
-
get_sway–Get the force reference for the sway direction
-
get_yaw–Get the moment reference for the yaw direction
-
is_auto_altitude_active–Get the state of the auto altitude control mode
-
is_auto_depth_active–Get the state of the auto depth control mode
-
is_auto_heading_active–Get the state of the auto heading control mode
-
is_station_keeping_active–Get the state of the station keeping control mode
-
is_weather_vaning_active–Get the state of the weather vaning control mode
-
send_thruster_setpoint–Set the setpoint of every axis in one message.
-
set_boost–Set the boost gain.
-
set_heave–Set force reference for the heave direction
-
set_pitch–Set moment reference for the pitch direction
-
set_roll–Set moment reference for the roll direction
-
set_slow–Set the slow gain.
-
set_surge–Set force reference for the surge direction
-
set_sway–Set force reference for the sway direction
-
set_yaw–Set moment reference for the yaw direction
-
zero_setpoints–Set every setpoint to zero and send it.
Attributes:
-
current_thruster_setpoints–Deprecated, use
get_current_thruster_setpointsinstead.
Source code in blueye/sdk/motion.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
current_thruster_setpoints
property
writable
current_thruster_setpoints
Deprecated, use get_current_thruster_setpoints instead.
enable_auto_altitude
enable_auto_altitude(enable: 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. Heave input (set_heave or send_thruster_setpoint) 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.
Auto altitude needs a valid altitude, which comes from a DVL or a downward-facing Ping
sonar on a guest port. get_altitude() returns None while there is none. Without it the
drone drops the request and only logs it on its own side, so check
is_auto_altitude_active() afterwards. Enabling auto altitude turns auto depth off, also
when the auto altitude request itself is dropped. If the altitude becomes invalid while
auto altitude is active, the drone switches to auto depth.
Parameters:
-
enable(bool) –Activate auto altitude mode if true, de-activate if false.
Source code in blueye/sdk/motion.py
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | |
enable_auto_depth
enable_auto_depth(enable: bool)
Enable or disable the auto depth control mode
When auto depth is active, heave input (set_heave or send_thruster_setpoint)
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.
Auto depth needs no extra sensor. Enabling it turns auto altitude off, since the two hold the same axis.
Parameters:
-
enable(bool) –Activate auto depth mode if true, de-activate if false.
Source code in blueye/sdk/motion.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
enable_auto_heading
enable_auto_heading(enable: bool)
Enable or disable the auto heading control mode
When auto heading is active, yaw input (set_yaw or send_thruster_setpoint)
specifies an 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.
Parameters:
-
enable(bool) –Activate auto heading mode if true, de-activate if false.
Source code in blueye/sdk/motion.py
425 426 427 428 429 430 431 432 433 434 435 436 | |
enable_station_keeping
enable_station_keeping(enable: 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.
Station keeping needs a valid position from a DVL or from the drone's own Blueye GNSS.
Topside positioning (UGPS, USBL or NMEA input over UDP) is used for the map position but
does not count here: those fixes jump between samples, and the drone would chase every
jump. Without a valid position the drone drops the request and only logs it on
its own side, so check is_station_keeping_active() afterwards. An active hold is released
when the position has been invalid for 3 seconds.
PositionEstimateTel.position_estimate.navigation_sensors lists each sensor with its
validity.
Parameters:
-
enable(bool) –Activate station keeping mode if true, de-activate if false.
Source code in blueye/sdk/motion.py
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | |
enable_weather_vaning
enable_weather_vaning(enable: 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.
Weather vaning is station keeping with a free heading, so it has the same requirement: a
valid position from a DVL or the drone's own Blueye GNSS, see enable_station_keeping.
Enabling it also turns station keeping on, and turning station keeping off turns weather
vaning off. An altitude reading is not needed.
Parameters:
-
enable(bool) –Activate weather vaning mode if true, de-activate if false.
Source code in blueye/sdk/motion.py
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | |
get_boost
get_boost() -> float
Get the boost gain.
Returns:
-
float–The boost gain the SDK last sent, from 0 to 1.
Source code in blueye/sdk/motion.py
322 323 324 325 326 327 328 | |
get_current_thruster_setpoints
get_current_thruster_setpoints() -> Dict[str, float]
Get the setpoints the SDK last sent, per axis.
The SDK keeps them because every motion message carries all axes at once.
Returns:
-
Dict[str, float]–A dictionary with the surge, sway, heave, yaw, roll and pitch setpoints. Change them with the setters or
send_thruster_setpoint, not through this dictionary.
Source code in blueye/sdk/motion.py
43 44 45 46 47 48 49 50 51 52 53 | |
get_heave
get_heave() -> float
Get the force reference for the heave direction
Returns:
-
float–Force set point in the heave direction in range <-1, 1>.
Source code in blueye/sdk/motion.py
132 133 134 135 136 137 138 | |
get_pitch
get_pitch() -> float
Get the moment reference for the pitch direction
Only the Blueye X7 acts on pitch input, see set_pitch.
Returns:
-
float–Moment set point in the pitch direction in range <-1, 1>.
Source code in blueye/sdk/motion.py
212 213 214 215 216 217 218 219 220 | |
get_roll
get_roll() -> float
Get the moment reference for the roll direction
Only the Blueye X7 acts on roll input, see set_roll.
Returns:
-
float–Moment set point in the roll direction in range <-1, 1>.
Source code in blueye/sdk/motion.py
174 175 176 177 178 179 180 181 182 | |
get_slow
get_slow() -> float
Get the slow gain.
Returns:
-
float–The slow gain the SDK last sent, from 0 to 1.
Source code in blueye/sdk/motion.py
347 348 349 350 351 352 353 | |
get_surge
get_surge() -> float
Get the force reference for the surge direction
Returns:
-
float–Force set point in the surge direction in range <-1, 1>.
Source code in blueye/sdk/motion.py
90 91 92 93 94 95 96 | |
get_sway
get_sway() -> float
Get the force reference for the sway direction
Returns:
-
float–Force set point in the sway direction in range <-1, 1>.
Source code in blueye/sdk/motion.py
111 112 113 114 115 116 117 | |
get_yaw
get_yaw() -> float
Get the moment reference for the yaw direction
Returns:
-
float–Moment set point in the yaw direction in range <-1, 1>.
Source code in blueye/sdk/motion.py
153 154 155 156 157 158 159 | |
is_auto_altitude_active
is_auto_altitude_active() -> Optional[bool]
Get the state of the auto altitude control mode
When auto altitude is active, the drone will attempt to maintain its current altitude above
the seabed. Heave input (set_heave or send_thruster_setpoint) 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.
Returns:
-
Optional[bool]–Auto altitude state (bool): True if auto altitude is active, false if not. None if no telemetry message has been received.
Source code in blueye/sdk/motion.py
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
is_auto_depth_active
is_auto_depth_active() -> Optional[bool]
Get the state of the auto depth control mode
When auto depth is active, heave input (set_heave or send_thruster_setpoint)
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.
Returns:
-
Optional[bool]–Auto depth state (bool): True if auto depth is active, false if not. None if no telemetry message has been received.
Source code in blueye/sdk/motion.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | |
is_auto_heading_active
is_auto_heading_active() -> Optional[bool]
Get the state of the auto heading control mode
When auto heading is active, yaw input (set_yaw or send_thruster_setpoint)
specifies an 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.
Returns:
-
Optional[bool]–Auto heading state (bool): True if auto heading mode is active, false if not. None if no telemetry message has been received.
Source code in blueye/sdk/motion.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | |
is_station_keeping_active
is_station_keeping_active() -> Optional[bool]
Get the state of 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.
Returns:
-
Optional[bool]–Station keeping state (bool): True if station keeping mode is active, false if not. None if no telemetry message has been received.
Source code in blueye/sdk/motion.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
is_weather_vaning_active
is_weather_vaning_active() -> Optional[bool]
Get the state of 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.
Returns:
-
Optional[bool]–Weather vaning state (bool): True if weather vaning mode is active, false if not. None if no telemetry message has been received.
Source code in blueye/sdk/motion.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | |
send_thruster_setpoint
send_thruster_setpoint(
surge, sway, heave, yaw, *, roll=0.0, pitch=0.0
)
Set the setpoint of every axis in one message.
Each setpoint is between -1 and 1 and scales the force (or, for yaw, roll and pitch, the
moment) linearly. A setpoint of 1 or -1 is full stick, whose force depends on
set_boost and
set_slow, not the most the thrusters can give.
Roll and pitch are keyword-only and default to 0, so a call that leaves them out clears any
roll or pitch set earlier. Only the Blueye X7 acts on them, and with auto heading off they
are open-loop moments that nothing on the drone limits. See set_roll and set_pitch for
how auto heading changes their meaning and why the autopilot ignores them.
Parameters:
-
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.
-
roll(float, default:0.0) –Moment set point in the roll direction in range <-1, 1>, a positive set point rolls the drone to the right. X7 only.
-
pitch(float, default:0.0) –Moment set point in the pitch direction in range <-1, 1>, a positive set point pitches the nose of the drone up. X7 only.
Source code in blueye/sdk/motion.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | |
set_boost
set_boost(boost_gain: float)
Set the boost gain.
Boost raises the force a full-stick setpoint asks for, up to the drone's boosted level at 1. Values up to 0.1 count as 0 and 0.1 to 1 is stretched over the whole range, so 0.55 is halfway. The drone uses boost minus slow after that, so boost and slow at 1 together give the normal level.
Parameters:
-
boost_gain(float) –Range from 0 to 1.
Source code in blueye/sdk/motion.py
330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
set_heave
set_heave(heave_value: float)
Set force reference for the heave direction
Parameters:
-
heave_value(float) –Force set point in the heave direction in range <-1, 1>, a positive set point makes the drone move downwards.
Source code in blueye/sdk/motion.py
140 141 142 143 144 145 146 147 148 149 | |
set_pitch
set_pitch(pitch_value: float)
Set moment reference for the pitch direction
Only the Blueye X7 has thrusters that can produce a pitch moment. Other models ignore this input.
With auto heading off the value is an open-loop moment set point, like yaw, and nothing on the drone limits the resulting angle. The drone settles where the thruster moment is balanced by its righting moment, and a large input held for a few seconds can tip it over. The drone keeps acting on the last setpoint for as long as the SDK is connected, so set it back to 0 when the manoeuvre is done.
With auto heading on the drone instead holds a pitch angle. The value is then an angular speed set point for that angle, which is bounded to 45 degrees either side of level, and the drone keeps the angle it has reached when the input returns to 0. Engaging auto heading resets the held roll and pitch angles to level.
While the autopilot is running a mission the drone holds level and ignores pitch input. Starting the autopilot also switches auto heading off.
Parameters:
-
pitch_value(float) –Moment set point in the pitch direction in range <-1, 1>, a positive set point pitches the nose of the drone up.
Source code in blueye/sdk/motion.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
set_roll
set_roll(roll_value: float)
Set moment reference for the roll direction
Only the Blueye X7 has thrusters that can produce a roll moment. Other models ignore this input.
With auto heading off the value is an open-loop moment set point, like yaw, and nothing on the drone limits the resulting angle. The drone settles where the thruster moment is balanced by its righting moment, and a large input held for a few seconds can roll it over. The drone keeps acting on the last setpoint for as long as the SDK is connected, so set it back to 0 when the manoeuvre is done.
With auto heading on the drone instead holds a roll angle. The value is then an angular speed set point for that angle, which is bounded to 45 degrees either side of level, and the drone keeps the angle it has reached when the input returns to 0. Engaging auto heading resets the held roll and pitch angles to level.
While the autopilot is running a mission the drone holds level and ignores roll input. Starting the autopilot also switches auto heading off.
Parameters:
-
roll_value(float) –Moment set point in the roll direction in range <-1, 1>, a positive set point rolls the drone to the right.
Source code in blueye/sdk/motion.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
set_slow
set_slow(slow_gain: float)
Set the slow gain.
Slow lowers the force a full-stick setpoint asks for, down to the drone's slow level at 1,
for fine positioning. Values up to 0.1 count as 0, and the drone uses boost minus slow,
see set_boost.
Parameters:
-
slow_gain(float) –Range from 0 to 1.
Source code in blueye/sdk/motion.py
355 356 357 358 359 360 361 362 363 364 365 366 367 | |
set_surge
set_surge(surge_value: float)
Set force reference for the surge direction
Parameters:
-
surge_value(float) –Force set point in the surge direction in range <-1, 1>, a positive set point makes the drone move forward.
Source code in blueye/sdk/motion.py
98 99 100 101 102 103 104 105 106 107 | |
set_sway
set_sway(sway_value: float)
Set force reference for the sway direction
Parameters:
-
sway_value(float) –Force set point in the sway direction in range <-1, 1>, a positive set point makes the drone move to the right.
Source code in blueye/sdk/motion.py
119 120 121 122 123 124 125 126 127 128 | |
set_yaw
set_yaw(yaw_value: float)
Set moment reference for the yaw direction
Parameters:
-
yaw_value(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
161 162 163 164 165 166 167 168 169 170 | |
zero_setpoints
zero_setpoints()
Set every setpoint to zero and send it.
Covers surge, sway, heave, yaw, roll and pitch as well as slow and boost. The drone keeps
the last motion input it received until a new one arrives or its watchdog times out, so
this is what disconnect sends before letting go.
Source code in blueye/sdk/motion.py
250 251 252 253 254 255 256 257 258 | |