# obstacle avoidance

Source: https://forum.modalai.com/topic/3615/obstacle-avoidance
Category: General Questions (https://forum.modalai.com/category/2/general-questions)
Posted: 2024-07-07 18:20:42 UTC by rogerli
Replies: 8 · Views: 1769

## rogerli · 2024-07-07 18:20:42 UTC

I want to use VOXL2 for obstacle avoidance in offboard/mission mode. I read in the documentation that voxl-vision-hub and a rangefinder can achieve this goal. Do you have specific usage instructions? Additionally, can a ToF or stereo camera be used instead of a rangefinder?

## Reply by Moderator (ModalAI staff) · 2024-07-08 05:22:21 UTC

@rogerli there are methods in voxl-vision-hub for both stereo cameras and TOF

## Reply by rogerli · 2024-07-08 08:57:01 UTC (in reply to Moderator)

@Moderator 
If I want to buy a ToF sensor, I think its adapter cable is not long enough. Is there an extension cable available, or can I only use the adapter cable that comes with the purchase?

## Reply by Moderator (ModalAI staff) · 2024-07-09 05:21:35 UTC (in reply to rogerli)

@rogerli no, there is not an extension cable

## Reply by rogerli · 2024-07-10 02:07:34 UTC (in reply to Moderator)

@Moderator 
Okay, then I can only use a stereo camera. However, the stereo camera I'm currently using has an issue: the image from the right lens is blurrier than the one from the left lens, resulting in a poor depth map. 
In what situations can image blur occur?
left lens
![alt text](![c827489d-86f6-45b2-a30f-411a21cc84d2-避障左鏡頭(正常).jpg](https://forum.modalai.com/assets/uploads/files/1720577388795-c827489d-86f6-45b2-a30f-411a21cc84d2-避障左鏡頭-正常.jpg)
right lens
![alt text](i![419d08c2-b885-4de8-b703-189ccc0396c5-避障右鏡頭(模糊).jpg](https://forum.modalai.com/assets/uploads/files/1720577415464-419d08c2-b885-4de8-b703-189ccc0396c5-避障右鏡頭-模糊.jpg)

## Reply by modaltb (ModalAI staff) · 2024-07-11 15:32:15 UTC

@rogerli the lenses can actually be focused by carefully twisting the small plastic lens assembly surrounding the optical lens.  It's pretty easy to scratch so if possible use some plastic like tool and take extreme care to not scratch the lens.

## Reply by rogerli · 2024-07-15 01:56:02 UTC (in reply to modaltb)

@modaltb Thank you. I improved the defocusing issue by rotating the lens, but I still can't adjust it to achieve the same sharpness as the left lens.

## Reply by rogerli · 2024-07-15 03:53:29 UTC (in reply to modaltb)

@modaltb 
After using the lens for a while, it starts to defocus. During this period, the lens has been on the drone and hasn't been touched. What could be the possible reasons for the lens to defocus?

## Reply by James Strawson (ModalAI staff) · 2024-07-16 21:56:56 UTC (in reply to rogerli)

@rogerli vibration and lead to the lenses rotating. I often use a dab of hot-glue to hold the lens in place after focusing. On the new Starling 2 and Starling 2 Max drones we now use a clamping ring around the entire camera and lens assembly to lock them in place.
