Skip to content

Commit

Permalink
Compatibility with 3dof forces
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoMingo committed Apr 17, 2024
1 parent bbafbe6 commit 6f4cccf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/opensot/OpenSotImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,10 @@ bool OpenSotImpl::update(double time, double period)

_model->getJacobian(link_name, _J);

Eigen::Vector6d f_value;
Eigen::VectorXd f_value;
p.second.getValue(_x, f_value);

_tau.noalias() -= _J.transpose() * f_value;
_tau.noalias() -= _J.block(0, 0, f_value.size(), _J.cols()).transpose() * f_value;

if(_logger)
{
Expand Down
8 changes: 7 additions & 1 deletion src/ros/RosServerClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,13 @@ void XBot::Cartesian::RosServerClass::publish_solution(ros::Time time)
auto frame = p.first.substr(6); // removes "force_"

Eigen::Affine3d w_T_f = _model->getPose(frame);
Eigen::Vector6d ww = p.second;
Eigen::Vector6d ww;
ww.setZero();
if(p.second.size() == 3)
ww.segment(0,3) = p.second;
else
ww = p.second;

//in local frame
ww.segment(0,3) = w_T_f.linear().inverse() * ww.segment(0,3);
ww.segment(3,3) = w_T_f.linear().inverse() * ww.segment(3,3);
Expand Down

0 comments on commit 6f4cccf

Please sign in to comment.