MegaPirateNG / ardupilot-mpng

MegaPirateNG
GNU General Public License v3.0
117 stars 105 forks source link

RC_CHANNEL_OVERRIDE not working in mavproxy using MegapirateNG R3 #122

Open Alexander9005 opened 10 years ago

Alexander9005 commented 10 years ago

I'm still new in using mavlink with Mavproxy as GCS to control my quadcopter. For your information, i'm using Crius Megapirate NG R3 here as the firmware instead of APM. I plan to use RC_CHANNEL_OVERRIDE to override the RC channel using this command ( RC all 2000) in Mavproxy but somehow my quadcopter seems to have no response at all. Can you pls help on this? I need it urgently for my final year project. Thanks in advance. :)

Alexander9005 commented 10 years ago

Sir Alex, can you pls help me on this? i'm afraid that i missed out something real important which cause such problem. Thanks

SirAlex commented 10 years ago

Hi! Can you share your code where you try to use overrides? I'm never tried mavlink so currently can't help you.

Alexander9005 commented 10 years ago

Thank you SirAlex for your response. This is the part where I tried to use the override command but failed. ........ override = mpstate.status.override[:] ........

RC Override for landing

                if (biggestblob.x>xmin) and (biggestblob.x<xmax):
                    if (biggestblob.y>ymin) and (biggestblob.y<ymax):
                        print("Blob is centered, attempting to LAND")
                        #Override RC Channel to Landing Mode 
                        override[4] = 1000
                        print("Got here to override")
                        mpstate.status.override = override
                        mpstate.override_period.force()
                        print("Override successful")

This code is supposed to override the RC channel when red target is detected at the center. But somehow, my quadcopter shows no response at all. I even tested the pwm output of the pin on the Crius AIOP board but shos no difference. The overall code is sent via this mail rsoft@tut.by

Alexander9005 commented 10 years ago

SirAlex, for more references.....This is the main command in mavproxy.py for "rc override" command.

def cmd_rc(args): '''handle RC value override''' if len(args) != 2: print("Usage: rc <channel|all> ") return value = int(args[1]) if value == -1: value = 65535 if args[0] == 'all': for i in range(8): mpstate.status.override[i] = value else: channel = int(args[0]) mpstate.status.override[channel-1] = value if channel < 1 or channel > 8: print("Channel must be between 1 and 8 or 'all'") return mpstate.status.override_counter = 10 send_rc_override() print("RC Override sucessful")

garethdsouza18 commented 10 years ago

Alexander9005, were you able to fix this issue? i am facing a simillar problem with the RC_channel override