BB.Error.Invalid.Robotis.ServoMode exception (bb_servo_robotis v0.6.0)

Copy Markdown View Source

A servo can't be driven in the operating mode it was configured with.

Raised at startup, once the servo on the bus has identified itself. The reason says which way it failed:

  • :unknown_model - the model number isn't in BB.Servo.Robotis.Model, so only :position can be assumed to work
  • :unsupported_mode - the model doesn't implement the mode at all; an XL430 has no current control
  • :no_torque_constant - the mode needs to turn newton metres into amps, and there's no published torque constant for that model

The actuator refuses to start rather than falling back to something the robot author didn't ask for.

Summary

Types

reason()

@type reason() :: :no_torque_constant | :unknown_model | :unsupported_mode

t()

@type t() :: %BB.Error.Invalid.Robotis.ServoMode{
  __exception__: term(),
  bread_crumbs: term(),
  class: term(),
  mode: atom(),
  model: String.t() | nil,
  model_number: integer(),
  path: term(),
  reason: reason(),
  servo_id: non_neg_integer(),
  splode: term(),
  stacktrace: term(),
  supported: [atom()],
  vars: term()
}

Functions

exception(args)

@spec exception(opts :: Keyword.t()) :: %BB.Error.Invalid.Robotis.ServoMode{
  __exception__: term(),
  bread_crumbs: term(),
  class: term(),
  mode: term(),
  model: term(),
  model_number: term(),
  path: term(),
  reason: term(),
  servo_id: term(),
  splode: term(),
  stacktrace: term(),
  supported: term(),
  vars: term()
}

Create an Elixir.BB.Error.Invalid.Robotis.ServoMode without raising it.

Keys

  • :servo_id
  • :model
  • :model_number
  • :mode
  • :reason
  • :supported