3 #include <tf/transform_listener.h> 5 #include "../support/support.h" 6 #include "../support/defines.h" 8 #include "../header/publisher.h" 9 #include "../header/controller.h" 11 #include "../header/transforms.h" 15 int main(
int argc,
char **argv)
17 ROS_INFO(
"[MAIN] Start");
18 ros::init(argc, argv,
"main");
21 std::string topicTwist =
"/uwsim/g500_A/twist_command_A";
22 ros::Publisher pubTwist = nh.advertise<geometry_msgs::TwistStamped>(topicTwist,1);
25 Publisher pubClassTwist(pubTwist);
26 geometry_msgs::TwistStamped twist;
27 twist.twist.linear.x=0;
28 twist.twist.linear.y=0;
29 twist.twist.linear.z=0;
30 twist.twist.angular.x=0;
31 twist.twist.angular.y=0;
32 twist.twist.angular.z=0;
36 double goalLinearVect[] = {-0.287, -0.062, 7.424};
37 Eigen::Matrix4d wTgoal_eigen = Eigen::Matrix4d::Identity();
40 wTgoal_eigen.topLeftCorner(3,3) = Eigen::Matrix3d::Identity();
42 wTgoal_eigen(0, 3) = goalLinearVect[0];
43 wTgoal_eigen(1, 3) = goalLinearVect[1];
44 wTgoal_eigen(2, 3) = goalLinearVect[2];
46 tf::TransformListener tfListener;
47 tf::StampedTransform wTv_tf;
51 transf.wTgoal_eigen = wTgoal_eigen;
52 transf.wTv_eigen = CONV::transfMatrix_tf2eigen(wTv_tf);
58 tfListener.waitForTransform(
"world",
"/girona500_A", ros::Time(0), ros::Duration(3.0));
65 tfListener.lookupTransform(
"world",
"/girona500_A", ros::Time(0), wTv_tf);
67 }
catch (tf::TransformException &ex) {
68 ROS_ERROR(
"%s",ex.what());
69 ros::Duration(1.0).sleep();
73 transf.wTv_eigen = CONV::transfMatrix_tf2eigen(wTv_tf);
74 controller.updateTransforms(&transf);
79 twist.twist.angular.x=yDot(5);
80 twist.twist.angular.y=yDot(6);
81 twist.twist.angular.z=yDot(7);
82 twist.twist.linear.x=yDot(8);
83 twist.twist.linear.y=yDot(9);
84 twist.twist.linear.z=yDot(10);
86 pubClassTwist.publish(twist);
The Controller class is responsabile of 1) taking matrices and giving them to Tasks classes...
std::vector< double > execAlgorithm(std::vector< Task * > tasks)
Controller::execAlgorithm this function calls the step of the algorithm modifying (in the for) each t...