Go to the documentation of this file.00001
00002 '''
00003 Created on Feb 04, 2013
00004
00005 @author: dnad
00006 '''
00007 import roslib; roslib.load_manifest("cart_sim");
00008 import rospy;
00009 from geometry_msgs.msg import Quaternion;
00010 from nav_msgs.msg import Odometry
00011
00012 class Wave:
00013 def __init__(self):
00014 rospy.Subscriber("/diver/ocean_info", Quaternion, self.onWave);
00015 self.pub = rospy.Publisher("/diver/uwsim_hook",Odometry);
00016
00017 def onWave(self,data):
00018 odom = Odometry();
00019 odom.pose.pose.position.x = 0;
00020 odom.pose.pose.position.y = 0;
00021 odom.pose.pose.position.z = -data.w;
00022 odom.pose.pose.orientation.w = 1;
00023 odom.header.stamp = rospy.Time.now();
00024
00025
00026 self.pub.publish(odom);
00027
00028 def step(self):
00029 self;
00030
00031 if __name__ == "__main__":
00032 rospy.init_node("wavetest");
00033 test = Wave();
00034 rate = rospy.Rate(1);
00035
00036 while not rospy.is_shutdown():
00037 test.step();
00038 rate.sleep();
00039
00040
00041
00042
00043