No products in the cart.
How to configure a flight mode to apply automatic inputs during flight?
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
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……
SOURCE: Everyone’s Blog Posts – DIY Drones – Read entire story here.