# TOF Obstacle Avoidance

Source: https://forum.modalai.com/topic/295/tof-obstacle-avoidance
Category: General Questions (https://forum.modalai.com/category/2/general-questions)
Posted: 2021-06-24 12:49:38 UTC by danielh
Replies: 8 · Views: 1832

## danielh · 2021-06-24 12:49:38 UTC

Hi,

I would like to get the TOF Sensor working with PX4 Collision Prevention. I found some reference for the stereo camera here: https://docs.modalai.com/voxl-vision-px4-collision-prevention/
However couldn't find anything for the TOF Sensor. Is this supported? If not can you give me a starting point? Maybe some of the code for the stereo cameras could be reused etc. Just getting started with the VOXL, so I'm trying to navigate alle the docs and code examples.

## Reply by Chad Sweet (ModalAI staff) · 2021-06-24 14:08:17 UTC

TOF is now built into the latest voxl-camera-server, you can see the code here: https://gitlab.com/voxl-public/modal-pipe-architecture/voxl-camera-server/-/blob/master/src/api_interface/hal3/hal3_camera_mgr_tof.cpp

We have not connected TOF to VOA explicitly, but what would need to be done is to connect the TOF point cloud to VOA's point cloud entry point using MPA here: https://gitlab.com/voxl-public/modal-pipe-architecture/voxl-vision-px4/-/blob/master/src/voa_manager.c#L103

Let us know how it goes!

## Reply by danielh · 2021-06-24 16:19:02 UTC

Thank you, I will look into this!
Meanwhile is there an easy way to stream the tof data over voxl-streamer for debug purposes?

## Reply by Eric Katzfey (ModalAI staff) · 2021-06-24 16:35:52 UTC (in reply to danielh)

@danielh voxl-streamer does not currently support streaming of TOF data.

## Reply by danielh · 2021-06-24 17:39:53 UTC

ok thanks!

## Reply by Chad Sweet (ModalAI staff) · 2021-06-24 17:45:20 UTC

voxl_mpa_to_ros might help sending data to rviz

## Reply by Alex Kushleyev (ModalAI staff) · 2021-06-24 18:17:43 UTC

Not sure if it will help, but here is some old code that was used to publish TOF point clouds and IR image to ROS : https://gitlab.com/voxl-public/old-projects/voxl-hal3-tof-cam-ros/-/blob/master/source/src/hello_hal3_camera_mgr.cpp . Perhaps some of this code can be re-used if needed..

## Reply by ptaylor1234 · 2021-06-28 13:33:57 UTC (in reply to Chad Sweet)

@Chad-Sweet I am also trying to get the TOF sensor to work with PX4 avoidance. Would you be able to provide some more details on how to do the second step you mentioned? I am new to using voxl and not totally clear on what I would need to change/incorporate in order to get avoidance working. Thanks!

## Reply by wilkinsaf · 2022-02-07 17:43:43 UTC

@ptaylor1234 Not sure if you ever found the information, 

but PX4 avoidance information is listed here: https://docs.px4.io/v1.9.0/en/computer_vision/obstacle_avoidance.html
