mavros simultaneous position and velocity control

asked 2017-01-05 15:12:26 -0500

Sam94 gravatar image

updated 2017-01-05 15:17:09 -0500

I am attempting to set waypoints in a SITL/Gazebo simulation using the PX4 firmware (simulation method explained here). In addition to controlling the position of the quadrotor, I also need to be able to control its velocity. To accomplish this, I am attempting to use mavros, and am publishing to the "/mavros/setpoint_raw/local" topic. However, this does not work to set the position and velocity simultaneously. When using the type_mask "0b0000101111000000" it only sets the position, not the velocity. But, changing the type mask to "0b0000101111000111" works as expected, allowing the velocity to be set. So, it seems that the position setpoint is overriding the velocity setpoint, resulting in a default value for velocity when both values are set.

I have looked at several related github issues (402, 471, 557), but was unable to determine whether or not an official resolution had been achieved. I am currently using ROS Indigo and Gazebo 7, and the PX4 firmware was downloaded from github earlier this week. I tried the mavros version currently on github, and the sudo apt-get install version. Thanks for your help.

takeoff_Waypoint = PositionTarget()

takeoff_Waypoint.header.stamp = rospy.get_rostime()
takeoff_Waypoint.header.frame_id = "1"

takeoff_Waypoint.coordinate_frame = 1
takeoff_Waypoint.type_mask = 0b0000101111000000

takeoff_Waypoint.position.x = x_Pos
takeoff_Waypoint.position.y = y_Pos
takeoff_Waypoint.position.z = travel_Height

takeoff_Waypoint.velocity.x = x_Vel
takeoff_Waypoint.velocity.y = y_Vel
takeoff_Waypoint.velocity.z = z_Vel

takeoff_Waypoint.yaw = yaw_Angle

edit retag flag offensive close merge delete

Comments

Have you figured out how to give both position and velocity command at the same time?

magiccjae gravatar image magiccjae  ( 2017-06-01 17:07:59 -0500 )edit

No, I just ended up using position control with the default velocities.

Sam94 gravatar image Sam94  ( 2017-06-01 18:22:40 -0500 )edit

Add 794 to the list. Seems like this is not easily achievable, but I'd like to be wrong.

seanarm gravatar image seanarm  ( 2017-09-14 11:05:03 -0500 )edit