Revision 0e0ef125
Changes to add ghost scout to sim frame and make it show up on the simulator.
Currently the functionality for killing scouts does not kill the ghost scout. That needs to be fixed eventually.
scout/scoutsim/CMakeLists.txt | ||
---|---|---|
28 | 28 |
include_directories( ${wxWidgets_INCLUDE_DIRS} ) |
29 | 29 |
|
30 | 30 |
rosbuild_add_boost_directories() |
31 |
rosbuild_add_executable(scoutsim_node src/scoutsim.cpp src/scout.cpp src/sim_frame.cpp) |
|
31 |
rosbuild_add_executable(scoutsim_node src/scoutsim.cpp src/scout.cpp src/ghost_scout.cpp src/sim_frame.cpp)
|
|
32 | 32 |
rosbuild_link_boost(scoutsim_node thread) |
33 | 33 |
target_link_libraries(scoutsim_node ${wxWidgets_LIBRARIES}) |
34 | 34 |
|
scout/scoutsim/src/sim_frame.cpp | ||
---|---|---|
245 | 245 |
scout_image, Vector2(x, y), &path_bitmap, angle)); |
246 | 246 |
scouts[real_name] = t; |
247 | 247 |
|
248 |
ghost_scouts.push_back(new GhostScout(ros::NodeHandle(real_name), |
|
249 |
scout_image, Vector2(x, y), &path_bitmap, angle, name)); |
|
250 |
|
|
248 | 251 |
ROS_INFO("Spawning scout [%s] at x=[%f], y=[%f], theta=[%f]", |
249 | 252 |
real_name.c_str(), x, y, angle); |
250 | 253 |
|
... | ... | |
338 | 341 |
{ |
339 | 342 |
it->second->paint(dc); |
340 | 343 |
} |
344 |
for (unsigned int i=0; i<ghost_scouts.size(); ++i) |
|
345 |
{ |
|
346 |
ghost_scouts.at(i)->paint(dc); |
|
347 |
} |
|
341 | 348 |
} |
342 | 349 |
|
343 | 350 |
bool SimFrame::fileExists(const std::string& filename) |
... | ... | |
512 | 519 |
state); |
513 | 520 |
} |
514 | 521 |
|
522 |
for (unsigned int i=0; i<ghost_scouts.size(); ++i) |
|
523 |
{ |
|
524 |
ghost_scouts.at(i)->update(0.016, path_dc, sonar_dc, |
|
525 |
path_dc.GetBackground().GetColour(), state); |
|
526 |
} |
|
527 |
|
|
515 | 528 |
frame_count++; |
516 | 529 |
} |
517 | 530 |
|
scout/scoutsim/src/sim_frame.h | ||
---|---|---|
62 | 62 |
#include <map> |
63 | 63 |
|
64 | 64 |
#include "scout.h" |
65 |
#include "ghost_scout.h" |
|
65 | 66 |
#include "scoutsim_internal.h" |
66 | 67 |
#include "messages/WirelessPacket.h" |
67 | 68 |
|
... | ... | |
163 | 164 |
|
164 | 165 |
typedef std::map<std::string, ScoutPtr> M_Scout; |
165 | 166 |
M_Scout scouts; |
167 |
std::vector<GhostScout*> ghost_scouts; |
|
166 | 168 |
uint32_t id_counter; |
167 | 169 |
|
168 | 170 |
std::string images_path; |
Also available in: Unified diff