Robot spawner services - #6
Conversation
- Implemented a new service for spawning UAVs with dynamic parameters. - Added SpawnParams_t structure to hold spawn parameters. - Updated UavSystemRos to utilize spawn parameters if provided. - Created Spawn.srv file for service definition. - Modified CMakeLists.txt and package.xml to include necessary dependencies.
There was a problem hiding this comment.
Pull request overview
This PR adds ROS 2 service APIs to dynamically spawn and remove UAV instances in mrs_multirotor_simulator, and extends the UAV system to optionally initialize from runtime-provided spawn parameters instead of static config.
Changes:
- Added new ROS 2 services:
Spawn(type/name/pose/heading) andKill(by name), with simulator handlers that create/removeUavSystemRosinstances at runtime. - Extended
UavSystemRosinitialization via optionalSpawnParams_t(dynamic type + spawn pose/heading) and addedgetUavName()for instance identification. - Updated build system (
CMakeLists.txt,package.xml) to generate and link ROSIDL service interfaces.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
srv/Spawn.srv |
Defines request/response schema for dynamic UAV creation. |
srv/Kill.srv |
Defines request/response schema for UAV removal by name. |
include/mrs_multirotor_simulator/uav_system_ros.h |
Adds SpawnParams_t, optional spawn params in handlers, and getUavName(). |
src/uav_system_ros.cpp |
Uses optional spawn params for type and initial pose/heading; adds getUavName() implementation. |
src/multirotor_simulator.cpp |
Registers Spawn/Kill services and implements callbacks; adds empty-UAV collision guard. |
CMakeLists.txt |
Adds ROSIDL interface generation and links typesupport to simulator targets. |
package.xml |
Adds ROSIDL generator/runtime dependencies for service generation and runtime availability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hey, very interesting addition. Could you please rework it such that the message and service definition is place in the |
afb5dca to
81ff504
Compare
Done, ctu-mrs/mrs_msgs#18 |
|
@klaxalk, I noticed that the PR in mrs_msgs has already been merged, while this one is still open. Could you please let me know if there’s anything else I should refactor or update here? |
|
@cychitivav thanks for reminding me. I am going to check if this does not break anything downstream (the flightforge simulator) and then I am gonna merge it. |
This pull request introduces dynamic UAV spawning and removal capabilities to the simulator, along with the necessary ROS 2 service infrastructure. The main changes include the addition of
SpawnandKillservices, updates to the build configuration to support ROS 2 interface generation, and modifications to the UAV system to support runtime configuration of UAV parameters.srv/Spawn.srv,srv/Kill.srv) and implemented their handlers in the simulator, allowing UAVs to be created and removed at runtime with specified parameters.SpawnParams_tstruct and updatedUavSystemRos_CommonHandlers_tto optionally include dynamic spawn parameters, enabling UAVs to use runtime-specified type, position, and heading.CMakeLists.txtandpackage.xmlto include ROSIDL dependencies and interface generation, ensuring service definitions are built and available at runtime. Linked the generated ROSIDL typesupport library to simulator targets for proper service handling.getUavName()method toUavSystemRosfor easier identification and management of UAV instances, used in service handlers to check for existing UAVs and remove them.