orocos_kinematics_dynamics icon indicating copy to clipboard operation
orocos_kinematics_dynamics copied to clipboard

Syntax Improvement ideas

Open ahoarau opened this issue 5 years ago • 2 comments
trafficstars

Hello, I'm glad to see this great library being updated, so I'm giving my two cents on some improvements that could be made on the syntax, based on my experience:

KDL::Vector

  • 1a. Make the data an Eigen::Vector3d so we can do math with it
  • 1b. Make x,y,z accessors public so we can do v.x = 1.0, instead of v.x(1.0) and double x = v.x()

KDL::Rotation

  • Make the data an Eigen::Matrix3d so we can do eigen math with it

KDL::JntArray

  • Make a zero-alloc constructor from an Eigen::VectorXd and std::vector<double>
  • Have an accessor operator []
  • make it compatible with c++11 range-based iterators
  • Make it inherit from a KDL::Array class that could be used to create some gains for example. Right now people are either mixing eigen/kdl types or using JntArrays for gains.

KDL::JntArrayVel

  • Make a zero-alloc constructor from eigen, std and JntArrays

All dynamic size arrays

  • Have the ability to "lock" the size of the array and throw exception if some aliasing occurs

All classes

  • Init at zero, or identity for matrices

What do you guys think ?

ahoarau avatar Jun 29 '20 13:06 ahoarau

All sounds good and reasonable. But likely this requires a bigger refactoring and also a bump to version 2, because most of the suggested changes break the API and require changes in user code, too.

But there is definitely a need for such a breaking refactoring, also to iron out many inconsistencies in the current API and to make use of some C++11 or newer features. Maybe we can use this issue to collect more ideas and suggestions, or just to reference it in other issues where API-breaking suggestions have been or will be made.

meyerj avatar Nov 11 '20 12:11 meyerj

Is there any roadmap for this 2.0 version ?

ahoarau avatar Nov 11 '20 14:11 ahoarau