Kinemat is the beginnings of a library for solving forward and reverse kinematics of robotic systems and graphical simulations.
Find a file
2021-12-09 11:22:31 +13:00
.vscode Update README. 2018-01-26 15:04:51 +13:00
config chore: set up git_ops and auto-releasing 2021-05-24 07:41:29 +12:00
lib fix(docs): fix compiler warnings caused by documentation typos. 2021-05-24 07:29:15 +12:00
test Start adding joint types. 2018-01-19 15:36:45 +13:00
.formatter.exs Deps updates 2018-11-12 23:30:03 +00:00
.gitignore Reconstruction of prior Kinemat repo using new angle package. 2017-11-05 19:51:49 +13:00
.gitlab-ci.yml chore: rename default branch to main. 2021-12-08 11:34:14 +13:00
CHANGELOG.md chore: set up git_ops and auto-releasing 2021-05-24 07:41:29 +12:00
LICENSE Add LICENSE 2018-11-12 23:14:01 +00:00
mix.exs chore(deps): update dependency graphmath to ~> 2.5 2021-12-09 11:22:31 +13:00
mix.lock chore(deps): Update graphmath to 2.5.0. 2021-12-08 11:53:00 +13:00
README.md Update README. 2018-01-26 15:04:51 +13:00
renovate.json chore: update renovate.json 2021-12-09 11:17:38 +13:00

Kinemat

Kinemat is the beginnings of a library for solving forward and reverse kinematics of robotic systems and graphical simulations.

Installation

As this package currently doesn't do what it says on the tin, I've not published a version to hex yet. Maybe when it looks more complete.

For now, you can install it as a Git dependency:

def deps do
  [{:kinemat, "~> 0.1.0"}]
end

Usage

Representing angles regardless of unit

Since Angles are probably something you want to use we use the angle package to store and convert between different types of angles.

Most usefully you can use the ~a sigil to create angles in different units. See the angle docs for more information.

Representing spacial coordinates

Kinemat uses the Point protocol to handle manipulations of spacial coordinates. The protocol is implemented by Cartesian, Cylindrical and Spherical.

iex> use Kinemat
...> use Kinemat.Coordinates
...> Cartesian.init(3,4,5)
...> |> Point.to_cylindrical()
#Kinemat.Point<[azimuth: #Angle<0.9272952180016122㎭>,
                radial: 5.0,
                vertical: 5]>

Representing spacial orientations

Kinemat uses the Orientation module to allow manipulations and conversions between the three primary orientation modules; Euler, RotationMatrix and Quaternion.

Note that not all Euler orders are supported, but only so-called "Tait-Bryan" angles.

iex> use Kinemat
...> use Kinemat.Orientations
...> Euler.init(:xyz, ~a(10)d, ~a(20)d, ~a(30)d)
...> |> Orientation.to_quaternion()
#Kinemat.Orientation<[
  type: :quaternion,
  w: #Angle<0.943714364147489㎭>,
  x: 0.12767944069578063,
  y: 0.14487812541736914,
  z: 0.2685358227515692
]>

Representing frames of reference

Kinemat can build a Frame given the combination of an Orientation and a Point;

iex> use Kinemat
...> point = Kinemat.Coordinates.Cylindrical.init(10, ~a(20)d, 30)
...> orientation = Kinemat.Orientations.Euler.init(:xyz, ~a(10)d, ~a(20)d, ~a(30)d)
...> frame = Frame.init(point, orientation)
#Kinemat.Frame<[
  orientation: #Kinemat.Orientation<[
    euler: :xyz,
    x: #Angle<10°>,
    y: #Angle<20°>,
    z: #Angle<30°>
  ]>,
  point: #Kinemat.Point<[azimuth: #Angle<20°>, radial: 10, vertical: 30]>
]>

And frames can be converted to homogeneous transformations

...> Kinemat.HomogeneousTransformation.to_homogeneous_transformation(frame)
{ 0.8137976813493738,  0.5438381424823255, -0.20487412870286215,  9.396926207859085,
 -0.46984631039295416, 0.823172944645501,   0.3187957775971678,   3.420201433256687,
  0.3420201433256687, -0.16317591116653482, 0.9254165783983234,  30,
  0.0,                 0.0,                 0.0,                  1.0}

Representing joints

Kinemat can build Revolute, Cylindrical and Prismatic joints starting with a frame and extra information based on the kind of joint in use.

iex> use Kinemat
...> use Kinemat.Joints
...> Revolute.init(Frame.zero(), limits: {~a(-10)d, ~a(10)d})
%Kinemat.Joints.Revolute{
  frame: #Kinemat.Frame<[
    orientation: #Kinemat.Orientation<[
      euler: :xyz,
      x: #Angle<0>,
      y: #Angle<0>,
      z: #Angle<0>
    ]>,
    point: #Kinemat.Point<[x: 0, y: 0, z: 0]>
  ]>,
  limits: {#Angle<-10°>, #Angle<10°>},
  position: #Angle<-10°>
}

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/kinemat.