2 #include <geometry_msgs/TransformStamped.h> 3 #include <geometry_msgs/PoseStamped.h> 4 #include <mavros_msgs/OverrideRCIn.h> 5 #include <gazebo_msgs/ModelStates.h> 6 #include <geometry_msgs/Pose.h> 7 #include <tf/transform_broadcaster.h> 8 #include <nav_msgs/Odometry.h> 13 void model_cb(
const gazebo_msgs::ModelStates::ConstPtr& msg)
15 gazebo_msgs::ModelStates current_states = *msg;
19 for (
int i=0; i< current_states.name.size(); i++)
21 if(current_states.name[i] ==
"iris")
28 if (irisArrPos == 999)
30 std::cout <<
"iris is not in world" << std::endl;
41 void pose_cb(
const nav_msgs::Odometry::ConstPtr& msg)
48 int main(
int argc,
char **argv) {
50 ros::init(argc, argv,
"position_sender");
52 ros::Publisher pub = n.advertise<geometry_msgs::TransformStamped>(
"/mavros/fake_gps/mocap/tf", 10);
53 ros::Publisher pubStamped = n.advertise<geometry_msgs::PoseStamped>(
"/mavros/vision_pose/pose", 10);
54 ros::Subscriber currentHeading = n.subscribe<gazebo_msgs::ModelStates>(
"/gazebo/model_states", 10,
model_cb);
55 ros::Subscriber
currentPos = n.subscribe<nav_msgs::Odometry>(
"mavros/global_position/local", 10,
pose_cb);
58 tf::TransformBroadcaster brVision;
59 tf::TransformBroadcaster brEKF;
60 tf::Transform Tmap2droneVison;
61 tf::Transform Tmap2droneEKF;
72 brVision.sendTransform(tf::StampedTransform(Tmap2droneVison, ros::Time::now(),
"map",
"droneVsion"));
79 brEKF.sendTransform(tf::StampedTransform(Tmap2droneEKF, ros::Time::now(),
"map",
"droneEKF"));
nav_msgs::Odometry current_poseEKF
void model_cb(const gazebo_msgs::ModelStates::ConstPtr &msg)
void pose_cb(const nav_msgs::Odometry::ConstPtr &msg)
ros::Subscriber currentPos
int main(int argc, char **argv)
geometry_msgs::PoseStamped currentDroneState