7 #include <iCub/ctrl/math.h> 8 #include <yarp/math/Math.h> 9 #include <yarp/os/Bottle.h> 10 #include <yarp/os/Property.h> 11 #include <yarp/os/LogStream.h> 14 using namespace Eigen;
30 prop_state.topRows<3>() = cur_state.topRows<3>().colwise() + delta_hand_pose_.head<3>().cast<float>();
32 prop_state.middleRows<3>(3) = (cur_state.middleRows<3>(3).colwise() + delta_hand_pose_.middleRows<3>(3).cast<float>());
33 prop_state.middleRows<3>(3).colwise().normalize();
35 RowVectorXf ang = cur_state.bottomRows<1>().array() +
static_cast<float>(delta_angle_);
37 for (
unsigned int i = 0; i < ang.cols(); ++i)
39 if (ang(i) > M_PI) ang(i) -= 2.0 * M_PI;
40 else if (ang(i) <= -M_PI) ang(i) += 2.0 * M_PI;
43 prop_state.bottomRows<1>() = ang;
49 std::cerr <<
"ERROR::PFPREDICTION::SETEXOGENOUSMODEL" << std::endl;
50 std::cerr <<
"ERROR:\n\tCall to unimplemented base class method.";
52 return MatrixXf::Zero(1, 1);
58 if (property ==
"ICFW_DELTA")
59 return setDeltaMotion();
61 if (property ==
"ICFW_INIT")
63 initialize_delta_ =
true;
64 return setDeltaMotion();
73 VectorXd ee_pose = readPose();
75 if (!initialize_delta_)
77 delta_hand_pose_.head<3>() = ee_pose.head<3>() - prev_ee_pose_.head<3>();
79 delta_hand_pose_.middleRows<3>(3) = ee_pose.middleRows<3>(3) - prev_ee_pose_.middleRows<3>(3);
81 delta_angle_ = ee_pose(6) - prev_ee_pose_(6);
82 if (delta_angle_ > M_PI) delta_angle_ -= 2.0 * M_PI;
83 else if (delta_angle_ <= -M_PI) delta_angle_ += 2.0 * M_PI;
87 delta_hand_pose_ = VectorXd::Zero(6);
89 initialize_delta_ =
false;
92 prev_ee_pose_ = ee_pose;
void propagate(const Eigen::Ref< const Eigen::MatrixXf > &cur_state, Eigen::Ref< Eigen::MatrixXf > prop_state) override
bool setProperty(const std::string &property) override
Eigen::MatrixXf getExogenousMatrix() override