Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #include <labust_mission/labustMission.hpp>
00010 #include <geometry_msgs/PoseStamped.h>
00011
00012 class QuadMeasSim{
00013
00014 public:
00015 QuadMeasSim():relDistX(0.0), relDistY(0.0), targetPosX(10.0), targetPosY(10.0), FOV(5.0){
00016
00017 ros::NodeHandle nh;
00018 subMeasIdeal = nh.subscribe<auv_msgs::NavSts>("meas_ideal",1,&QuadMeasSim::onStateHat, this);
00019 pubRelativeDistance = nh.advertise<geometry_msgs::PoseStamped>("target_pose",1);
00020
00021 }
00022
00023 void onStateHat(const auv_msgs::NavSts::ConstPtr& data){
00024 if(abs(data->position.north-targetPosX)<FOV && abs(data->position.east-targetPosY)<FOV){
00025
00026 geometry_msgs::PoseStamped relDist;
00027 relDist.pose.position.x = -(data->position.north-targetPosX);
00028 relDist.pose.position.y = -(data->position.east-targetPosY);
00029 pubRelativeDistance.publish(relDist);
00030 }
00031 }
00032
00033 double relDistX, relDistY;
00034 double targetPosX, targetPosY;
00035
00036 double FOV;
00037
00038 ros::Subscriber subMeasIdeal;
00039 ros::Publisher pubRelativeDistance;
00040
00041
00042
00043 };
00044
00045 int main(int argc, char **argv){
00046
00047 ros::init(argc,argv,"quad_meas");
00048 ros::NodeHandle nh, ph("~");
00049
00050 QuadMeasSim qms;
00051 ros::spin();
00052 return 0;
00053 }
00054
00055
00056
00057