Robotics framework - Geometry, kinematics and visualisation

Posted on December 30, 2022 by Zach Lambert ‐ 3 min read

Robotics framework - Geometry, kinematics and visualisation

Following the core parts of the system, libraries were added for geometry, rendering, and kinematics.

Visualisation

The viewer library provides a viewport component which creates frame buffer which a scene can be rendered to.

This is implemented similar to the window itelf, in that it accepts a list of “render items” in it’s constructor, which inherit from viewer::Item and implement methods for queuing render commands.

Additionally, any render item can load whatever renderer it likes. A render item will request a shared_ptr to a specific renderer on initialisation, which will be created if it doesn’t exist. This allows libraries to define additional renderers that aren’t in the base viewer library.

In general, a renderer is something that provides methods for queueing render commands, and a method for executing the commands using opengl. At the moment, the two renders available are:

  • marker_renderer: Uses instanced rendering to render primitive volumes (box, sphere, cylinder, cone), or collections of primitives, such as for arrows for reference frame markers.
  • mesh_renderer: Loads a mesh into a vertex buffer / element buffer, such that it is available for rendering.

The rendering is very simple at the moment, but at some point the mesh renderer will be extended to work with meshes textures, normal maps, etc. Additionally, if I have a go at simulating cameras, it would be worth trying to add raycasting.

Geometry

The geometry library provides:

  • Primitive shapes, including volume primitives and mesh primitives
  • Mesh representations
  • Intersections of meshes using bounded volume hierarchies

Below shows a visualisation of the intersection detection of two meshes that been generated from primitive shapes.

Kinematics

A robot is represented as a collection of joints, defining constraints between link poses.

Robots are allowed to be parallel, in that the kinematic linkage is not a tree, but has loops. In this case, the robot is factorised into a spanning tree and a number of loop closure constraints that must be resolved.

For parallel robots, the robot configuration is defined by a subset of the joint positions, the remaining positions being dependent. This selection of joints is not unique, so the robot description also includes specification of which joints are chosen to represent the configuration. In some cases, certain coordinate selections can give singularities, where others won’t.

In addition to forward kinematics, the jacobian is provided for the transform between any pair of links in the linkage, for serial and parallel robots. This allows for control.

Below shows the example of velocity control of a 6-dof serial linkage using the manipulator, as well as setting the configuration coordinates of a parallel linkage.

Differential contraints test

The robot description can also include specification of ground constraints.

This will include non-holonomic differential constraints, whereby the degrees of freedom of an incremental motion is decreased, but the degrees of freedom of the configuration is not reduced.

Loop closure constraints provide a constraint in terms of the configuration, which can be driven to zero. Differential constraints can only provide a constraint on relative changes in coordinates. ie: There is a constraint in the relative change in joint positions, and the relative change in base pose.

In this case, when the positions are changed, this assumes they changed relative to the previous positions, and the kinematic model updates the base pose accordingy. Again, the jacobian is provided, allowing for inverse kinematics of the base pose motion.

Below shows experimenting with this on a robot with legs and wheels, and commanding it to move with a given velocity. Since this is just naive velocity control at the moment, and the robot is underconstrained, it simply chooses the set of joint velocity with the lowest norm, which means it may approach singularities. To avoid this, this kinematic model woud need to be used in a proper motion planning algorithm.