# ToF sensor and VOA

Source: https://forum.modalai.com/topic/1725/tof-sensor-and-voa
Category: VOXL 2 and VOXL 2 Mini (https://forum.modalai.com/category/26/voxl-2-and-voxl-2-mini)
Tags: voxl-2
Posted: 2023-01-20 20:07:33 UTC by xav04
Replies: 8 · Views: 1706

## xav04 · 2023-01-20 20:07:33 UTC

Hi, I'd like to know if is it possible to use a ToF sensor for obstacle avoidance with voxl2. To give you more context, when I run ```voxl-inspect-tof``` I get the correct distance measurements. I modified ```/etc/modalai/voxl-vision-px4.conf``` , where "en_voa" is set to true and "voa_inouts" only accepts "tof". 

To verify that this is working I run ```voxl-vision-px4 -s``` but all distances are none. Please let me know how I can fix this.

Also, is it possible to see objects with a shorter range using ToF, like around 1m?

![1.png](https://forum.modalai.com/assets/uploads/files/1674245368234-1.png) 

![voxl-vision-px4.png](https://forum.modalai.com/assets/uploads/files/1674244991791-voxl-vision-px4.png)

## Reply by Guest · 2023-01-20 21:01:36 UTC

Yes this should absolutely be possible, can you send the screenshot of your voxl-vision config file as well. 

As for range we usually cut off the tof data around 15 cm in front of the camera, so it usually has an effective range of ~0.15-5 meters

## Reply by xav04 · 2023-01-20 22:14:34 UTC

Hi @Alex-Gardner, sure! This is the configuration of ```/etc/modalai/voxl-vision-px4.conf```.
If there is any other parameter that can be improved please let me know

![2.png](https://forum.modalai.com/assets/uploads/files/1674252825280-2.png)

## Reply by xav04 · 2023-01-23 19:27:25 UTC (in reply to Guest)

Hi @Alex-Gardner , is there any other file I should upload?

## Reply by xav04 · 2023-01-25 19:15:24 UTC (in reply to Guest)

@Alex-Gardner I'm wondering if you can help me solve this problem or is there someone else on the development team who can provide support?

## Reply by Guest · 2023-01-25 19:21:03 UTC

Hi,

Can you check in voxl-portal what the pointcloud ```voxl_pc_out``` looks like? this is the VOA pointcloud before the final bit of filtering to send it to the flight controller. 

Also check ```/etc/modalai/extrinsics.conf``` to make sure that it matches the transforms that are on your drone.

## Reply by xav04 · 2023-01-25 21:16:38 UTC (in reply to Guest)

Hi @Alex-Gardner this is the screenshot of ```voxl_pc_out``` in voxl-portal, at the same time this is the output of ```voxl-vision-px4 -s``` and this is the screenshot ```/etc/modalai/extrinsics.conf```
![3.PNG](https://forum.modalai.com/assets/uploads/files/1674681298972-3.png) ![4.PNG](https://forum.modalai.com/assets/uploads/files/1674681306718-4.png) 
![2.PNG](https://forum.modalai.com/assets/uploads/files/1674681354929-2.png)

## Reply by James Strawson (ModalAI staff) · 2023-01-25 22:34:16 UTC

your image of the voa_pc_out point cloud shows that your voxl thinks the TOF is pointing out the top of the drone. This is confirmed by your extrinsics conf sensor rotation: [180 0 0] which translates to a sensor pointing straight up.

## Reply by Sarika Sharma · 2026-01-16 10:23:51 UTC (in reply to James Strawson)

@James-Strawson Hii , I am also getting the same issue . Kindly look at the following details . I have defined tof in my extrinsics.conf file as given below:
    parent:                body
    child:                 tof
    T_child_wrt_parent:    0.070   0.024  -0.029 
    RPY_parent_to_child:   0.0    90.0    90.0  
    R_child_to_parent:     0.000  -0.000   1.000 
                           1.000   0.000  -0.000 
                          -0.000   1.000   0.000
when i run voxl-vision-hub -s i got the following
slice  0  dist none back
slice  1  dist none
slice  2  dist none
slice  3  dist none
slice  4  dist none
slice  5  dist none
slice  6  dist none
slice  7  dist none
slice  8  dist none
slice  9  dist none left
slice 10  dist none
slice 11  dist none
slice 12  dist none
slice 13  dist none
slice 14  dist none
slice 15  dist none
slice 16  dist none
slice 17  dist none
slice 18  dist none forward
slice 19  dist none
slice 20  dist none
slice 21  dist none
slice 22  dist none
slice 23  dist none
slice 24  dist none
slice 25  dist none
slice 26  dist none
slice 27  dist none right
slice 28  dist none
and in my vision-hub-conf file i have the folloeing set up:
	"en_vio":	true,
	"vio_pipe":	"qvio",
	"secondary_vio_pipe":	"ov",
	"vfc_vio_pipe":	"ov",
	"en_reset_vio_if_initialized_inverted":	true,
	"vio_warmup_s":	3,
	"send_odom_while_failed":	true,
	"horizon_cal_tolerance":	0.5,
	"en_hitl":	false,
	"offboard_mode":	"figure_eight",
	"follow_tag_id":	0,
	"figure_eight_move_home":	true,
	"robot_radius":	0.300000011920929,
	"collision_sampling_dt":	0.1,
	"max_lookahead_distance":	1,
	"backtrack_seconds":	60,
	"backtrack_rc_chan":	8,
	"backtrack_rc_thresh":	1500,
	"wps_move_home":	true,
	"wps_stride":	0,
	"wps_timeout":	0,
	"wps_damp":	1,
	"wps_vfc_mission":	true,
	"wps_vfc_mission_loop":	false,
	"wps_vfc_mission_to_ramp":	25,
	"wps_vfc_mission_to_kp":	0.10000000149011612,
	"wps_vfc_mission_cruise_speed":	1,
	"en_tag_fixed_frame":	false,
	"fixed_frame_filter_len":	5,
	"en_transform_mavlink_pos_setpoints_from_fixed_frame":	false,
	"vfc_rate":	100,
	"vfc_rc_chan_min":	980,
	"vfc_rc_chan_max":	2020,
	"vfc_thrust_ch":	3,
	"vfc_roll_ch":	1,
	"vfc_pitch_ch":	2,
	"vfc_yaw_ch":	4,
	"vfc_submode_ch":	6,
	"vfc_alt_mode_rc_min":	0,
	"vfc_alt_mode_rc_max":	0,
	"vfc_flow_mode_rc_min":	0,
	"vfc_flow_mode_rc_max":	0,
	"vfc_hybrid_flow_mode_rc_min":	0,
	"vfc_hybrid_flow_mode_rc_max":	0,
	"vfc_position_mode_rc_min":	0,
	"vfc_position_mode_rc_max":	2100,
	"vfc_traj_mode_rc_min":	0,
	"vfc_traj_mode_rc_max":	0,
	"vfc_yaw_deadband":	30,
	"vfc_vxy_deadband":	50,
	"vfc_vz_deadband":	150,
	"vfc_min_thrust":	0,
	"vfc_max_thrust":	0.800000011920929,
	"vfc_tilt_max":	0.43599998950958252,
	"vfc_yaw_rate_max":	3,
	"vfc_thrust_hover":	0.5,
	"vfc_vz_max":	1,
	"vfc_kp_z":	5.2899999618530273,
	"vfc_kd_z":	5.9800000190734863,
	"vfc_vxy_max":	3,
	"vfc_kp_xy":	0.63999998569488525,
	"vfc_kd_xy":	2.559999942779541,
	"vfc_kp_z_vio":	5.2899999618530273,
	"vfc_kd_z_vio":	5.9800000190734863,
	"vfc_kp_xy_vio":	3.2400000095367432,
	"vfc_kd_xy_vio":	3.9600000381469727,
	"vfc_w_filt_xy_vio":	10,
	"vfc_w_filt_xy_flow":	3,
	"vfc_vel_ff_factor_vio":	0.899999976158142,
	"vfc_xy_acc_limit_vio":	2.5,
	"vfc_max_z_delta":	3,
	"vfc_att_transition_time":	0.5,
	"vfc_stick_move_threshold":	30,
	"vfc_flow_transition_time":	1,
	"vfc_q_min":	10,
	"vfc_points_min":	7,
	"vfc_en_submode_announcement":	1,
	"vfc_disable_fallback":	false,
	"vfc_traj_csv":	"/data/voxl-vision-hub/traj.csv",
	"en_voa":	true,
	"voa_upper_bound_m":	-0.15000000596046448,
	"voa_lower_bound_m":	0.15000000596046448,
	"voa_memory_s":	1,
	"voa_max_pc_per_fusion":	100,
	"voa_pie_max_dist_m":	20,
	"voa_pie_min_dist_m":	0.25,
	"voa_pie_under_trim_m":	1,
	"voa_pie_threshold":	3,
	"voa_send_rate_hz":	20,
	"voa_pie_slices":	36,
	"voa_pie_bin_depth_m":	0.15000000596046448,
	"voa_inputs":	[{
			"enabled":	false,
			"type":	"point_cloud",
			"input_pipe":	"dfs_point_cloud",
			"frame":	"stereo_l",
			"max_depth":	8,
			"min_depth":	0.300000011920929,
			"cell_size":	0.079999998211860657,
			"threshold":	4,
			"x_fov_deg":	68,
			"y_fov_deg":	56,
			"conf_cutoff":	0
		}, {
			"enabled":	false,
			"type":	"point_cloud",
			"input_pipe":	"stereo_front_pc",
			"frame":	"stereo_front_l",
			"max_depth":	8,
			"min_depth":	0.300000011920929,
			"cell_size":	0.079999998211860657,
			"threshold":	4,
			"x_fov_deg":	68,
			"y_fov_deg":	56,
			"conf_cutoff":	0
		}, {
			"enabled":	false,
			"type":	"point_cloud",
			"input_pipe":	"stereo_rear_pc",
			"frame":	"stereo_rear_l",
			"max_depth":	8,
			"min_depth":	0.300000011920929,
			"cell_size":	0.079999998211860657,
			"threshold":	4,
			"x_fov_deg":	68,
			"y_fov_deg":	56,
			"conf_cutoff":	0
		}, {
			"enabled":	true,
			"type":	"tof",
			"input_pipe":	"tof",
			"frame":	"tof",
			"max_depth":	6,
			"min_depth":	0.15000000596046448,
			"cell_size":	0.079999998211860657,
			"threshold":	3,
			"x_fov_deg":	106.5,
			"y_fov_deg":	85.0999984741211,
			"conf_cutoff":	125
		}, {
			"enabled":	false,
			"type":	"rangefinder",
			"input_pipe":	"rangefinders",
			"frame":	"body",
			"max_depth":	8,
			"min_depth":	0.300000011920929,
			"cell_size":	0.079999998211860657,
			"threshold":	4,
			"x_fov_deg":	68,
			"y_fov_deg":	56,
			"conf_cutoff":	0
		}],
	"voa_voa_memory_s":	1
}

![Screenshot from 2026-01-16 16-01-23.png](https://forum.modalai.com/assets/uploads/files/1768559497610-screenshot-from-2026-01-16-16-01-23.png)
