Resurgence (PY2022)
Codebase for the Husky Robotics 2021-2022 rover Resurgence
Loading...
Searching...
No Matches
ForwardArmKinematics.h
1#pragma once
2
3#include "../navtypes.h"
4
5#include <Eigen/Core>
6
7namespace kinematics {
8
15template <unsigned int D, unsigned int N>
17public:
18 virtual ~ForwardArmKinematics() = default;
19
25 constexpr unsigned int getNumSegments() const {
26 return N;
27 }
28
34 constexpr unsigned int getNumDimensions() const {
35 return D;
36 }
37
43 virtual navtypes::Vectord<N> getSegLens() const = 0;
44
51 virtual bool satisfiesConstraints(const navtypes::Vectord<N>& jointPos) const = 0;
52
60 virtual navtypes::Matrixd<D, N>
61 getJacobian(const navtypes::Vectord<N>& jointPos) const = 0;
62
69 virtual navtypes::Vectord<D>
70 jointPosToEEPos(const navtypes::Vectord<N>& jointPos) const = 0;
71
79 navtypes::Vectord<D> jointVelToEEVel(const navtypes::Vectord<N>& jointPos,
80 const navtypes::Vectord<N>& jointVel) const {
81 return getJacobian(jointPos) * jointVel;
82 }
83
91 navtypes::Vectord<N> eeVelToJointVel(const navtypes::Vectord<N>& jointPos,
92 const Eigen::Vector2d& eeVel) const {
93 navtypes::Matrixd<2, N> jacobian = getJacobian(jointPos);
94 return jacobian.colPivHouseholderQR().solve(eeVel);
95 }
96};
97
98} // namespace kinematics
A class that calculates the forward kinematics of an arm.
Definition ForwardArmKinematics.h:16
constexpr unsigned int getNumDimensions() const
Get the number of dimensions of the end effector space.
Definition ForwardArmKinematics.h:34
virtual navtypes::Vectord< N > getSegLens() const =0
Get the segment lengths for this arm.
virtual navtypes::Vectord< D > jointPosToEEPos(const navtypes::Vectord< N > &jointPos) const =0
Given a joint position, calculate the current EE position.
navtypes::Vectord< D > jointVelToEEVel(const navtypes::Vectord< N > &jointPos, const navtypes::Vectord< N > &jointVel) const
Calculate the EE velocity.
Definition ForwardArmKinematics.h:79
virtual navtypes::Matrixd< D, N > getJacobian(const navtypes::Vectord< N > &jointPos) const =0
Get the jacobian matrix for the arm at the given joint angles.
navtypes::Vectord< N > eeVelToJointVel(const navtypes::Vectord< N > &jointPos, const Eigen::Vector2d &eeVel) const
Calculates the joint velocity that yields the desired EE velocity.
Definition ForwardArmKinematics.h:91
virtual bool satisfiesConstraints(const navtypes::Vectord< N > &jointPos) const =0
Check if the given joint configuration is valid.
constexpr unsigned int getNumSegments() const
Get the number of segments in this arm.
Definition ForwardArmKinematics.h:25