bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
spatial_arm.h File Reference
#include "bitsim/bitsim_config.h"
#include "bitsim/bitsim_types.h"
#include <Eigen/Core>
#include <chrono/core/ChFrame.h>
#include <chrono/core/ChVector3.h>
#include <array>
#include <functional>
#include <optional>
#include <vector>
Include dependency graph for spatial_arm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  bitsim::kinematics::SpatialArm
 An arm with three revolute joints. Joint 1 turns the arm about the vertical axis at height h0; joints 2 and 3, the shoulder and the elbow, turn about horizontal axes, so the upper arm and the forearm move in a vertical plane. More...
struct  bitsim::kinematics::IKResult
 The result of numerical_ik. More...

Namespaces

namespace  bitsim
namespace  bitsim::kinematics

Typedefs

using bitsim::kinematics::SpatialJoints = std::array<real_t, 3>
 The angles of the three joints of a SpatialArm [rad].
using bitsim::kinematics::IKObserver = std::function<void(int, const SpatialJoints &, real_t)>
 Called by numerical_ik at every iteration with the iteration, the joint angles and the error [m], for example to print the progress.

Functions

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 chrono::ChVector3d &p_W)
 All the joint angles that put the end-effector at p_W.
std::optional< SpatialJoints > bitsim::kinematics::spatial_ik_elbow_up (const SpatialArm &arm, const chrono::ChVector3d &p_W)
 The solution facing the target with the elbow up, or nothing when p_W is out of reach.
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 chrono::ChVector3d &target, SpatialJoints q0, real_t damping, int max_iterations=100, real_t tolerance=1.0e-6, real_t max_step=0.5, const IKObserver &observer={})
 Inverse kinematics by iteration from q0: \(q \leftarrow q + \Delta q\) until the end-effector is within tolerance of the target.