Closed srmainwaring closed 1 year ago
Add a system plugin to set the global wind velocity.
Add a world system plugin that subscribes to a wind topic accepting a msgs::Vector3d representing the true wind velocity. The plugin is specified as:
msgs::Vector3d
<plugin filename="asv_sim2-wind-system" name="gz::sim::systems::Wind"> <topic>/wind</topic> </plugin>
If the <topic> element is not provided the plugin generates the default topic:
<topic>
/world/<world_name>/wind
To update the wind publish to the topic, for example:
gz topic -t "/wind" -m gz.msgs.Vector3d -p "x: -10"
will set the wind to be 10 m/s from the east (recall Gazebo's world frame is ENU).
Run the example world:
gz sim -v4 -r anemometer.sdf
Check the anemometer:
gz topic -e -t /anemometer -n 1 header { stamp { sec: 15 nsec: 602000000 } data { key: "frame_id" value: "anemometer::base_link::anemometer" } data { key: "seq" value: "15601" } } x: -9.9999999999994671 y: -3.2679489692100105e-06 z: -5.5125523286750351e-13
Change the wind:
Console message:
[Dbg] [Wind.cc:205] Wind: -10 0 0
gz topic -e -t /anemometer -n 1 header { stamp { sec: 195 nsec: 535000000 } data { key: "frame_id" value: "anemometer::base_link::anemometer" } data { key: "seq" value: "195534" } } x: -3.2679489692100105e-06 y: 9.9999999999994671 z: -5.5125522202548536e-13
The anemometer is facing north, and sees the wind shift from the north (body frame -x) to the east (body frame +y).
Add a system plugin to set the global wind velocity.
Details
Add a world system plugin that subscribes to a wind topic accepting a
msgs::Vector3d
representing the true wind velocity. The plugin is specified as:If the
<topic>
element is not provided the plugin generates the default topic:To update the wind publish to the topic, for example:
will set the wind to be 10 m/s from the east (recall Gazebo's world frame is ENU).
Testing
Run the example world:
Check the anemometer:
Change the wind:
Console message:
Check the anemometer:
The anemometer is facing north, and sees the wind shift from the north (body frame -x) to the east (body frame +y).