00001 /************************************************************************************************** 00002 Software License Agreement (BSD License) 00003 00004 Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt 00005 All rights reserved. 00006 00007 Redistribution and use in source and binary forms, with or without modification, are permitted 00008 provided that the following conditions are met: 00009 00010 *Redistributions of source code must retain the above copyright notice, this list of 00011 conditions and the following disclaimer. 00012 *Redistributions in binary form must reproduce the above copyright notice, this list of 00013 conditions and the following disclaimer in the documentation and/or other materials provided 00014 with the distribution. 00015 *Neither the name of the University of Aveiro nor the names of its contributors may be used to 00016 endorse or promote products derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00019 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00021 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00022 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00024 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00025 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 ***************************************************************************************************/ 00033 #include <ros/ros.h> 00034 #include <tf/transform_broadcaster.h> 00035 #include <std_msgs/Float64.h> 00036 #include <math.h> 00037 00043 int main(int argc, char** argv){ 00044 ros::init(argc, argv, "pub_transformations"); 00045 ros::NodeHandle n; 00046 tf::TransformBroadcaster broadcaster; 00047 ros::Rate r(10); 00048 00049 float alpha=(38.5)*(3.1415/180);// 38.5 is obtained by multiplying the tillt angle by -1 00050 00051 00052 //Had to put then following alternative for FUERTE/GROOVY. V. Santos, 27-Mai-2013 00053 #if ROS_VERSION_MINIMUM(1, 8, 0) //At least FUERTE 00054 tf::Transform transform(tf::Matrix3x3(0,-1,0, cos(alpha),0,sin(alpha), -sin(alpha),0,cos(alpha)), tf::Vector3(0.236, -0.05, 0.68)); 00055 #else //earlier releases 00056 tf::Transform transform(btMatrix3x3(0,-1,0, cos(alpha),0,sin(alpha), -sin(alpha),0,cos(alpha)), btVector3(0.236, -0.05, 0.68)); 00057 #endif 00058 00059 ros::spinOnce(); 00060 while(n.ok()) 00061 { 00062 broadcaster.sendTransform(tf::StampedTransform(transform, ros::Time::now(),"/vehicle_odometry", "/openni_camera")); 00063 00064 r.sleep(); 00065 ros::spinOnce(); 00066 } 00067 }