-
Notifications
You must be signed in to change notification settings - Fork 14
How to generate new science data?
Science data is loaded by the Science Sensors Plugin to generate salinity, temperature, chlorophyll and current sensors. Values are read from a csv file with the following fields, indicating their names in the first line of the file:
elapsed_time_second
latitude_degree
longitude_degree
depth_meter
sea_water_temperature_degC
sea_water_salinity_psu
mass_concentration_of_chlorophyll_in_sea_water_ugram_per_liter
eastward_sea_water_velocity_meter_per_sec
northward_sea_water_velocity_meter_per_sec
In a csv
file along with some data, it should look like this:
elapsed_time_second,latitude_degree,longitude_degree,depth_meter,sea_water_temperature_degC,sea_water_salinity_psu,mass_concentration_of_chlorophyll_in_sea_water_ugram_per_liter,eastward_sea_water_velocity_meter_per_sec,northward_sea_water_velocity_meter_per_sec
0,36.8024781413352,-121.829647676843,0,16.4777568562924,33.4406838402469,5.59611283346742,-0.0303889695119743,0.0241565608953265
0,36.8024781413352,-121.82933140694,0,16.4880578739855,33.440635436351,5.56476938370162,-0.0299001674494645,0.0237270864038717
In order to load new data files the World Config Plugin interface, the /world/science_sensor/environment_data_path topic or the <data_path> option can be used.
Examples of science data can be found in the data directory of this repository.
As mentioned above there's several ways to load new science data into the system. Lets look into the steps of how this can be done.
New science data files can be loaded through the world file. Example science data csv files can be found here. Lets use the buoyant_tethys.sdf world file as as an example. The buoyant_tethys.sdf
world file uses the Science Sensors System to load the data from the csv
file and publish it through the plugin topics. The path for the science data is specified in the world file as follows:
<!-- Example world file --->
<world>
<!-- Other plugins and models --->
<plugin
filename="ScienceSensorsSystem"
name="tethys::ScienceSensorsSystem">
<data_path>2003080103_mb_l3_las.csv</data_path>
<!--data_path>2003080103_mb_l3_las_1x1km.csv</data_path-->
<!--data_path>simple_test.csv</data_path-->
</plugin>
<!-- Other plugins and models --->
</world>
The example world file above is loading the 2003080103_mb_l3_las.csv
file that is located in the data directory of the repository.
Note that the file must be located in one of the directories in the resource path of Gazebo and you should use the path relative to that directory. In order to add a new directory to the gazebo data path you can just add the path to the GZ_SIM_RESOURCE_PATH
environment variable. This can be done by sing the following command:
export GZ_SIM_RESOURCE_PATH=$GZ_SIM_RESOURCE_PATH:/your/path/to/data/dir
To run the world and load the data the following command can be executed:
gz sim buoyant_tethys.sdf
Any of the available topics for chlorophyll, salinity, current or temperature can be checked directly by using the Gazebo CLI commands. Here is an example that echoes the chlorophyll values:
gz topic -e -t /model/tethys/chlorophyll
The csv
file can also be loaded using the topic /world/science_sensor/environment_data_path topic. In the previous world the path can be updated to a new csv
just by publishing to the topi. Here is the example of how to this using the Gazebo CLI:
gz topic -t /world/science_sensor/enviroment_data_path_topic -m gz.msgs.StringMsg -p 'data:"/path/to/datafile"'
The the reflected changes can be checked again using the CLI:
gz topic -e -t /model/tethys/salinity
Finally the csv
file can also be loaded through the GUI using the world config plugin. The loaded file will be published on its topic /world/science_sensor/environment_data_path
.