XBotInterface
2.4.1
XBotInterface provides a generic API to model and control a robot.
|
Go to the documentation of this file.
20 #ifndef __KINEMATIC_CHAIN_H__
21 #define __KINEMATIC_CHAIN_H__
29 #include <eigen3/Eigen/Dense>
54 typedef std::shared_ptr<KinematicChain>
Ptr;
55 typedef std::shared_ptr<const KinematicChain>
ConstPtr;
124 bool getChainState(
const std::string& state_name, Eigen::VectorXd& q)
const;
132 std::map<std::string, ForceTorqueSensor::ConstPtr>
getForceTorque()
const;
140 std::map<std::string, ImuSensor::ConstPtr>
getImu()
const;
171 void getJointLimits(Eigen::VectorXd& q_min, Eigen::VectorXd& q_max)
const;
231 std::vector<std::string>& violating_joints)
const;
242 std::vector<std::string>& violating_joints)
const;
253 std::vector<std::string>& violating_joints)
const;
474 bool hasJoint(
const std::string& joint_name)
const;
498 const std::vector< urdf::JointConstSharedPtr > &
getUrdfJoints()
const;
505 const std::vector< urdf::LinkConstSharedPtr > &
getUrdfLinks()
const;
662 template <
typename... SyncFlags>
690 std::map<std::string, ForceTorqueSensor::Ptr>
_ft_map;
711 std::vector<urdf::JointConstSharedPtr> _urdf_joints;
712 std::vector<urdf::LinkConstSharedPtr> _urdf_links;
714 std::vector<std::string> _ordered_joint_name;
715 std::vector<int> _ordered_joint_id;
719 std::string _chain_name;
733 template <
typename... SyncFlags>
740 auto this_joint = getJointByName(j->getJointName());
741 this_joint->syncFrom(*j, flags...);
750 #endif // __KINEMATIC_CHAIN_H__
void getVelocityLimits(Eigen::VectorXd &qdot_max) const
Gets a vector of the chain joint velocity limits, as specified in the URDF file.
Definition: KinematicChain.cpp:1661
bool getJointVelocity(Eigen::VectorXd &qdot) const
Definition: KinematicChain.cpp:715
bool getJointEffort(Eigen::VectorXd &tau) const
Definition: KinematicChain.cpp:691
bool enforceJointLimits(Eigen::VectorXd &q) const
Modifies the input joint position vector by enforcing joint limits.
Definition: KinematicChain.cpp:2074
Joint::ConstPtr getJoint(int i) const
Getter for the i-th Joint Ptr.
Definition: KinematicChain.cpp:1794
Kinematic chain abstraction as a set of joints and sensors.
Definition: KinematicChain.h:49
bool setMotorPosition(const Eigen::VectorXd &q)
Definition: KinematicChain.cpp:975
std::ostream & operator<<(std::ostream &os, const XBot::Joint &j)
ostream operator << for a Joint object
Definition: Joint.cpp:322
KinematicChain()
Default constructor.
Definition: KinematicChain.cpp:29
std::map< std::string, ForceTorqueSensor::ConstPtr > getForceTorque() const
Getter for the force-torque sensor map pertaining to the chain.
Definition: KinematicChain.cpp:1818
bool setEffortReference(const Eigen::VectorXd &tau)
Definition: KinematicChain.cpp:922
bool getEffortReference(Eigen::VectorXd &tau) const
Definition: KinematicChain.cpp:703
bool isVirtual() const
Method for determining whether a chain is virtual, i.e.
Definition: KinematicChain.cpp:231
bool getVelocityReference(Eigen::VectorXd &qdot) const
Definition: KinematicChain.cpp:788
void print() const
Prints a pretty table about chain state.
Definition: KinematicChain.cpp:2001
std::unordered_map< int, double > JointIdMap
std::map with key representing the joint ID (i.e.
Definition: TypedefAndEnums.h:33
const std::string & getChainName() const
Method returning the name of the chain.
Definition: KinematicChain.cpp:284
std::map< std::string, ForceTorqueSensor::Ptr > getForceTorqueInternal() const
Definition: KinematicChain.cpp:1827
bool enforceEffortLimit(Eigen::VectorXd &tau) const
Modifies the input joint effort vector by enforcing effort limits.
Definition: KinematicChain.cpp:2060
bool setPositionReference(const Eigen::VectorXd &q)
Definition: KinematicChain.cpp:1001
bool setVelocityReference(const Eigen::VectorXd &qdot)
Definition: KinematicChain.cpp:1040
int getJointNum() const
Method returning the number of enabled joints belonging to the chain.
Definition: KinematicChain.cpp:269
std::shared_ptr< const ForceTorqueSensor > ConstPtr
Definition: ForceTorqueSensor.h:46
bool setJointPosition(const Eigen::VectorXd &q)
Definition: KinematicChain.cpp:895
std::shared_ptr< const KinematicChain > ConstPtr
Definition: KinematicChain.h:55
const std::string & getJointName(int i) const
Method returning the name of the i-th joint of the chain.
Definition: KinematicChain.cpp:305
bool getMotorVelocity(Eigen::VectorXd &qdot) const
Definition: KinematicChain.cpp:752
std::unordered_map< std::string, double > JointNameMap
std::map with key representing the joint human-readable name and value representing a joint state (e....
Definition: TypedefAndEnums.h:51
const std::vector< urdf::LinkConstSharedPtr > & getUrdfLinks() const
Method returning the vector of urdf::Links corresponding to the chain.
Definition: KinematicChain.cpp:264
const std::vector< std::string > & getJointNames() const
Returns a vector containing the namess of all joints in the chain, from base link to tip link.
Definition: KinematicChain.cpp:1577
const std::string & getParentLinkName(int i) const
Method returning the name of the parent link corresponding to the i-th joint of the chain.
Definition: KinematicChain.cpp:300
void getJointLimits(Eigen::VectorXd &q_min, Eigen::VectorXd &q_max) const
Gets a vector of the chain joint limits, as specified in the URDF file.
Definition: KinematicChain.cpp:1643
std::map< std::string, XBot::Joint::Ptr > _joint_name_map
Definition: KinematicChain.h:685
std::map< std::string, ImuSensor::Ptr > getImuInternal() const
Definition: KinematicChain.cpp:1860
std::shared_ptr< KinematicChain > Ptr
Definition: KinematicChain.h:54
std::shared_ptr< Joint > Ptr
Definition: Joint.h:53
const std::vector< urdf::JointConstSharedPtr > & getUrdfJoints() const
Method returning the vector of urdf::Joints corresponding to the chain.
Definition: KinematicChain.cpp:259
bool setJointEffort(const Eigen::VectorXd &tau)
Definition: KinematicChain.cpp:909
bool getTemperature(Eigen::VectorXd &temp) const
Definition: KinematicChain.cpp:776
bool checkEffortLimits(const Eigen::VectorXd &tau, std::vector< std::string > &violating_joints) const
Check the input joint effort vector against joint limits.
Definition: KinematicChain.cpp:1689
bool setMotorVelocity(const Eigen::VectorXd &qdot)
Definition: KinematicChain.cpp:988
void pushBackJoint(Joint::Ptr joint)
add a joint in the kinematic chain pushing it in the end of the chain
Definition: KinematicChain.cpp:237
bool checkVelocityLimits(const Eigen::VectorXd &qdot, std::vector< std::string > &violating_joints) const
Check the input joint velocity vector against joint limits.
Definition: KinematicChain.cpp:1750
KinematicChain & operator=(const KinematicChain &rhs)
Custom copy assignment, which guarantees independence between copies by performing a deep copy.
Definition: KinematicChain.cpp:187
bool setJointVelocity(const Eigen::VectorXd &qdot)
Definition: KinematicChain.cpp:948
bool getDamping(Eigen::VectorXd &D) const
Definition: KinematicChain.cpp:679
std::shared_ptr< const Joint > ConstPtr
Definition: Joint.h:54
void printTracking() const
Prints a pretty table about chain tracking.
Definition: KinematicChain.cpp:2025
bool mapToEigen(const JointIdMap &id_map, Eigen::VectorXd &eigen_vector) const
Converts a state vector for an arbitrary subset of the chain state (specified as a JointIdMap) to its...
Definition: KinematicChain.cpp:2151
bool getJointPosition(Eigen::VectorXd &q) const
Definition: KinematicChain.cpp:316
std::map< int, XBot::Joint::Ptr > _joint_id_map
Definition: KinematicChain.h:686
bool syncFrom(const KinematicChain &other, SyncFlags... flags)
Synchronize the current KinematicChain with another KinematicChain object.
Definition: KinematicChain.h:734
const std::string & getChildLinkName(int i) const
Method returning the name of the child link corresponding to the i-th joint of the chain.
Definition: KinematicChain.cpp:295
bool getPositionReference(Eigen::VectorXd &q) const
Definition: KinematicChain.cpp:500
std::vector< ForceTorqueSensor::Ptr > _ft_vector
Definition: KinematicChain.h:689
int getJointId(int i) const
Method returning the ID of the i-th joint of the chain.
Definition: KinematicChain.cpp:289
bool checkJointLimits(const Eigen::VectorXd &q, std::vector< std::string > &violating_joints) const
Check the input joint position vector against joint limits.
Definition: KinematicChain.cpp:1720
Definition: XBotCoreModel.h:40
bool getMotorPosition(Eigen::VectorXd &q) const
Definition: KinematicChain.cpp:740
friend std::ostream & operator<<(std::ostream &os, const XBot::KinematicChain &c)
Definition: KinematicChain.cpp:1563
void getEffortLimits(Eigen::VectorXd &tau_max) const
Gets a vector of the chain joint effort limits, as specified in the URDF file.
Definition: KinematicChain.cpp:1628
bool setTemperature(const Eigen::VectorXd &temp)
Definition: KinematicChain.cpp:1027
void removeJoint(int i)
remove the i-th joint in the kinematic chain
Definition: KinematicChain.cpp:249
Joint::Ptr getJointInternal(int i) const
Getter for the i-th Joint Ptr.
Definition: KinematicChain.cpp:1784
int getChainDofIndex(int joint_id) const
Getter for the chain dof index (local index of a joint inside a chain, this means that the base link ...
Definition: KinematicChain.cpp:1990
bool getJointAcceleration(Eigen::VectorXd &qddot) const
Definition: KinematicChain.cpp:727
std::map< std::string, ForceTorqueSensor::Ptr > _ft_map
Definition: KinematicChain.h:690
const std::string & getTipLinkName() const
Method returning the name of the chain tip link.
Definition: KinematicChain.cpp:279
bool setJointAcceleration(const Eigen::VectorXd &qddot)
Definition: KinematicChain.cpp:961
Definition: RobotInterface.h:36
std::vector< XBot::Joint::Ptr > _joint_vector
Definition: KinematicChain.h:687
bool enforceVelocityLimit(Eigen::VectorXd &qdot) const
Modifies the input joint velcoity vector by enforcing joint limits.
Definition: KinematicChain.cpp:2088
bool setStiffness(const Eigen::VectorXd &K)
Definition: KinematicChain.cpp:1014
std::map< std::string, ImuSensor::ConstPtr > getImu() const
Getter for the IMU sensor map pertaining to the chain.
Definition: KinematicChain.cpp:1851
const std::vector< int > & getJointIds() const
Returns a vector containing the IDs of all joints in the chain, from base link to tip link.
Definition: KinematicChain.cpp:1572
void shallowCopy(const KinematicChain &chain)
Updates the current object (this) by performing a shallow copy with the chain passed as argument.
Definition: KinematicChain.cpp:215
bool getChainState(const std::string &state_name, JointIdMap &q) const
Gets the chain joints group state configuration as specified in the robot SRDF.
Definition: KinematicChain.cpp:1942
std::shared_ptr< const ImuSensor > ConstPtr
Definition: ImuSensor.h:33
const std::string & getBaseLinkName() const
Method returning the name of the chain base link.
Definition: KinematicChain.cpp:274
Definition: IXBotModel.h:20
bool setDamping(const Eigen::VectorXd &D)
Definition: KinematicChain.cpp:935
bool eigenToMap(const Eigen::VectorXd &eigen_vector, JointIdMap &id_map) const
Converts a state vector for the whole chain to its JointIdMap representation.
Definition: KinematicChain.cpp:2117
bool getStiffness(Eigen::VectorXd &K) const
Definition: KinematicChain.cpp:764
bool hasJoint(int joint_id) const
check if the chain has a joint with a certain id
Definition: KinematicChain.cpp:1623
std::map< std::string, ImuSensor::Ptr > _imu_map
Definition: KinematicChain.h:693
Definition: XBotInterface.h:41
std::vector< ImuSensor::Ptr > _imu_vector
Definition: KinematicChain.h:692