Revision 1efba872
Added instructions for GUI, properly subclassed next-step-simulation, Broke: line.
buggysim/src/sim_frame.cpp | ||
---|---|---|
28 | 28 |
*/ |
29 | 29 |
|
30 | 30 |
#include "buggysim/sim_frame.h" |
31 |
#include "adelaide.cpp" |
|
31 | 32 |
|
32 | 33 |
#include <QPointF> |
33 | 34 |
|
... | ... | |
64 | 65 |
nh_.setParam("background_g", DEFAULT_BG_G); |
65 | 66 |
nh_.setParam("background_b", DEFAULT_BG_B); |
66 | 67 |
|
68 |
// TODO: make it automatically pick up turtles? |
|
69 |
// Note: buggies must be added here to be chosen. |
|
70 |
// TODO: associate buggy with specific model. |
|
67 | 71 |
QVector<QString> turtles; |
68 |
turtles.append("box-turtle.png"); |
|
69 | 72 |
turtles.append("robot-turtle.png"); |
70 |
turtles.append("sea-turtle.png"); |
|
71 |
turtles.append("diamondback.png"); |
|
72 | 73 |
turtles.append("electric.png"); |
73 | 74 |
turtles.append("fuerte.png"); |
74 | 75 |
turtles.append("groovy.png"); |
75 | 76 |
turtles.append("hydro.svg"); |
76 | 77 |
|
77 | 78 |
QString images_path = (ros::package::getPath("buggysim") + "/images/").c_str(); |
79 |
|
|
78 | 80 |
for (size_t i = 0; i < turtles.size(); ++i) { |
79 | 81 |
QImage img; |
80 | 82 |
img.load(images_path + turtles[i]); |
81 | 83 |
turtle_images_.append(img); |
82 | 84 |
} |
83 | 85 |
|
86 |
|
|
84 | 87 |
meter_ = turtle_images_[0].height(); |
85 | 88 |
|
86 | 89 |
clear(); |
... | ... | |
154 | 157 |
} |
155 | 158 |
} |
156 | 159 |
|
157 |
TurtlePtr t(new Buggy(ros::NodeHandle(real_name), |
|
158 |
turtle_images_[rand() % turtle_images_.size()], QPointF(x, y), angle)); |
|
160 |
//ROS_INFO("Name: %s", name.data()); |
|
161 |
//ROS_INFO("Realname: %s", real_name.data()); |
|
162 |
// Load the correct implementation of turtle |
|
163 |
TurtlePtr t(new Adelaide(ros::NodeHandle(real_name), |
|
164 |
turtle_images_[rand() % turtle_images_.size()], |
|
165 |
QPointF(x, y), |
|
166 |
angle)); |
|
167 |
|
|
159 | 168 |
turtles_[real_name] = t; |
160 | 169 |
update(); |
161 | 170 |
|
Also available in: Unified diff