Skip to content

Commit

Permalink
Merge pull request #410 from osrf/breadcrumbs_static
Browse files Browse the repository at this point in the history
Make breadcrumb model static after specified time
  • Loading branch information
nkoenig authored May 13, 2020
2 parents 5ef7adb + 1b29050 commit 5541b2b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def spawner(_name, _modelURI, _worldName, _x, _y, _z, _roll, _pitch, _yaw)
name="ignition::gazebo::systems::Breadcrumbs">
<topic>/model/#{_name}/breadcrumb/deploy</topic>
<max_deployments>12</max_deployments>"
<disable_physics_time>3.0</disable_physics_time>
<breadcrumb>"
<sdf version="1.6">
<model name="#{_name}__breadcrumb__">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def spawner(_name, _modelURI, _worldName, _x, _y, _z, _roll, _pitch, _yaw)
name="ignition::gazebo::systems::Breadcrumbs">
<topic>/model/#{_name}/breadcrumb/deploy</topic>
<max_deployments>12</max_deployments>"
<disable_physics_time>3.0</disable_physics_time>
<breadcrumb>"
<sdf version="1.6">
<model name="#{_name}__breadcrumb__">
Expand Down
2 changes: 2 additions & 0 deletions subt_ign/launch/cave_circuit.ign
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@
" name=\"ignition::gazebo::systems::Breadcrumbs\">\n"\
" <topic>/model/#{_name}/breadcrumb/deploy</topic>\n"\
" <max_deployments>#{max_breadcrumbs}</max_deployments>"\
" <disable_physics_time>3.0</disable_physics_time>"\
" <breadcrumb>\n"\
" <sdf version=\"1.6\">\n"\
" <model name=\"#{_name}__breadcrumb__\">\n"\
Expand Down Expand Up @@ -629,6 +630,7 @@
" name=\"ignition::gazebo::systems::Breadcrumbs\">\n"\
" <topic>/model/#{_name}/breadcrumb/deploy</topic>\n"\
" <max_deployments>#{max_breadcrumbs}</max_deployments>"\
" <disable_physics_time>3.0</disable_physics_time>"\
" <breadcrumb>\n"\
" <sdf version=\"1.6\">\n"\
" <model name=\"#{_name}__breadcrumb__\">\n"\
Expand Down
2 changes: 2 additions & 0 deletions subt_ign/launch/cloudsim_sim.ign
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@
" name=\"ignition::gazebo::systems::Breadcrumbs\">\n"\
" <topic>/model/#{_name}/breadcrumb/deploy</topic>\n"\
" <max_deployments>#{max_breadcrumbs}</max_deployments>"\
" <disable_physics_time>3.0</disable_physics_time>"\
" <breadcrumb>\n"\
" <sdf version=\"1.6\">\n"\
" <model name=\"#{_name}__breadcrumb__\">\n"\
Expand Down Expand Up @@ -664,6 +665,7 @@
" name=\"ignition::gazebo::systems::Breadcrumbs\">\n"\
" <topic>/model/#{_name}/breadcrumb/deploy</topic>\n"\
" <max_deployments>#{max_breadcrumbs}</max_deployments>"\
" <disable_physics_time>3.0</disable_physics_time>"\
" <breadcrumb>\n"\
" <sdf version=\"1.6\">\n"\
" <model name=\"#{_name}__breadcrumb__\">\n"\
Expand Down
5 changes: 4 additions & 1 deletion subt_ign/src/CommsBrokerPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <functional>
#include <mutex>
#include <regex>

#include <ignition/common/Console.hh>
#include <ignition/common/Util.hh>
Expand Down Expand Up @@ -310,7 +311,9 @@ void CommsBrokerPlugin::UpdateIfNewBreadcrumbs()
for (const auto& [name, pose] : this->poses)
{
// New breadcrumb found.
if (name.find("__breadcrumb__") != std::string::npos &&
// A static model is spawned when the breadcrumb is made static
if (std::regex_match(name,
std::regex(".*__breadcrumb___(\\d+)__static__")) &&
this->breadcrumbs.find(name) == this->breadcrumbs.end())
{
this->breadcrumbs[name] = pose;
Expand Down

0 comments on commit 5541b2b

Please sign in to comment.