Revision 9b3564f3
Sonar prototypes in scoutsim package.
scout/scoutsim/CMakeLists.txt | ||
---|---|---|
36 | 36 |
#rosbuild_add_executable(turtle_teleop_key tutorials/teleop_turtle_key.cpp) |
37 | 37 |
#rosbuild_add_executable(draw_square tutorials/draw_square.cpp) |
38 | 38 |
#rosbuild_add_executable(mimic tutorials/mimic.cpp) |
39 |
<<<<<<< Updated upstream |
|
39 | 40 |
rosbuild_add_executable(scout_teleop src/scout_teleop.cpp) |
41 |
======= |
|
42 |
rosbuild_add_executable(spawn_scout src/spawn_scout.cpp) |
|
43 |
>>>>>>> Stashed changes |
scout/scoutsim/src/scout.cpp | ||
---|---|---|
156 | 156 |
return true; |
157 | 157 |
} |
158 | 158 |
|
159 |
void Scout::update(double dt, wxMemoryDC& path_dc, |
|
160 |
const wxImage& path_image, wxColour background_color, |
|
161 |
float canvas_width, float canvas_height) |
|
159 |
/// Sends back the position of this scout so scoutsim can save |
|
160 |
/// the world state |
|
161 |
geometry_msgs::Pose2D Scout::update(double dt, wxMemoryDC& path_dc, |
|
162 |
const wxImage& path_image, |
|
163 |
wxColour background_color, |
|
164 |
world_state state) |
|
162 | 165 |
{ |
163 | 166 |
// Assume that the two motors on the same side will be set to |
164 | 167 |
// roughly the same speed. Does not account for slip conditions |
scout/scoutsim/src/scout.h | ||
---|---|---|
101 | 101 |
Scout(const ros::NodeHandle& nh, const wxImage& scout_image, |
102 | 102 |
const Vector2& pos, float orient); |
103 | 103 |
|
104 |
void update(double dt, wxMemoryDC& path_dc, |
|
105 |
const wxImage& path_image, wxColour background_color, |
|
106 |
float canvas_width, float canvas_height); |
|
104 |
geometry_msgs::Pose2D update(double dt, wxMemoryDC& path_dc, |
|
105 |
const wxImage& path_image, |
|
106 |
wxColour background_color, |
|
107 |
world_state state); |
|
107 | 108 |
void paint(wxDC& dc); |
108 | 109 |
|
109 | 110 |
private: |
scout/scoutsim/src/sim_frame.cpp | ||
---|---|---|
156 | 156 |
return scouts.find(name) != scouts.end(); |
157 | 157 |
} |
158 | 158 |
|
159 |
std::string SimFrame::spawnScout(const std::string& name, float x,
|
|
160 |
float y, float angle) |
|
159 |
std::string SimFrame::spawnScout(const std::string& name, |
|
160 |
float x, float y, float angle)
|
|
161 | 161 |
{ |
162 | 162 |
std::string real_name = name; |
163 | 163 |
if (real_name.empty()) |
scout/scoutsim/src/sim_frame.h | ||
---|---|---|
62 | 62 |
|
63 | 63 |
namespace scoutsim |
64 | 64 |
{ |
65 |
/** |
|
66 |
* State of the whole world, positions of all scouts! |
|
67 |
* Passed by reference to scouts for reading on update loop. |
|
68 |
* Updated only by sim_frame to prevent concurrency problems. |
|
69 |
*/ |
|
70 |
typedef struct world_state |
|
71 |
{ |
|
72 |
float canvas_width; |
|
73 |
float canvas_height; |
|
74 |
|
|
75 |
} world_state; |
|
76 |
|
|
65 | 77 |
class SimFrame : public wxFrame |
66 | 78 |
{ |
67 | 79 |
public: |
Also available in: Unified diff