Open nathanchan631 opened 1 year ago
CURRENTLY WORKING ON A PROTOTYPE
Could we possibly make our own gimbal? We can use open source, two servo gimbals. Advvantages
The gimbal can be configured as an I2C device using a Pi Pico W, as a serial device, or can be spoken to directly from the onboard computer. We can tie it in directly with the onboard vision and flight server to keep detected targets centered in the frame and the camera pointing downwards even when accelerating or moving horizontally.
Some basic test code to control servos in Python (Pi Pico)
import time
from servo import Servo
# Create our Servo object, assigning the
# GPIO pin connected the PWM wire of the servo
my_servo = Servo(pin_id=16)
delay_ms = 25 # Amount of milliseconds to wait between servo movements
while True:
for position in range(0, 180): # Step the position forward from 0deg to 180deg
print(position) # Show the current position in the Shell/Plotter
my_servo.write(position) # Set the Servo to the current position
time.sleep_ms(delay_ms) # Wait for the servo to make the movement
for position in reversed(range(0, 180)): # Step the position reverse from 180deg to 0deg
print(position) # Show the current position in the Shell/Plotter
my_servo.write(position) # Set the Servo to the current position
time.sleep_ms(delay_ms) # Wait for the servo to make the movement
The above code shows a servo sweeping in Python in the forward and backward direction, a simple control loop can be implemented to take in drone telemetry data such as orientation and self correct to align the camera properly.
The overall inputs and outputs would be
Inputs
Outputs
References
What camera gimbal should we buy? How can we communicate with it? Inputs? Outputs?
The completion of this task requires the creation of test code to show that the gimbal is programmable.