I am trying to fly a quadcopter to different waypoints using a PX4 SITL in Gazebo simulation.
My issue is that I don’t know how to orientate the drone when it flies. It always is oriented on the positive x-axis. An example video can be seen here: flight video
A simplified version of my code is shown below:
ros::Publisher local_pos_pub = nh.advertise<geometry_msgs::PoseStamped> ("mavros/setpoint_position/local", 10); Vector3f vect (0.0f, 0.0f, 2.0f); geometry_msgs::PoseStamped msg; msg.pose.position.x = vect(0); msg.pose.position.y = vect(1); msg.pose.position.z = vect(2); local_pos_pub.publish(msg); ros::spinOnce(); rate.sleep();
Should I also fill the quaternion (present in the Pose message: doc) of the message? Or is there a better way to do that?
Thank you for any help!