Hello all,
I am trying to MAVROS to fly a simulated quad in GAZEBO (using the base px4 code).
- Most recent ROS_Indigo version and most recent MAVROS version.
- Very recent PX4 code
- Gazebo 7
- Ubuntu 14.04
There are 2 specific issues i am facing (after OFFBOARD is in control):
-
The mavros directions are different to the Gazebo and QGroundControl direction (eg, mavros ‘x’ is along the gazebo ‘y’ axis, rotated -90o). Not sure how to fix this, any advice will help.
-
I can control the position of the quad in Gazebo via MAVROS using:
ros::NodeHandle np;
ros::Publisher local_pos_pub = np.advertise<geometry_msgs::PoseStamped>
(“mavros/setpoint_position/local”, 10);
geometry_msgs::PoseStamped posep;
posep.pose.position.x = 0;
posep.pose.position.y = 0;
posep.pose.position.z = 3;
local_pos_pub.publish(posep);
ros::spinOnce();
ratep.sleep();
However, I cannot control orientation via both methods of:
ros::NodeHandle np;
ros::Publisher local_pos_pub = np.advertise<geometry_msgs::PoseStamped>
(“mavros/setpoint_position/local”, 10);
geometry_msgs::PoseStamped posep;
posep.pose.orientation.z = 0.7071;
local_pos_pub.publish(posep);
ros::spinOnce();
ratep.sleep();
(The rotation via this is binary: when .z set >0.78, it goes to -0.999999 (in quaternion). Otherwise when <0.78, goes to 0)
and
ros::NodeHandle np;
ros::Publisher local_pos_pub = np.advertise<geometry_msgs::PoseStamped>
(“mavros/setpoint_attitude/attitude”, 10);
geometry_msgs::PoseStamped posep;
posep.pose.orientation.z = 0.7071;
local_pos_pub.publish(posep);
ros::spinOnce();
ratep.sleep();
(results in the simulated quad going into freefall).
If it helps, using
/mavros/setpoint_velocity/cmd_vel
works to control velocity, but
/mavros/setpoint_attitude/cmd_vel
goes into freefall.
Any advice for both of these issues?
Thanks,