o3de / o3de-extras

Other
61 stars 61 forks source link

Added option to spawn entities with WGS84 coords using existing ros service #704

Closed patrykantosz closed 3 months ago

patrykantosz commented 3 months ago

What does this PR do?

Added option in ROS2 Spawner component to spawn entities using WGS84 coords using existing spawn_entity service. To switch to WGS84 coords parameter 'reference_frame' needs to be set to 'wgs84'.

Usage example: ros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity "{name: 'some', xml: '', robot_namespace: '', initial_pose: { position: { x: 32.5896238486642, y: 35.1930592634115, z: 135.0 }, orientation: { x: 0.0, y: 0.0, z: 0.0, w: 1.0 } }, reference_frame: 'wgs84' }"

How was this PR tested?

By using level with geo reference (made by @michalpelka) and spawning entities with different rotation,

michalpelka commented 3 months ago

I tested it against a level build on top of ortophotomap, and spawned a box with some geographical coordinates

ros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity "{name: Foo, initial_pose: { position: { y: 21.04264386637526, x: 52.2406855386909, z: 0.0 }, orientation: { w: 0.9848078 , y: 0.0, z: 0.1736482, x: 0} }, reference_frame: 'wgs84'}"

image

Works great :+1: