@ -7,6 +7,7 @@
# include "common/swaglog.h"
# include "common/clutil.h"
# include "common/util.h"
# include "common/params.h"
# include "models/driving.h"
# include "messaging.hpp"
@ -17,7 +18,7 @@ bool live_calib_seen;
mat3 cur_transform ;
std : : mutex transform_lock ;
void calibration_thread ( ) {
void calibration_thread ( bool wide_camera ) {
set_thread_name ( " calibration " ) ;
set_realtime_priority ( 50 ) ;
@ -35,7 +36,7 @@ void calibration_thread() {
- 1.09890110e-03 , 0.00000000e+00 , 2.81318681e-01 ,
- 1.84808520e-20 , 9.00738606e-04 , - 4.28751576e-02 ;
Eigen : : Matrix < float , 3 , 3 > f cam_intrinsics = Eigen : : Matrix < float , 3 , 3 , Eigen : : RowMajor > ( fcam_intrinsic_matrix . v ) ;
Eigen : : Matrix < float , 3 , 3 > cam_intrinsics = Eigen : : Matrix < float , 3 , 3 , Eigen : : RowMajor > ( wide_camera ? ecam_intrinsic_matrix . v : fcam_intrinsic_matrix . v ) ;
const mat3 yuv_transform = get_model_yuv_transform ( ) ;
while ( ! do_exit ) {
@ -47,7 +48,7 @@ void calibration_thread() {
extrinsic_matrix_eigen ( i / 4 , i % 4 ) = extrinsic_matrix [ i ] ;
}
auto camera_frame_from_road_frame = f cam_intrinsics * extrinsic_matrix_eigen ;
auto camera_frame_from_road_frame = cam_intrinsics * extrinsic_matrix_eigen ;
Eigen : : Matrix < float , 3 , 3 > camera_frame_from_ground ;
camera_frame_from_ground . col ( 0 ) = camera_frame_from_road_frame . col ( 0 ) ;
camera_frame_from_ground . col ( 1 ) = camera_frame_from_road_frame . col ( 1 ) ;
@ -140,8 +141,14 @@ int main(int argc, char **argv) {
set_core_affinity ( 4 ) ;
# endif
bool wide_camera = false ;
# ifdef QCOM2
wide_camera = Params ( ) . getBool ( " EnableWideCamera " ) ;
# endif
// start calibration thread
std : : thread thread = std : : thread ( calibration_thread ) ;
std : : thread thread = std : : thread ( calibration_thread , wide_camera ) ;
// cl init
cl_device_id device_id = cl_get_device_id ( CL_DEVICE_TYPE_DEFAULT ) ;
@ -152,7 +159,7 @@ int main(int argc, char **argv) {
model_init ( & model , device_id , context ) ;
LOGW ( " models loaded, modeld starting " ) ;
VisionIpcClient vipc_client = VisionIpcClient ( " camerad " , VISION_STREAM_YUV_BACK , true , device_id , context ) ;
VisionIpcClient vipc_client = VisionIpcClient ( " camerad " , wide_camera ? VISION_STREAM_YUV_WIDE : VISION_STREAM_YUV_BACK , true , device_id , context ) ;
while ( ! do_exit & & ! vipc_client . connect ( false ) ) {
util : : sleep_for ( 100 ) ;
}