Enable and disable sensors at startup![Conflict Detection Enabled Conflict Detection Enabled](/sites/all/themes/redux/css/images/icons/conflict_enabled_icon.png)
Summary
In this tutorial, we show how to start up your world while disabling sensors you aren't planning to use.
Why disable sensors?
Simulating a sensor consumes CPU resources, and if you start recording your bagfiles can take up significant amounts of space. Even if you aren't using a camera or the spinning Velodyne sensors, the drivers have to be loaded and that uses up memory. If you are running "rosbag record -a", and not using all the sensors, you should consider disabling sensors in your launch file.
What sensors can you enable/disable?
By default, the below set of sensors are set to run, but can be turned off at start up time:
- front_laser_points - (not recommended to be disabled), this produces message of type sensor_msgs/LaserScan at a rate of 5Hz-75Hz in simulation (75Hz in the real car)
- velodyne_points - produces messages of type sensor_msgs/PointCloud
- camera_left - produces messages of type sensor_msgs/Image
- camera_right - produces messages of type sensor_msgs/Image
What dependencies are there between sensors and other nodes?
The front_laser_points sensor is used by the obstacleStopper node, so we do not recommend disabling this sensor unless you also plan to remap nodes between cmd_vel and cmd_vel_safe topics: if you disable this sensor, it's very likely that the car will not move for you.
What does disabling a sensor look like?
Try this in your already-built workspace:
roslaunch catvehicle catvehicle_neighborhood.launch velodyne_points:=false
This will start up everything except the velodyne laser on top of the car:
$ rostopic list | grep points /catvehicle/front_laser_points
If you kill (^C) your roslaunch above, try starting it again:
roslaunch catvehicle catvehicle_neighborhood.launch
You can now check to see that the velodyne_points topic is being produced
$ rostopic list | grep points /catvehicle/front_laser_points /catvehicle/lidar_points
It's that easy?
Basically. To replicate this in your own packages (e.g., your custom world files or other things), make sure you make a copy of a launch file from the catvehicle package which exposes these parameters at the launch file level, and you should be able to replicate it on your own. Good luck!