|
1290 | 1290 | return spawn, exec
|
1291 | 1291 | end
|
1292 | 1292 |
|
1293 |
| - def spawnTeamBase(_x, _y, _z, _yaw) |
| 1293 | + def spawnTeamBase(_name, _x, _y, _z, _yaw) |
1294 | 1294 | spawn = <<-HEREDOC
|
1295 |
| - <spawn name='TEAMBASE'> |
1296 |
| - <name>TEAMBASE</name> |
| 1295 | + <spawn name='#{_name}'> |
| 1296 | + <name>#{_name}</name> |
1297 | 1297 | <allow_renaming>false</allow_renaming>
|
1298 | 1298 | <world>#{$worldName}</world>
|
1299 | 1299 | <is_performer>false</is_performer>
|
1300 | 1300 | <sdf version='1.6'>
|
1301 |
| - <model name='TEAMBASE'> |
| 1301 | + <model name='#{_name}'> |
1302 | 1302 | <pose>#{_x} #{_y} #{_z} 0 0 #{_yaw}</pose>
|
1303 | 1303 | <static>true</static>
|
1304 | 1304 | <link name='link'>
|
|
1318 | 1318 |
|
1319 | 1319 | exec = <<-HEREDOC
|
1320 | 1320 | <executable name='teambase_description'>
|
1321 |
| - <command>roslaunch --wait subt_ros teambase_description.launch world_name:=#{$worldName}</command> |
| 1321 | + <command>roslaunch --wait subt_ros teambase_description.launch world_name:=#{$worldName} name:=#{_name}</command> |
1322 | 1322 | </executable>
|
1323 | 1323 | <executable name='teambase_ros_ign_bridge'>
|
1324 |
| - <command>roslaunch --wait subt_ros teambase_topics.launch world_name:=#{$worldName}</command> |
| 1324 | + <command>roslaunch --wait subt_ros teambase_topics.launch world_name:=#{$worldName} name:=#{_name}</command> |
1325 | 1325 | </executable>
|
1326 | 1326 | HEREDOC
|
1327 | 1327 |
|
|
1384 | 1384 |
|
1385 | 1385 | spawnStringTmp, executables = spawnX4(name, robotConfigN, robot.pos.x, robot.pos.y, robot.pos.z, robot.rot.yaw)
|
1386 | 1386 |
|
1387 |
| - elsif name == "TEAMBASE" and config == "TEAMBASE" |
| 1387 | + elsif config.upcase == "TEAMBASE" |
1388 | 1388 | robotSpawned += 1
|
1389 | 1389 | if !teamBaseSpawned
|
1390 | 1390 | teamBaseSpawned = true
|
1391 |
| - spawnStringTmp, executables = spawnTeamBase(posX, posY, spawnWorldZPos, spawnWorldYaw) |
| 1391 | + spawnStringTmp, executables = spawnTeamBase(name, posX, posY, spawnWorldZPos, spawnWorldYaw) |
| 1392 | + else |
| 1393 | + puts "Error: Only 1 teambase is allows. Skpping[%s]." % [name] |
1392 | 1394 | end
|
1393 |
| - elsif config != "TEAMBASE" |
| 1395 | + else |
1394 | 1396 | # Try a team-submitted vehicle.
|
1395 | 1397 | package = config.downcase
|
1396 | 1398 | installDir = `rospack find #{package}`.chomp
|
|
1432 | 1434 | spawnStringTmp = spawner(name, modelURI, $worldName, robot.pos.x, robot.pos.y, robot.pos.z, 0, 0, robot.rot.yaw)
|
1433 | 1435 | executables = rosExecutables(name, $worldName)
|
1434 | 1436 | end
|
1435 |
| - else |
1436 |
| - puts "Error: Invalid Name[%s] or Config[%s]. Skpping." % [name, config] |
1437 | 1437 | end
|
1438 | 1438 |
|
1439 | 1439 | if executables != nil
|
|
0 commit comments