setRef.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
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 auv_msgs.msg import NavSts;
00010 import numpy
00011 import math
00012 import sys
00013 
00014 def wrapAngle(angle):
00015     if angle>math.pi:
00016         return angle - 2* math.pi;
00017     elif angle<-math.pi:
00018         return 2*math.pi + angle;
00019     else:
00020         return angle;
00021         
00022 if __name__ == "__main__":
00023     rospy.  init_node("refgen");
00024     out = rospy.Publisher("etaRef", NavSts);
00025         
00026     rate = rospy.Rate(1);
00027         
00028     ref = NavSts();
00029     while not rospy.is_shutdown():
00030         refs = [float(x) for x  in str(sys.stdin.readline()).split()];
00031         ref.position.north = refs[0];
00032         ref.position.east = refs[1];
00033         ref.position.depth = refs[2];
00034         ref.orientation.yaw = wrapAngle(refs[3]);
00035             
00036         out.publish(ref);
00037         rate.sleep();
00038         
00039         
00040         


ldtravocean
Author(s):
autogenerated on Fri Feb 7 2014 11:37:01