could you please help me in obstacle avoidance in guided mode
i am using raspberrypi3,pix4,s500 body,tf mini, and drone is a quad copter
i had an rc transmitter flysky with 6 channels
so what i tried till now is
my raspberrypi3 code
msg = vehicle.message_factory.distance_sensor_encode(
milliseconds, # time since system boot
5, # min distance cm
10000, # max distance cm
int(d), # current distance, must be int
0, # type = laser?
0, # onboard id, not used
mavutil.mavlink.MAV_SENSOR_ROTATION_YAW_45, #direction
0 # covariance, not used
)
print(msg)
vehicle.send_mavlink(msg) #Simple function to measure the distance using ultrasonic sensor
Hi @suryaprakash_lokula . You need to follow our documentation. You do not need a Rpi if you are working with a TF-Mini. Simply connect it to the Flight controller directly, configure the parameters correctly, and switch to Loiter mode (after configuring Simple Avoidance AVOID_*) or Auto Mode (After configuring OA_TYPE parameter). It should work fine for you. I would also suggest moving to the latest Copter 4.1 Firmware. If something isn’t clear from the documentation, let me know. Thanks
i would like to make an obstacle avoidance using raspberrypi and four tfmini modules and send mavlink message as below to pixhawk
`
def send_body_ned_velocity(velocity_x, velocity_y, velocity_z, duration=0):
msg = vehicle.message_factory.set_position_target_local_ned_encode(
0, # time_boot_ms (not used)
0, 0, # target system, target component
mavutil.mavlink.MAV_FRAME_BODY_NED, # frame Needs to be MAV_FRAME_BODY_NED for forward/back left/right control.
0b0000111111000111, # type_mask
0, 0, 0, # x, y, z positions (not used)
velocity_x, velocity_y, velocity_z, # m/s
0, 0, 0, # x, y, z acceleration
0, 0)
for x in range(0,duration):
vehicle.send_mavlink(msg)
time.sleep(1)
velocity_x = 0
velocity_y = -1
velocity_z = 0
duration = 2
send_body_ned_velocity(velocity_x, velocity_y, velocity_z, duration)
`and i would like to know after vehicle.goto() command, while vehicle is moving towards the destination location can this command work if i code for obstacle avoidance using tfmini
i would like to develope my own obstacle avoidance with this using raspberrypi
What is your flight controller ?
What is your connection point between RPi 4 and Flight controller
Is the TF mini lidar connected by i2c into the RasPi 4