Go to the documentation of this file.00001
00019 #include <urdf2graspit/Urdf2GraspItBase.h>
00020 #include <urdf2inventor/Helpers.h>
00021
00022 #include <urdf_viewer/InventorViewer.h>
00023
00024 #include <string>
00025 #include <ros/ros.h>
00026 #include <ros/package.h>
00027
00028 #include <map>
00029 #include <vector>
00030 #include <set>
00031
00032 using urdf2graspit::Urdf2GraspItBase;
00033
00034 void Urdf2GraspItBase::testVisualizeURDF(const std::string& fromLink)
00035 {
00036 ROS_INFO("Visualize hand - looks right so far? Close window to continue.");
00037 bool displayAxes = true;
00038 float axRad = 0.001;
00039 float axLen = 0.015;
00040 Urdf2Inventor::EigenTransform addVisualTrans = Urdf2Inventor::EigenTransform::Identity();
00041 SoNode * node = getAsInventor(fromLink, false, displayAxes,
00042 axRad, axLen, addVisualTrans, NULL);
00043 if (!node)
00044 {
00045 ROS_ERROR("Could not get inventor node");
00046 }
00047 else
00048 {
00049 urdf_viewer::InventorViewer view;
00050 view.init("Test - close me to continue");
00051 ROS_INFO_STREAM("Model converted, now loading into viewer...");
00052 view.loadModel(node);
00053 view.runViewer();
00054 }
00055 }
00056
00057 bool Urdf2GraspItBase::prepareModelForDenavitHartenberg(const std::string& fromLink)
00058 {
00059 ROS_INFO("### Preparing for DH conversion...");
00060
00061 ROS_INFO_STREAM("URDF before joining fixed links: ");
00062 printModel();
00063
00064 ROS_INFO("### Joining fixed links..");
00065 if (!joinFixedLinks(fromLink))
00066 {
00067 ROS_ERROR("Could not join fixed links");
00068 return false;
00069 }
00070
00071 ROS_INFO_STREAM("URDF after joining fixed links: ");
00072 printModel();
00073
00074 ROS_INFO("### Transforming rotation axes to z...");
00075 Eigen::Vector3d z(0, 0, 1);
00076 if (!allRotationsToAxis(fromLink, z))
00077 {
00078 ROS_ERROR("Could not transform rotation axes");
00079 return false;
00080 }
00081 dhReadyFrom=fromLink;
00082
00083
00084
00085 return true;
00086 }
00087
00088 bool Urdf2GraspItBase::isDHReady(const std::string& fromLink) const
00089 {
00090
00091
00092 return dhReadyFrom == fromLink;
00093 }