Send velocity commands over Mavros

asked 2018-04-17 11:38:52 -0500

Fredrika gravatar image

updated 2018-04-17 20:03:16 -0500

tfoote gravatar image

I am using the Ardupilot SITL simulator to simulate my fixed wing aircraft. I want to control the velocity by sending velocity commands over Mavros:

ros::Publisher cmd_vel_pub = nh.advertise<geometry_msgs::TwistStamped>("mavros/setpoint_velocity/cmd_vel", 10); 

geometry_msgs::TwistStamped cmd_vel;

while (ros::ok()) {
    cmd_vel.header.stamp = ros::Time();
    cmd_vel.twist.linear.x = 10;
    cmd_vel.twist.angular.z = 10;
    cmd_vel_pub.publish(cmd_vel);
}

I have tried this in several flight modes, and I have tried to publish both before and after takeoff, but nothing happens. What is the correct way to send command velocities for a plane over Mavros?

edit retag flag offensive close merge delete