I’m trying to test antenna tracker with real GPS sensor by running the drone in simulated world.
To do this, I need to change drone’s starting position in the .world file to the real GPS position.
I wonder if passing argument to the .world file?
For now I run px4_sitl with predefined world by entering
export PX4_SITL_WORLD=empty
make px4_sitl_rtps gazebo
And I want to do something like
export PX4_SITL_WORLD=empty
export PX4_LAT=##.######
export PX4_LNG=###.#####
make px4_sitl_rtps gazebo
then those lat,lng values are passed to .world as below
<spherical_coordinates>
<surface_model>EARTH_WGS84</surface_model>
<latitude_deg>##.#####</latitude_deg>
<longitude_deg>###.#####</longitude_deg>
<elevation>1.3</elevation>
</spherical_coordinates>
@Kyuhyong_You We can go about this in many ways.
1 Like
Hi @Jaeyoung-Lim
Thanks for your comment.
I was able to run make px4_sitl_rtps gazebo
with HOME_LAT, LON, ALT with
export PX4_SITL_WORLD=empty && \
export PX4_HOME_LAT=37.4861749 && \
export PX4_HOME_LON=127.1164131 && \
export PX4_HOME_ALT=10.0 && \
Now I want to add libStaticMapPlugin to add a tile of local google map by adding below code to the empty.world
file.
<plugin name="map" filename="libStaticMapPlugin.so">
<center>LATITUDE LONGITUDE</center>
<world_size>100</world_size>
<map_type>satellite</map_type>
<api_key>AIzaSyDx6OmcQsSijhj3YJMh5ZPAbvKzX4DiNlc</api_key>
<use_cache>true</use_cache>
</plugin>
Can I pass PX4_HOME_LAT and PX4_HOME_LON into LATITUDE and LONGITUDE value ?
@Kyuhyong_You
Yes, but since .world files are xml files, they need to be statically written on the file. Therefore you would need to generate the .world file with a templating engine of your choice.
FYI, PX4 sitl_gazebo uses jinja