Kinemat is the beginnings of a library for solving forward and reverse kinematics of robotic systems and graphical simulations.
Go to file
Renovate Bot 375f9c82df
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
chore(deps): update dependency earmark to v1.4.47
2024-07-13 06:29:59 +12:00
.vscode Update README. 2018-01-26 15:04:51 +13:00
config chore: migrate to local (#20) (#30) 2024-02-14 13:49:08 +13:00
lib chore: fix tests for Erlang 27. 2024-05-21 09:02:18 +12:00
test Start adding joint types. 2018-01-19 15:36:45 +13:00
.drone.yml chore: fix docs release. 2024-03-14 19:23:39 +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
.tool-versions chore(deps): update dependency erlang to v27.0.1 2024-07-11 01:31:43 +12:00
CHANGELOG.md chore: release version v1.0.1 2024-02-23 20:12:08 +13:00
LICENSE.md chore!: Relicense to HL3-FULL. 2023-01-17 11:02:18 +13:00
mix.exs chore(deps): update dependency ex_check to ~> 0.16 2024-03-01 23:20:47 +13:00
mix.lock chore(deps): update dependency earmark to v1.4.47 2024-07-13 06:29:59 +12:00
README.md chore: fix typo in readme 2024-03-08 14:45:46 +13:00
renovate.json chore: Configure Renovate (#31) 2024-02-14 17:42:55 +13:00

Build Status Hippocratic License HL3-FULL

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, "~> 1.0.1"}]
end

Docs are available on docs.harton.nz.

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.

Github Mirror

This repository is mirrored on Github from it's primary location on my Forgejo instance. Feel free to raise issues and open PRs on Github.

License

This software is licensed under the terms of the HL3-FULL, see the LICENSE.md file included with this package for the terms.

This license actively proscribes this software being used by and for some industries, countries and activities. If your usage of this software doesn't comply with the terms of this license, then contact me with the details of your use-case to organise the purchase of a license - the cost of which may include a donation to a suitable charity or NGO.