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 ***************************************************************************************************/ 00027 #include <ros/ros.h> 00028 #include <std_msgs/String.h> 00029 #include <tf/transform_broadcaster.h> 00030 00031 #include <sstream> 00037 #include <unistd.h> 00038 #include <iostream> 00039 #include <math.h> 00040 00041 #define PI 3.141592653589793238462643383279502884197 00042 00043 00044 using namespace ros; 00045 using namespace std; 00046 00047 int main(int argc, char** argv) 00048 { 00049 ros::init(argc, argv, "control_test"); 00050 00051 tf::TransformBroadcaster br_tf; 00052 tf::Transform tf_right_feet; 00053 tf::Transform tf_left_feet; 00054 ros::Rate loop_rate(1000); 00055 00056 tf_left_feet.setOrigin( tf::Vector3(0.0, 0.07, 0.0) ); 00057 tf_left_feet.setRotation( tf::createQuaternionFromRPY(0.0, 0.0, 0.0) ); 00058 tf_right_feet.setOrigin( tf::Vector3(0.0, -0.07, 0.0) ); 00059 tf_right_feet.setRotation( tf::createQuaternionFromRPY(0.0, 0.0, 0.0) ); 00060 00061 //double valz=0, valy=0, d=0; 00062 00063 while (ros::ok()) 00064 { 00065 //valz=0.2 + 0.2*cos(d); 00066 //valy=0.0 + 0.35*sin(d); 00067 //tf_left_feet.setOrigin( tf::Vector3(valy, 0.10, valz) ); 00068 //d+=0.001; 00069 00070 00071 br_tf.sendTransform(tf::StampedTransform(tf_left_feet, ros::Time::now(), "/world", "/tf_left_feet")); 00072 00073 br_tf.sendTransform(tf::StampedTransform(tf_right_feet, ros::Time::now(), "/world", "/tf_right_feet")); 00074 00075 ros::spinOnce(); 00076 loop_rate.sleep(); 00077 } 00078 00079 return 0; 00080 }