r2_controller_node.cpp
Go to the documentation of this file.
00001 #include <ros/ros.h>
00002 #include <r2_controllers_ros/R2RosTrajectoryManager.hpp>
00003 #include <r2_controllers_ros/R2RosArbiter.hpp>
00004 #include <r2_controllers_ros/R2RosTreeId.hpp>
00005 
00006 
00007 int main(int argc, char **argv)
00008 {
00009     ros::init(argc, argv, "R2TrajectoryManager");
00010     ros::NodeHandle nh;
00011     ros::NodeHandle pnh("~");
00012     
00013     double rate;
00014     std::vector<double> priorityLevels;
00015     std::vector<double> linearTols;
00016     std::vector<double> angularTols;
00017     double momLimit;
00018     double taskGain;
00019     int ikMaxItr;
00020     double ikMaxTwist;
00021 
00022     std::string urdf;
00023 
00024     pnh.param("rate", rate, 30.0);
00025     priorityLevels.push_back(1);
00026     priorityLevels.push_back(2);
00027     priorityLevels.push_back(3);
00028     priorityLevels.push_back(4);
00029     linearTols.push_back(0.0001);
00030     linearTols.push_back(0.001);
00031     linearTols.push_back(0.01);
00032     linearTols.push_back(0.1);
00033     angularTols.push_back(0.000174533);
00034     angularTols.push_back(0.001745329);
00035     angularTols.push_back(0.017453293);
00036     angularTols.push_back(0.174532925);
00037     momLimit = 1e-12;
00038     taskGain = 000032;
00039     ikMaxItr = 10;
00040     ikMaxTwist = 0.1;
00041 //    pnh.param("priorityLevels", priorityLevels, std::vector<double>(1,1.0));
00042 //    pnh.param("linearTols", linearTols, std::vector<double>(1, 0.00001));
00043 //    pnh.param("angularTols", angularTols, std::vector<double>(1, 0.00001));
00044 //    pnh.param("singularityLimit", momLimit, 1e-12);
00045 //    pnh.param("singularityGain", taskGain, 0.1);
00046 //    pnh.param("ikMaxItr", ikMaxItr, 10);
00047 //    pnh.param("ikMaxTwist", ikMaxTwist, 0.1);
00049     nh.param("/robot_urdf", urdf, std::string());
00050     R2RosTrajectoryManager trajManager(ros::this_node::getName(), urdf, 1.0/rate, pnh);
00051     trajManager.setCartesianParameters(priorityLevels, linearTols, angularTols, momLimit, taskGain, ikMaxItr, ikMaxTwist);
00052 
00053     double x, y, z;
00054     std::string idMode;
00055     std::string baseFrame;
00056     nh.param("/gazebo/gravity_x", x, 0.0);
00057     nh.param("/gazebo/gravity_y", y, 0.0);
00058     nh.param("/gazebo/gravity_z", z, 0.0);
00059     pnh.param("idMode", idMode, std::string("full"));
00060     pnh.param("baseFrame", baseFrame, std::string("/r2/robot_world"));
00061     R2RosTreeId treeId(urdf, pnh);
00062     treeId.setGravity(x, y, z, baseFrame, idMode);
00063 
00064     R2RosArbiter arbiter(pnh);
00065         
00066     ros::Rate r(rate);
00067     
00068     while(nh.ok())
00069     {
00071         trajManager.update();
00072         ros::spinOnce();
00073         r.sleep();
00074     }
00075     
00076     return 0;
00077 }


r2_controllers_ros
Author(s): Allison Thackston
autogenerated on Mon Oct 6 2014 02:46:50