0

I',m trying to build my ros package with CMAKE_BUILD_TYPE=Release.

But if I build package and launch, nodes cannot properly read parameters from launch file.

I write launch file like below.

<launch>
    <node pkg="rr_perception" type="rr_object_detection_node" name="rr_object_detection" output="screen" respawn="true">
        <!-- input topics -->
        <!-- <remap from="~input" to="/ouster/points" /> -->
        <remap from="~input" to="/velodyne_points" />
        <remap from="~obstacle" to="/yolov5/detections" />
        <remap from="~feedback" to="/rr_erp42/feedback_ext" />
        <!-- output topics -->
        <remap from="~detection" to="/rr_object_detection/detection" />
        <remap from="~is_estop" to="/rr_safety_manager/estop_msg" />
        <rosparam>
            lidar_height: 0.92
             <!-- thereshold of angle difference for deciding whether point is obstacle or not  -->
            <!-- T_d: 10 -->
            <!-- parameter for margin of azimuth angle to find obstacle -->
            angle_threshhold: 0.5
            <!-- parameter for number of bin and lenght of one bin -->
            <!-- bin_num: 200
            bin_range: 0.1 -->
            <!-- mimimum cluster size to decide it is cluster or not -->
            min_cluster_size: 10
            <!-- maximum cluster size to decide it is cluster or not -->
            <!-- max_cluster_size: 20000000 -->
            max_cluster_size: 10000
            <!-- distance to decide if two points is same cluster or not -->
            tolerance: 0.4
            <!-- parameter of height to decide point is over the bottom plane -->
            pruning_height: 0.2
            <!-- voxel grid size -->
            voxel_size: 0.1
            <!-- safety ROI -->
            roi_x: 5.0
            roi_y: 1.5
            roi_z_min: -0.4
            roi_z_max: 1.5
            <!-- pruning ROI -->
            roi_x_ob: 1.5
            roi_y_ob: 1.5
            roi_z_min_ob: -1.0
            roi_z_max_ob: 0.5
            <!-- camera information for coordinate transforming -->
            camera_pixel_size: 1384
            camera_fov: 150

            T_d_prev: 0.1
            T_d_ground: 0.1
            seg_deg: 0.5
            bin_num: 100
            bin_range: 0.3
            T_m: 5.0
            T_m_small: -0.3
            T_RMSE: 0.1
            T_b: 1.0
            yolo_d: 1.0
            yolo_alive: 0.5

            voxel_x: 0.5
            voxel_y: 0.5
            voxel_z: 0.5
            countThreshold: 2
        </rosparam>
    </node>
  <node type="rviz" name="rviz" pkg="rviz" args="-d $(find rr_perception)/rviz/ouster_rviz.rviz" />
</launch>

and read parameter like below code.

        ROS_ASSERT(nh.getParam("lidar_height", impl_->lidar_height));
        ROS_ASSERT(nh.getParam("T_d_prev", impl_->T_d_prev));
        ROS_ASSERT(nh.getParam("T_d_ground", impl_->T_d_ground));
        ROS_ASSERT(nh.getParam("seg_deg", impl_->seg_deg));
        ROS_ASSERT(nh.getParam("bin_num", impl_->bin_num));
        ROS_ASSERT(nh.getParam("bin_range", impl_->bin_range));
        ROS_ASSERT(nh.getParam("T_m", impl_->T_m));
        ROS_ASSERT(nh.getParam("T_m_small", impl_->T_m_small));
        ROS_ASSERT(nh.getParam("T_RMSE", impl_->T_RMSE));
        ROS_ASSERT(nh.getParam("T_b", impl_->T_b));
        ROS_ASSERT(nh.getParam("T_d_prev", impl_->T_d_prev));

        ROS_ASSERT(nh.getParam("angle_threshhold", impl_->angle_th));
        ROS_ASSERT(nh.getParam("camera_pixel_size", impl_->camera_pixel_size));
        ROS_ASSERT(nh.getParam("camera_fov", impl_->camera_fov));
        ROS_ASSERT(nh.getParam("yolo_d", impl_->yolo_d));

If I print parameters, all of the values are 0.

[ WARN] [1688542286.528418611]: lidar_height 0.000000
[ WARN] [1688542286.528596290]: T_d_prev 0.000000
[ WARN] [1688542286.528600813]: T_d_ground 0.000000
[ WARN] [1688542286.528604522]: seg_deg 0.000000
[ WARN] [1688542286.528607722]: bin_num 0
[ WARN] [1688542286.528610995]: bin_range 0.000000
[ WARN] [1688542286.528615522]: T_m 0.000000
[ WARN] [1688542286.528618582]: T_m_small 0.000000
[ WARN] [1688542286.528621572]: T_RMSE 0.000000
[ WARN] [1688542286.528625362]: T_b 0.000000
[ WARN] [1688542286.528628338]: T_d_prev 0.000000
[ WARN] [1688542286.528631501]: angle_threshhold 0.000000
[ WARN] [1688542286.528635141]: camera_pixel_size 0
[ WARN] [1688542286.528641101]: camera_fov 0.000000
[ WARN] [1688542286.528644269]: yolo_d 0.000000
[ WARN] [1688542286.528661874]: ROI X 0.000000

Strange thing is that if I build with CMAKE_BUILD_TYPE=Release option, it prints properly.

Does Release option make package to not read rosparam?

Please help me.

I tried to build in release option to make my package run faster. But it does not run at all.

0 Answers0