How to start a mission with mavros without running QGC?

#1

Hello,
I noticed there is a “waypoint” interface in mavros. Does it support OFFBOARD mode? If it supports, how to start the mission without QGC?
What I want to do is use a Raspberry Pi to control the drone. Now I can takeoff and land. And I know the “setpoint_position” can achieve the goal, but I want to use the global coordinates.
Thanks for any reply.

#2

You can write a mission with global coordinates to the drone through the mavros service mavros/mission/push. This mission will be stored on SD card and then it can be read through the QGC. But I have the same problem. I do not know how to run this mission without the RC.

My Python code to write mission:

def waypoint_push_client(data):
    waypoint_clear_client()
    wl = WaypointList()
    wp = Waypoint()
    wp.frame = 3
    wp.command = 22  # takeoff
    wp.is_current = True
    wp.autocontinue = True
    wp.param1 = data[0]['altitude']  # takeoff altitude
    wp.param2 = 0
    wp.param3 = 0
    wp.param4 = 0
    wp.x_lat = data[0]['latitude']
    wp.y_long = data[0]['longitude']
    wp.z_alt = data[0]['altitude']
    wl.waypoints.append(wp)

    for point in data:
        wp = Waypoint()
        wp.frame = 3
        wp.command = 16  # simple point
        wp.is_current = False
        wp.autocontinue = True
        wp.param1 = 0  # takeoff altitude
        wp.param2 = 0
        wp.param3 = 0
        wp.param4 = 0

        wp.x_lat = point['latitude']
        wp.y_long = point['longitude']
        wp.z_alt = point['altitude']
        wl.waypoints.append(wp)
    try:
        service = rospy.ServiceProxy(
            'mavros/mission/push', WaypointPush)
        if service.call(wl.waypoints).success:
            print 'write mission success'
        else:
            print 'write mission error'
    except rospy.ServiceException, e:
        print "Service call failed: %s" % e

def waypoint_clear_client():
        try:
            response = rospy.ServiceProxy(
                'mavros/mission/clear', WaypointClear)
            return response.call().success
        except rospy.ServiceException, e:
            print "Service call failed: %s" % e
            return False

Does anyone know how to run a mission without RC?

#3

Thank you very much.
Dose the mission must be read through the QGC? I push some waypoints through the mavros service and then change the mode to AUTO.MISSION, the mission will start if I run the QGC (SITL). It’s no problem. But how to start the mission without QGC?
Maybe this will be helpful for you: http://forum.erlerobotics.com/t/solved-waypoint-for-ros-take-off-land-script/611/9

#4

I apparently had the wrong settings for PX4 in the SITL. Recompilation of the project SITL helped me. In the SITL, the mission now starts normally. On a real drone mission is also launched and even without the RC.

The mission itself is read and displayed in the QGC

#5

Hello,
I think the “wp.param1” should be minimum pitch.
http://mavlink.org/messages/common