Hello,

I am trying to create a custom ground station that could take off the Quadcopter when a camera detects a predefined target. Basically, there are a camera, a computer and a Quadcopter. The computer sends MAVLink commands to the APM3.1 and no remote control shall be used.

I am running a C++ program that arms the Quadcopter with MAVLink but I can't manage to make it fly.

I first tried to override remote control with RC_CHANNELS_OVERRIDE MAVLink command but the Quadcopter does not answered to my request. I then tried with MAVLink missions. I succeed in sending mission to the Quadcopter (I can see them with Mission Planner) but when I switch to AUTO mode, nothing happened.

I'm probably missing something but I've been looking around for a while and I didn't manage to find anything. If you've done that kind of things and if you've got some time to spend for a newbie, any help would be warmly welcomed.

Thanks.

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

        • Hi,

          I've been trying to arm my quadcopter for some days now with no luck.

          I'm using the arduino library, and so far I get ACK ACCEPT from APM but still it doesn't make the rotors spin.

          Should I use some special mode CUSTOM_MODE or can it be STABILIZE?

          Could someone please specify the commands used? Ie component id, system id, etc.

          So far I'm using:

          mavlink_msg_command_long_pack(sysid, compid, &msg, received_sysid, MAV_COMP_ID_SYSTEM_CONTROL, MAV_CMD_COMPONENT_ARM_DISARM,1,0,0,0,0,0,0,0); 

          and then

          mavlink_msg_rc_channels_override_pack(sysid, compid, &msg1, received_sysid, 1500,0,0,0,0,0,0,0,0);

          Although I receive the proper response with #36 (servo output raw) I can-t get it to work.

        • Howdy Valentin.

          Loving your work with Next Level, and I'm excited to see that play out.

          Any chance you can post the code you are referencing above?

          Your sequence: heartbeat, arm, (pause), override seems like just what I need. Like you when you started out, I am trying to use a dedicated C++ program and packing MavLink messages manually. Are you willing to share a basic version of your code? Lots of us would be interested!

          Thanks!

    • Hi Valentin,

               I have the same issue, when I send the cmd to arm/disarm the system how would I know the system is armed . I checked the command ack and the result in COMMAND_ACK(#77) indicates my command is accepted, but my motors wont spin.

      Could you please let me know if you got you motors to spin.

      • what command are you sending to arm the quad? Whats the exact line? Also, arming the quad will not make the rotors spin. You have to send RC Override command

        • Hey,

              I am finally able to arm the quad as well as spin the motors ..:) :)

          To arm the quad send the COMMAND_LONG message MAV_CMD_COMPONENT_ARM_DISARM with component id MAV_COMP_ID_SYSTEM_CONTROL = 250 and param=1 for arm or param=0 for disarm.

          Then the sstem will be armed.

          -Pushyami

          • Hi Pushyami,

            we are currently attempting the same ting for a different component in the system (switching between gyro and thermopile sensors on teh APM 2.5) and we will try your solution and let you know how it goes.

            • Hi robert, were you able to arm and send it commands?

                  int fd = serial_fd;
                  char buf[300];

                  mavlink_command_long_t arm_command_msg;
                  mavlink_message_t arm_msg;

                  arm_command_msg.command = 40;
                  arm_command_msg.target_system = 1;
                  arm_command_msg.target_component = 250;
                  arm_command_msg.confirmation = 0;
                  arm_command_msg.param1 = 1;
                  arm_command_msg.param2 = 0;
                  arm_command_msg.param3 = 0;
                  arm_command_msg.param4 = 0;
                  arm_command_msg.param5 = 0;
                  arm_command_msg.param6 = 0;
                  arm_command_msg.param7 = 0;

                  mavlink_msg_command_long_encode(1, 250, &arm_msg, &arm_command_msg);
                  unsigned len = mavlink_msg_to_send_buffer((uint8_t*)buf, &arm_msg);
                  write(fd, buf, len);

              That is the code that i have now. It sends some sort of command to the apm (It beeps everytime i call the code). However it doesnt seem to arm the apm. I am not sure what is going wrong. Any help is highly appreciated

              • Hi Suresh,

                I am newly programming in MAVLINK. I am planning to follow your above code to arm the quad. Does this code work? Do you mind to share which head file you had included in the code?

                • For some reason I can't reply to your new comments. You need to include the mavlink library files. They can be downloaded from the authors site. We did use the PID control for vertical control. Ran out time for lateral control. The project is done tho. And yes I think it should be 400. Target system doesn't really affect it but target component needs to be right

This reply was deleted.

Activity