gdtdoubletbig.jpg

I'm trying to apply automatic inputs at the elevator and aileron during the flight, for which I have configured the CRUISE mode. These inputs are of a specific pattern i.e., doublet(combination of an up pulse and down pulse). 

I have made changes in the code (Arduplane.ino file) as follow

switch (effective_mode)
{
case AUTO:
handle_auto_mode();
break;

case RTL:
case LOITER:

case CRUISE:


if ((channel_roll->control_in != 0 ||
channel_rudder->control_in != 0)) {
cruise_state.locked_heading = false;
cruise_state.lock_timer_ms = 0;
}

if (!cruise_state.locked_heading) {
nav_roll_cd = channel_roll->norm_input() * roll_limit_cd;
nav_roll_cd = constrain_int32(nav_roll_cd, -roll_limit_cd, roll_limit_cd);
update_load_factor();
} else {
calc_nav_roll();
}

update_fbwb_speed_height();

hal.gpio->pinMode(CH_2,HAL_GPIO_INPUT);
hal.gpio->write(CH_2,HIGH);
 hal.scheduler->delay(5000);
hal.gpio->write(CH_2,LOW);
 hal.scheduler->delay(5000);
hal.gpio->write(CH_2,HIGH);

servo_write(1,1800);
 delay(2000);
servo_write(1,1200);
 hal.scheduler->delay(500);
servo_write(1,1500);

break;

                 I was able to successfully compile and upload the code. However once I tried to check the effect of these command lines during ground testing I was unable to observe any of the input pattern once I switched to the CRUISE mode. Desired was the application of a doublet input at the elevator and aileron.

  Would someone please tell me that what could be the possible problem and its solution. Isn't it that this change is to be done in some other portion of the code because it is done in Arduplane.ino file.

 Thanx  alot......

E-mail me when people leave their comments –

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

Join diydrones

Comments

  • Second Problem:
    I selected the python script while ground testing and found that Input was there at RC-channel 2(visible in Graph log in telemetry logs) but not on the servo motor of elevator and servo was not moving accordingly. What could be the possible problem that this input is not being transferred to the servo I want to move.....
  • Thank you so much Chris... You helped me to solve a big issue I was facing from the last few weeks..


    Please tell me that once i am on the actual flight and I select script then the python file I have programmed will work for the input purpose as I described at the top (doublet)..... Would it be enough or I need to make further changes....



    import sys
    sys.path.append(r"c:\Python34\Lib\site-packages")
    sys.path.append(r"c:\Python34\Lib")
    #import serial, os, threading


    print 'Start Script'
    for chan in range(1,9):
    Script.SendRC(chan,1500,False)
    Script.SendRC(3,Script.GetParam('RC3_MIN'),True)


    ######LOOP#########
    Script.SendRC(8,1700,True) # Manual mode
    Script.ChangeMode('CRUISE')
    Script.SendRC(2,1500,True) # Slight down for airspeed
    Script.Sleep(500)
    Script.SendRC(2,1800,True) # Pull back on elevator for Loop
    Script.Sleep(500)
    Script.SendRC(2,1200,True) # level pitch
    Script.Sleep(500)
    Script.SendRC(2,1500,True)
    #Script.Sleep(2000) # 2 sec to stabalise

    Also tell me whether I nnned make changes in Arduplane code alongside or it is enough. And is it necessary to place this python file in APM liberaries or anywhere....

    Thanks lot again....
  • So on the Mission planner interface there is the different panes you can select in the bottom left of the main HUD screen. and one of them is 'script' and then upload and run. I think this link should be a good starting point.

    http://plane.ardupilot.com/wiki/common-other-mission-planner-featur...

  • THANX for help Chris.... What is script upload feature...sorry i could not understand that...
  • Hi, whenever I did this sort of thing we used a two person set up with one flying and the other operating the ground station and used the script upload feature to achieve this. Worked great.

This reply was deleted.