Project

General

Profile

Revision 7ffad595

ID7ffad595959c3425ce51c8858d7c3604ad97b1ad
Parent 788df921
Child cc9e9213

Added by Alex Zirbel over 11 years ago

Added walls to the scoutsim visualizer.

View differences:

scout/scoutsim/src/scoutsim.cpp
133 133
    EVT_MENU(ID_CLEAR, scoutsim::SimFrame::onClear)
134 134
    EVT_MENU(ID_MAP, scoutsim::SimFrame::showMap)
135 135
    EVT_MENU(ID_LINES, scoutsim::SimFrame::showLines)
136
    EVT_MENU(ID_WALLS, scoutsim::SimFrame::showWalls)
136 137
END_EVENT_TABLE()
137 138

  
138 139
DECLARE_APP(ScoutApp);
scout/scoutsim/src/sim_frame.cpp
96 96
                           map_name + ".bmp";
97 97
        map_lines_name = ros::package::getPath("scoutsim") + "/maps/" +
98 98
                           map_name + "_lines.bmp";
99
        map_walls_name = ros::package::getPath("scoutsim") + "/maps/" +
100
                           map_name + "_walls.bmp";
99 101
        display_map_name = map_base_name;
100 102

  
101 103
        wxBitmap lines_bitmap;
102 104
        lines_bitmap.LoadFile(wxString::FromAscii(map_lines_name.c_str()));
103 105
        lines_image = lines_bitmap.ConvertToImage();
104 106

  
107
        wxBitmap walls_bitmap;
108
        walls_bitmap.LoadFile(wxString::FromAscii(map_walls_name.c_str()));
109
        walls_image = walls_bitmap.ConvertToImage();
110

  
105 111
        clear();
106 112

  
107 113
        clear_srv = nh.advertiseService("clear",
......
114 120
                                       &SimFrame::killCallback, this);
115 121

  
116 122
        // Subscribe and publisher wirless from robots
117
        wireless_receive = nh.advertise< ::messages::WirelessPacket>("/wireless/receive", 1000); 
118
        wireless_send = nh.subscribe("/wireless/send", 1000, &SimFrame::wirelessCallback, this);
123
        wireless_receive = nh.advertise< ::messages::WirelessPacket>(
124
            "/wireless/receive", 1000); 
125
        wireless_send = nh.subscribe("/wireless/send", 1000,
126
            &SimFrame::wirelessCallback, this);
119 127

  
120 128
        ROS_INFO("Starting scoutsim with node name %s",
121 129
                 ros::this_node::getName().c_str()) ;
......
131 139
        wxMenu *menuView = new wxMenu;
132 140
        menuView->Append(ID_MAP, _("&Map"));
133 141
        menuView->Append(ID_LINES, _("&Lines"));
142
        menuView->Append(ID_WALLS, _("&Walls"));
134 143

  
135 144
        wxMenuBar *menuBar = new wxMenuBar;
136 145
        menuBar->Append(menuFile, _("&File"));
......
248 257
        display_map_name = map_lines_name;
249 258
        clear();
250 259
    }
260
    
261
    void SimFrame::showWalls(wxCommandEvent& WXUNUSED(event))
262
    {
263
        display_map_name = map_walls_name;
264
        clear();
265
    }
251 266

  
252 267
    void SimFrame::clear()
253 268
    {
scout/scoutsim/src/sim_frame.h
67 67
#define ID_CLEAR 3
68 68
#define ID_MAP 4
69 69
#define ID_LINES 5
70
#define ID_WALLS 6
70 71

  
71 72
namespace scoutsim
72 73
{
......
84 85
            void onClear(wxCommandEvent& event);
85 86
            void showMap(wxCommandEvent& event);
86 87
            void showLines(wxCommandEvent& event);
88
            void showWalls(wxCommandEvent& event);
87 89

  
88 90
            DECLARE_EVENT_TABLE()
89 91

  
......
110 112
            wxBitmap path_bitmap;
111 113
            wxImage path_image;
112 114
            wxImage lines_image;
115
            wxImage walls_image;
113 116
            wxMemoryDC path_dc;
114 117

  
115 118
            uint64_t frame_count;
......
133 136

  
134 137
            std::string map_base_name;
135 138
            std::string map_lines_name;
139
            std::string map_walls_name;
136 140
            std::string display_map_name;
137 141
    };
138 142

  

Also available in: Unified diff