Skip to content

Commit de39df5

Browse files
nkoenigNate Koenig
andauthored
Final prelim update (#992)
* Fix region events Signed-off-by: Nate Koenig <[email protected]> * Finals prelim worlds Signed-off-by: Nate Koenig <[email protected]> Co-authored-by: Nate Koenig <[email protected]>
1 parent ce5905f commit de39df5

18 files changed

+5338
-15
lines changed

subt_ign/launch/cloudsim_sim.ign

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,9 @@
375375
<% elsif $worldName.include?('final_event') &&
376376
!$worldName.include?('practice') %>
377377
<world_file>final_event/<%= worldNumber %>/<%= $worldName %>.sdf</world_file>
378+
<% elsif $worldName.include?('final_prelim') &&
379+
!$worldName.include?('practice') %>
380+
<world_file>final_prelim/<%= worldNumber %>/<%= $worldName %>.sdf</world_file>
378381
<% else %>
379382
<world_file><%= $worldName %>.sdf</world_file>
380383
<% end %>

subt_ign/launch/competition.ign

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@
289289
<% elsif $worldName.include?('final_event') &&
290290
!$worldName.include?('practice') %>
291291
<world_file>final_event/<%= worldNumber %>/<%= $worldName %>.sdf</world_file>
292+
<% elsif $worldName.include?('final_prelim') &&
293+
!$worldName.include?('practice') %>
294+
<world_file>final_prelim/<%= worldNumber %>/<%= $worldName %>.sdf</world_file>
292295
<% else %>
293296
<world_file><%= $worldName %>.sdf</world_file>
294297
<% end %>

subt_ign/launch/validate_artifacts.ign

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ ign service -s /artifact/move_to \
6666
<% elsif $worldName.include?('final_event') &&
6767
!$worldName.include?('practice') %>
6868
<world_file>final_event/<%= worldNumber %>/<%= $worldName %>.sdf</world_file>
69+
<% elsif $worldName.include?('final_prelim') &&
70+
!$worldName.include?('practice') %>
71+
<world_file>final_prelim/<%= worldNumber %>/<%= $worldName %>.sdf</world_file>
6972
<% else %>
7073
<world_file><%= $worldName %>.sdf</world_file>
7174
<% end %>

subt_ign/launch/validate_connections.ign

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ ign service -s /connection/prev \
7272
<% elsif $worldName.include?('final_event') &&
7373
!$worldName.include?('practice') %>
7474
<world_file>final_event/<%= worldNumber %>/<%= $worldName %>.sdf</world_file>
75+
<% elsif $worldName.include?('final_prelim') &&
76+
!$worldName.include?('practice') %>
77+
<world_file>final_prelim/<%= worldNumber %>/<%= $worldName %>.sdf</world_file>
7578
<% else %>
7679
<world_file><%= $worldName %>.sdf</world_file>
7780
<% end %>

subt_ign/launch/visibility.ign

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@
9191
<% elsif $worldName.include?('final_event') &&
9292
!$worldName.include?('practice') %>
9393
<world_file>final_event/<%= worldNumber %>/<%= $worldName %>.sdf</world_file>
94+
<% elsif $worldName.include?('final_prelim') &&
95+
!$worldName.include?('practice') %>
96+
<world_file>final_prelim/<%= worldNumber %>/<%= $worldName %>.sdf</world_file>
9497
<% else %>
9598
<world_file><%= $worldName %>.sdf</world_file>
9699
<% end %>

subt_ign/src/Common.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ bool FullWorldPath(const std::string &_worldName,
107107
const std::string urbanPrefix = "urban_circuit_";
108108
const std::string cavePrefix = "cave_circuit_";
109109
const std::string finalPrefix = "final_event_";
110+
const std::string finalPrelimPrefix = "final_prelim_";
110111
if (0 == _worldName.compare(0, tunnelPrefix.size(), tunnelPrefix))
111112
{
112113
std::string suffix = _worldName.substr(tunnelPrefix.size());
@@ -143,6 +144,12 @@ bool FullWorldPath(const std::string &_worldName,
143144
worldsDirectory = ignition::common::joinPaths(worldsDirectory,
144145
"final_event", suffix);
145146
}
147+
else if (_worldName.find(finalPrelimPrefix) != std::string::npos)
148+
{
149+
std::string suffix = _worldName.substr(finalPrelimPrefix.size());
150+
worldsDirectory = ignition::common::joinPaths(worldsDirectory,
151+
"final_prelim", suffix);
152+
}
146153
else if (_worldName.find("simple") == std::string::npos &&
147154
_worldName.find("_qual") == std::string::npos &&
148155
_worldName.find("_stix") == std::string::npos &&

subt_ign/src/ConnectionHelper.cc

Lines changed: 123 additions & 9 deletions
Large diffs are not rendered by default.

subt_ign/src/GameLogicPlugin.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ void GameLogicPluginPrivate::OnEvent(const ignition::msgs::Pose &_msg)
11131113
// there should be only 1 key-value pair. Just in case, we will grab
11141114
// only the first. The key is currently always "type", which we can
11151115
// ignore when sending the ROS message.
1116-
if (regionEventType.empty())
1116+
if (regionEventType.empty() && data.first == "type")
11171117
{
11181118
if (data.second.find("performer_detector_rockfall") ==
11191119
std::string::npos)
@@ -2390,6 +2390,10 @@ bool GameLogicPluginPrivate::OnFinishCall(const ignition::msgs::Boolean &_req,
23902390
ignition::msgs::Time localSimTime(this->simTime);
23912391
if (this->started && _req.data() && !this->finished)
23922392
{
2393+
ignmsg << "User triggered OnFinishCall." << std::endl;
2394+
this->Log(localSimTime) << "User triggered OnFinishCall." << std::endl;
2395+
this->logStream.flush();
2396+
23932397
this->Finish(localSimTime);
23942398
_res.set_data(true);
23952399
}

subt_ign/src/apps/dot_generator.cc

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ void printGraph(std::vector<VertexData> &_vertexData,
9494
_vertexData[i].tileType);
9595
if (ct1It == subt::ConnectionHelper::circuitTypes.end())
9696
{
97-
ignwarn << "No circuit information for: " << _vertexData[i].tileType
98-
<< std::endl;
97+
std::cerr << "No circuit information for: "
98+
<< _vertexData[i].tileType << std::endl;
9999
}
100100
auto ct2It = subt::ConnectionHelper::circuitTypes.find(
101101
_vertexData[j].tileType);
102102
if (ct2It == subt::ConnectionHelper::circuitTypes.end())
103103
{
104-
ignwarn << "No circuit information for: " << _vertexData[j].tileType
105-
<< std::endl;
104+
std::cerr << "No circuit information for: "
105+
<< _vertexData[j].tileType << std::endl;
106106
}
107107

108108
// Is one of the tile a starting area? If so, the cost should be 1.
@@ -191,7 +191,16 @@ void generateDOT(const std::string &_sdfFile, const std::string &_circuit)
191191
filter = [](const std::string &/*_name*/,
192192
const std::string &_type)
193193
{
194-
return subt::ConnectionHelper::connectionPoints.count(_type) <= 0;
194+
for (const auto &connection : subt::ConnectionHelper::connectionPoints)
195+
{
196+
if (ignition::common::lowercase(connection.first) ==
197+
ignition::common::lowercase(_type))
198+
{
199+
return false;
200+
}
201+
}
202+
203+
return true;
195204
};
196205

197206
std::vector<VertexData> vertexData;
@@ -202,6 +211,7 @@ void generateDOT(const std::string &_sdfFile, const std::string &_circuit)
202211
if (result == std::string::npos || result > str.size())
203212
break;
204213

214+
205215
VertexData vd;
206216
bool filled = SdfParser::FillVertexData(includeStr, vd, filter);
207217
if (filled)
11 MB
Binary file not shown.

0 commit comments

Comments
 (0)