bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
kinematics.cpp File Reference
#include "bitsim/bitsim_config.h"
#include "bitsim/bitsim_consts.h"
#include "bitsim/geometry/rotations.h"
#include "bitsim/kinematics/denavit_hartenberg.h"
#include "bitsim/kinematics/joint.h"
#include "bitsim/kinematics/planar_arm.h"
#include "bitsim/kinematics/spatial_arm.h"
#include "bitsim/maths/math_utils.h"
#include <Eigen/Dense>
#include <algorithm>
#include <cmath>
#include <utility>
Include dependency graph for kinematics.cpp:

Namespaces

namespace  bitsim
namespace  bitsim::kinematics

Functions

chrono::ChFrame bitsim::kinematics::joint_rotation (real_t q)
 The frame of a revolute joint turned by q [rad] about its z axis: a rotation, with no offset.
ChVector3d bitsim::kinematics::planar_fk (const PlanarArm &arm, const PlanarJoints &q)
 Where the tip is, written out with trigonometry: \(x = l_1 \cos q_1 + l_2 \cos(q_1 + q_2)\), \(y = l_1 \sin q_1 + l_2 \sin(q_1 + q_2)\).
ChFrame bitsim::kinematics::planar_fk_frames (const PlanarArm &arm, const PlanarJoints &q)
 The pose of the tip as a chain of frames, \(X_{WE} = X_{W1} X_{12} X_{2E}\): each joint adds a rotation about z, each link an offset along x.
std::vector< PlanarJoints > bitsim::kinematics::planar_ik (const PlanarArm &arm, real_t x, real_t y)
 The joint angles that put the tip at (x, y), from the law of cosines.
RealMat2d bitsim::kinematics::planar_jacobian (const PlanarArm &arm, const PlanarJoints &q)
 The Jacobian \(\partial(x, y) / \partial(q_1, q_2)\). It is singular when \(\sin q_2 = 0\): the arm fully stretched or folded.
std::vector< ChFrame<> > bitsim::kinematics::spatial_fk_all (const SpatialArm &arm, const SpatialJoints &q)
 The pose in the world of every joint frame, followed by the end-effector: \(X_{W1}, X_{W2}, X_{W3}, X_{WE}\).
ChFrame bitsim::kinematics::spatial_fk (const SpatialArm &arm, const SpatialJoints &q)
 The pose of the end-effector in the world, \(X_{WE}\).
std::vector< SpatialJoints > bitsim::kinematics::spatial_ik (const SpatialArm &arm, const ChVector3d &p_W)
std::optional< SpatialJoints > bitsim::kinematics::spatial_ik_elbow_up (const SpatialArm &arm, const ChVector3d &p_W)
RealMat3d bitsim::kinematics::numerical_jacobian (const SpatialArm &arm, const SpatialJoints &q)
 The Jacobian \(\partial(x, y, z) / \partial(q_1, q_2, q_3)\) of the end-effector's position by central differences. It needs only the forward kinematics.
IKResult bitsim::kinematics::numerical_ik (const SpatialArm &arm, const ChVector3d &target, SpatialJoints q0, real_t damping, int max_iterations, real_t tolerance, real_t max_step, const IKObserver &observer)
chrono::ChFrame bitsim::kinematics::dh_frame (const DHRow &row)
 \(R_z(\theta)\, T_z(d)\, T_x(a)\, R_x(\alpha)\)
chrono::ChFrame bitsim::kinematics::dh_fk (const std::vector< DHRow > &table)
 The product of the frames of all the rows: the pose of the last frame in the first.
std::vector< DHRow > bitsim::kinematics::spatial_dh_table (const SpatialArm &arm, const SpatialJoints &q)
 The Denavit-Hartenberg table of a SpatialArm at joint angles q. dh_fk of it is spatial_fk.
chrono::ChMatrix33d bitsim::kinematics::rot_x (real_t angle)
 The rotation by angle [rad] about the x axis. It leaves the x axis unchanged:
chrono::ChMatrix33d bitsim::kinematics::rot_z (real_t angle)
 The rotation by angle [rad] about the z axis.
real_t bitsim::kinematics::wrap_angle (real_t angle)
 The angle [rad] wrapped to \((-\pi, \pi]\), so that angles that differ by whole turns compare equal.