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.
Replies
Hi Valentin, can give some advices on this rc overriding issue? I'm facing the same problem here..... when using RC_CHANNELS_OVERRIDE command in Mavproxy, the quadcopter seems to have no response at all.....i'm using the command " RC all 1000" just to override all the channels in case of emergency thru mavproxy....but somehow it seems to have no effect at all. Appreciate your help thanks. Need it urgently for my final year project T.T
Hello Alexander,
Actually, I am not using MAVProxy to override RC Channels. I am using a dedicated cpp program.
Sorry but I can't help you :-(
Hi Valentin,
I'm also trying to override rc channels from in a C++ program. I tried with mavproxy and that works, so the firmware in my hexacopter (pixhawk) is receiving the commands, also with Mission Planner I see the values of the RC move...
Now i am trying from in my C++ program. The arming works fine, as i can see also in mission planner, but the RC_CHANNELS_OVERRIDE wont work.
This is the code that runs in a loop every 20ms:
mavlink_rc_channels_override_t rc_override;///Msg to override rc channels
mavlink_message_t msg_rc;
rc_override.chan1_raw=1100;
rc_override.chan2_raw=1100;
rc_override.chan3_raw=1100;//Lowest throttle
rc_override.chan4_raw=1100;
rc_override.chan5_raw=1100;
rc_override.chan6_raw=1100;
rc_override.chan7_raw=1100;
rc_override.chan8_raw=1300;
rc_override.target_system = 1; // Send command to MAV 001
rc_override.target_component = PX_COMP_ID_ALL;
mavlink_msg_rc_channels_override_encode(systemID, 0, &msg_rc, &rc_override);
sendMAVLinkMessage(lcm, &msg_rc);
systemID = 255.
Did you put your controller in a special mode ? or do you also have to send a heartbeat message every ... seconds ?
IS it possible to send me a example where you send your RC override commands ?
Kind regards,
Dries
Hello Dries,
I think I can help you with your problem. I managed to run a program in C similar to yours and I found a lot of problems to do it due to the lack of information about MAVLink.
In my investigation I concluded that you need two things to make it works. First of all, you need the correct system ID which is saved onto the APM or PIXHAWK. So, with Mission Planner software you can check this to be sure you are using the correct ID. Here you have a picture example:
The second thing you have to do is to send a HearBeat message every second or two seconds, if possible. This may inform UAV that you are still there and have not lost the communication. This last step is very important because the Ardupilot have a dedicated Failsafe that checks the communication between the UAV and the GCS if the RC_OVERRIDE command is working.
I hope this information can help you.
Kind regards,
Alexander.
i see :( ......Being posting this in many forums but didn't get positive feedback on this issue. I wonder which part goes wrong coz everyone seems to have no problem with the one im having now....actually it's just to override the rc channel but dunno why my quadcopter doesn't respond to it. Thanks for your reply anyway, really appreciate it :)
Hello,
I finally managed to use the RC_CHANNELS_OVERRIDE MAVLink command. (I'm ashamed to say that I used a wrong GCS System Id...)
By the way, I am still interessted in knowing why I can't make the motors spin with missions.
Hello dear Valentin Brossard
I am also working on commanding APM through matlab.
I am actually new on it and i need some one to help me.
as you have done projects like it, I want to ask you for help if it is possible for you.
this is my email adress mfzavareh@hotmail.com
any help on this subject would be appreciated
thank you so much
Hello Valentin,
I am sorry for resurrecting your post but I am afraid I need your help. I am trying to control a quadcopter through a C program using mavlink. I am able to arm the quad using command_long, but it does not responds to any other commands (like for instance rc_override or set_mav_mode).
Besides using the arm command, did you do anything different before flying? I mean, what did you use as GCS system id in your program? Did you use CHANGE_OPERATOR_CONTROL function? I just can't see what I am doing wrong.
Thank you in advance for your help!
Hello dear Lucase Behnck
I also want to control the quadrotor with Matlab
I use a mexFunction for that
I want to know the code you have used to arm the APM because I can not arm it. i can have the attitude in Matlab but I can not arm it.
your help will be appreciated.
my email is mfzavareh@hotmail.com
thank you so much
setupSerial.m
MavSerial1.mexw64
Hello Lucas,
Here is the sequence I use do override remote control :
-> Heartbeat - To introduce myself as a ground station ;
-> Arm Command
-> Wait a few seconds
-> Override RC Commands
As a Ground station, I use the sys_id 253.
I hope it will help !