Difference between revisions of "Landing Gear"
(→Schematic/Design) |
|||
Line 2: | Line 2: | ||
==Schematic/Design== | ==Schematic/Design== | ||
− | The landing gear is a DC motor (##) controlled by two relays (from the relay module) and powered by a standard 9V battery. The two relay's input signals (in3 and in4) is connected to the pins 47 and 48, respectively. As seen on the schematic, the relay's normally open (NO) and normally closed (NC) terminals are either connected to directly to the motor or to the COM of one of the limit switches. The best way to understand the schematic is by understanding what occurs when the relays are on NC or NO. Fundamentally, when the relays are on NC, the motor rotates in one direction. If on NO, the motor turns in the opposite direction. The limit switches are connected in the NC configuration, meaning that the circuit between the relay and the motor is normally closed until the limit switch is triggered. Hence, when one of the arms hits the limit switch, it opens the circuit and causes the motor to stop. Note that triggering one of the limit switches does not prevent the motor turning in the other direction. | + | The landing gear is a DC motor (##) controlled by two relays (from the relay module) and powered by a standard 9V battery. The two relay's input signals (in3 and in4) is connected to the pins 47 and 48, respectively. As seen on the schematic, the relay's normally open (NO) and normally closed (NC) terminals are either connected to directly to the motor or to the COM of one of the limit switches. The best way to understand the schematic is by understanding what occurs when the relays are on NC or NO. Fundamentally, when the relays are on NC, the motor rotates in one direction. If on NO, the motor turns in the opposite direction. The limit switches are connected in the NC configuration, meaning that the circuit between the relay and the motor is normally closed until the limit switch is triggered. Hence, when one of the arms hits the limit switch, it opens the circuit and causes the motor to stop. Note that triggering one of the limit switches does not prevent the motor turning in the other direction. |
+ | ===Code=== | ||
+ | Channel 6, originally controlled the landing gear, was changed to switch between the navigation modes. Thus, the landing gear had to be routed to the next available channel, Channel 5. The code simply calls a function from the Landing Gear .cpp file and causes the DUE to provide 5V to the pins corresponding to the relay module. Note that Channel 5 is connected to the right throttle (specifically when one pushes it to the bottom left).* This can be an issue if one is braking the bike and deploying the landing gear at the same time. | ||
+ | |||
+ | Currently, the landing gear is controlled by the upper-left, two-way toggle switch, specifically channel 5 (please look at figure _). Under Landing_Gear.cpp of ROS_arduino_wrapper, two functions LandingGearUp() and LandingGearDown() controls the output (either HIGH or LOW) on the DUE's pins 47 and 48. The function for channel 5 (under RC.cpp) functions using interrupts. Interrupts work by assigning a pin to the interrupt and setting a trigger mode. The trigger mode is set to change so that interrupt triggers both when the pin goes from high to low and from low to high. The RC signal transmitted from the controller is a PWM signal so the interrupt will trigger multiple times per cycle of the signal. When the interrupt triggers the attached function is run. The functions used for RC signals calculate how long the pin was high in microseconds and assign that to a global variable called pulsetime. It is important that any variables used in the interrupt are defined as volatile variables so that the variables are loaded form RAM and not the storage register. The value of pulsetime corresponds to 31 specific positions of the RC switches and analog inputs. Additionally, when an interrupt is triggered the code for the main loop pauses, then code for the interrupt runs to completion, then the main loop continues. Since this can happen multiple times per loop the amount of time spent inside the interrupt should be minimized. Therefore we use the interrupts to calculate pulsetime only and later on in the loop use pulsetime to deploy landing gear or preform other tasks. Basically, once pulsetime reaches a certain value, then the function calls on LandingGearUp() or LandingGearDown() to deploy or retract the landing gear. | ||
===Electronics=== | ===Electronics=== | ||
The landing gear system is an assembly of different electrical components, specifically a relay module, limit switches, and a DC motor. | The landing gear system is an assembly of different electrical components, specifically a relay module, limit switches, and a DC motor. | ||
Line 8: | Line 12: | ||
====Limit Switch(es)==== | ====Limit Switch(es)==== | ||
====DC Motor==== | ====DC Motor==== | ||
+ | |||
==Past and Current Issues== | ==Past and Current Issues== | ||
===Arms Bending=== | ===Arms Bending=== | ||
===Interruption Bug=== | ===Interruption Bug=== | ||
===Power Supply=== | ===Power Supply=== |
Revision as of 05:35, 8 May 2019
The landing gear is a subsystem designed to assist testing or, more specifically, maintaining the bike upright when beginning and ending testing. The landing gear is controlled via a toggle switch (Channel 5) on the RC that deploys and retracts the wheels.
Contents
Schematic/Design
The landing gear is a DC motor (##) controlled by two relays (from the relay module) and powered by a standard 9V battery. The two relay's input signals (in3 and in4) is connected to the pins 47 and 48, respectively. As seen on the schematic, the relay's normally open (NO) and normally closed (NC) terminals are either connected to directly to the motor or to the COM of one of the limit switches. The best way to understand the schematic is by understanding what occurs when the relays are on NC or NO. Fundamentally, when the relays are on NC, the motor rotates in one direction. If on NO, the motor turns in the opposite direction. The limit switches are connected in the NC configuration, meaning that the circuit between the relay and the motor is normally closed until the limit switch is triggered. Hence, when one of the arms hits the limit switch, it opens the circuit and causes the motor to stop. Note that triggering one of the limit switches does not prevent the motor turning in the other direction.
Code
Channel 6, originally controlled the landing gear, was changed to switch between the navigation modes. Thus, the landing gear had to be routed to the next available channel, Channel 5. The code simply calls a function from the Landing Gear .cpp file and causes the DUE to provide 5V to the pins corresponding to the relay module. Note that Channel 5 is connected to the right throttle (specifically when one pushes it to the bottom left).* This can be an issue if one is braking the bike and deploying the landing gear at the same time.
Currently, the landing gear is controlled by the upper-left, two-way toggle switch, specifically channel 5 (please look at figure _). Under Landing_Gear.cpp of ROS_arduino_wrapper, two functions LandingGearUp() and LandingGearDown() controls the output (either HIGH or LOW) on the DUE's pins 47 and 48. The function for channel 5 (under RC.cpp) functions using interrupts. Interrupts work by assigning a pin to the interrupt and setting a trigger mode. The trigger mode is set to change so that interrupt triggers both when the pin goes from high to low and from low to high. The RC signal transmitted from the controller is a PWM signal so the interrupt will trigger multiple times per cycle of the signal. When the interrupt triggers the attached function is run. The functions used for RC signals calculate how long the pin was high in microseconds and assign that to a global variable called pulsetime. It is important that any variables used in the interrupt are defined as volatile variables so that the variables are loaded form RAM and not the storage register. The value of pulsetime corresponds to 31 specific positions of the RC switches and analog inputs. Additionally, when an interrupt is triggered the code for the main loop pauses, then code for the interrupt runs to completion, then the main loop continues. Since this can happen multiple times per loop the amount of time spent inside the interrupt should be minimized. Therefore we use the interrupts to calculate pulsetime only and later on in the loop use pulsetime to deploy landing gear or preform other tasks. Basically, once pulsetime reaches a certain value, then the function calls on LandingGearUp() or LandingGearDown() to deploy or retract the landing gear.
Electronics
The landing gear system is an assembly of different electrical components, specifically a relay module, limit switches, and a DC motor.