#include <RobotControlSimulatedRobots.h>
Thomas Röfer
Definition at line 24 of file RobotControlSimulatedRobots.h.
Possible states of a simulated robot
Definition at line 28 of file RobotControlSimulatedRobots.h.
CRobotControlSimulatedRobots::CRobotControlSimulatedRobots | ( | ) |
Default constructor
Definition at line 15 of file RobotControlSimulatedRobots.cpp.
References design, and RobotDesign::ERS210.
CRobotControlSimulatedRobots::~CRobotControlSimulatedRobots | ( | ) |
Destructor
Definition at line 25 of file RobotControlSimulatedRobots.cpp.
References design, pSimRobotDocument, selectedRobot, sendOracle, simulatedRobotsAreDisabled, and state.
void CRobotControlSimulatedRobots::create | ( | ) |
Creates the simulated robots
Definition at line 44 of file RobotControlSimulatedRobots.cpp.
References activeWithImages, design, disabled, RobotDesign::ERS7, File::getGTDir(), CSimRobotDocument::OnSimReset(), pSimRobotDocument, selectedRobot, sendOracle, CSimRobotDocument::SetFilePath(), simulatedRobotsAreDisabled, and state.
Referenced by CRobotControlApp::InitInstance().
RobotDesign::Design CRobotControlSimulatedRobots::getDesign | ( | int | robot | ) | const |
returns the design of a robot
Definition at line 241 of file RobotControlSimulatedRobots.cpp.
References design.
Referenced by CSimulatedRobotsToolBar::handleDropDown().
bool CRobotControlSimulatedRobots::getDoRestart | ( | ) | const |
If true, then the configuration of the simulated robots changed and the simulator needs to be restarted. No communication with the simulated robots should occur then
Definition at line 211 of file RobotControlSimulatedRobots.cpp.
References doRestart.
Referenced by CSimulatedRobotsToolBar::updateUI().
int CRobotControlSimulatedRobots::getSelectedRobot | ( | ) | const |
Returns the selected simulated robot. If -1, then no robot is selected.
Definition at line 134 of file RobotControlSimulatedRobots.cpp.
References selectedRobot.
Referenced by CRobotControlQueues::isFromSelectedOrUndefinedRobot(), and CSimulatedRobotsToolBar::updateUI().
bool CRobotControlSimulatedRobots::getSendOracle | ( | ) | const |
If oracled world state shall be sent to the simulated robots
Definition at line 221 of file RobotControlSimulatedRobots.cpp.
References sendOracle.
Referenced by OVirtualRobotComm::main().
CSimRobotDocument * CRobotControlSimulatedRobots::getSimRobotDocument | ( | ) | const |
Returns the SimRobot document
Definition at line 226 of file RobotControlSimulatedRobots.cpp.
References pSimRobotDocument.
Referenced by CONTROLLER::CONTROLLER(), CSimulatorObjectViewerDlgBar::CSimulatorObjectViewerDlgBar(), CSimulatorObjectViewerDlgBar::GetDocument(), CSimulatedRobotsToolBar::handleCommand(), and CSimulatedRobotsToolBar::updateUI().
bool CRobotControlSimulatedRobots::getSimulatedRobotsAreDisabled | ( | ) | const |
Returns whether the variable simulatedRobotsAreDisabled is true. Returns not whether one of the robots is active
Definition at line 231 of file RobotControlSimulatedRobots.cpp.
References simulatedRobotsAreDisabled.
Referenced by CSimulatedRobotsToolBar::handleCommand(), and CSimulatedRobotsToolBar::updateUI().
CRobotControlSimulatedRobots::State CRobotControlSimulatedRobots::getState | ( | int | robot | ) | const |
Returns the state of a simulated robot
Definition at line 184 of file RobotControlSimulatedRobots.cpp.
References state.
Referenced by CSimRobotDocument::GenerateSceneFile(), CSimulatedRobotsToolBar::handleCommand(), CSimulatedRobotsToolBar::handleDropDown(), and CSimulatedRobotsToolBar::updateUI().
void CRobotControlSimulatedRobots::onIdle | ( | ) |
Manages the communication with the simulated robots
Definition at line 69 of file RobotControlSimulatedRobots.cpp.
References activeWithImages, activeWithoutImages, CRobotControlQueuesToRobots::allRobots, MessageQueue::clear(), MessageQueue::copyAllMessages(), doRestart, getQueues(), CSimRobotDocument::OnIdle(), pSimRobotDocument, CRobotControlQueuesToRobots::robot, robots, CRobotControlQueuesToRobots::selectedRobot, selectedRobot, state, SYNC_WITH, and CRobotControlQueues::toSimulated.
Referenced by CRobotControlApp::OnIdle().
void CRobotControlSimulatedRobots::OnSimReset | ( | ) |
Should be called for resetting the simulation
Definition at line 104 of file RobotControlSimulatedRobots.cpp.
References doRestart, getDebugKeyTables(), CSimRobotDocument::OnSimReset(), pSimRobotDocument, CSimRobotDocument::pSimulatorObjectViewerDlgBar, CSimulatorObjectViewerDlgBar::Repaint(), and CRobotControlDebugKeyTables::sendForSimulatedRobots().
Referenced by CSimulatedRobotsToolBar::handleCommand().
void CRobotControlSimulatedRobots::OnSimStart | ( | ) |
Should be called for starting/stopping the simulation
Definition at line 112 of file RobotControlSimulatedRobots.cpp.
References CSimRobotDocument::OnSimStart(), and pSimRobotDocument.
Referenced by CSimulatedRobotsToolBar::handleCommand().
void CRobotControlSimulatedRobots::OnSimStep | ( | ) |
Should be called for performing 1 simulation step
Definition at line 117 of file RobotControlSimulatedRobots.cpp.
References CSimRobotDocument::OnSimStep(), and pSimRobotDocument.
Referenced by CSimulatedRobotsToolBar::handleCommand().
void CRobotControlSimulatedRobots::selectFirstActiveRobot | ( | ) | [private] |
Selects the first active robot or -1. Used when the selected robot becomes disabled
Definition at line 189 of file RobotControlSimulatedRobots.cpp.
References activeWithImages, activeWithoutImages, selectedRobot, and state.
Referenced by setStateAndDesign().
void CRobotControlSimulatedRobots::setSelectedRobot | ( | int | robot | ) |
Selects a simulated robot. If -1, then no robot is selected.
Definition at line 122 of file RobotControlSimulatedRobots.cpp.
References activeWithImages, activeWithoutImages, ASSERT, selectedRobot, and state.
Referenced by CSimulatedRobotsToolBar::handleCommand().
void CRobotControlSimulatedRobots::setSendOracle | ( | bool | doSend | ) |
Sets the sendOracle flag
Definition at line 216 of file RobotControlSimulatedRobots.cpp.
References sendOracle.
Referenced by CSimulatedRobotsToolBar::handleCommand().
void CRobotControlSimulatedRobots::setSimulatedRobotsAreDisabled | ( | bool | disabled | ) |
Sets the variable simulatedRobotsAreDisabled. Does not disable or deactivate any robots.
Definition at line 236 of file RobotControlSimulatedRobots.cpp.
References simulatedRobotsAreDisabled.
Referenced by CSimulatedRobotsToolBar::handleCommand().
void CRobotControlSimulatedRobots::setStateAndDesign | ( | int | robot, | |
State | newState, | |||
RobotDesign::Design | newDesign | |||
) |
Sets the state and the design of a simulated robot
Definition at line 139 of file RobotControlSimulatedRobots.cpp.
References activeWithImages, activeWithoutImages, design, disabled, passive, selectedRobot, selectFirstActiveRobot(), state, and stop().
Referenced by CSimulatedRobotsToolBar::handleDropDown().
void CRobotControlSimulatedRobots::stop | ( | ) | [private] |
Stops the simulator and the communication with the simulated robots because a change in the configuration occurred
Definition at line 202 of file RobotControlSimulatedRobots.cpp.
References doRestart, CSimRobotDocument::IsRunning(), CSimRobotDocument::OnSimStart(), and pSimRobotDocument.
Referenced by setStateAndDesign().
the design of each simuated robot
Definition at line 85 of file RobotControlSimulatedRobots.h.
Referenced by create(), CRobotControlSimulatedRobots(), getDesign(), setStateAndDesign(), and ~CRobotControlSimulatedRobots().
bool CRobotControlSimulatedRobots::doRestart [private] |
If true, then the configuration of the simulated robots changed and the simulator needs to be restarted.
Definition at line 129 of file RobotControlSimulatedRobots.h.
Referenced by getDoRestart(), onIdle(), OnSimReset(), and stop().
A pointer to the SimRobot document (contains the simulation)
Definition at line 123 of file RobotControlSimulatedRobots.h.
Referenced by create(), getSimRobotDocument(), onIdle(), OnSimReset(), OnSimStart(), OnSimStep(), stop(), and ~CRobotControlSimulatedRobots().
pointers to the simulated robots
Definition at line 82 of file RobotControlSimulatedRobots.h.
Referenced by onIdle(), and OVirtualRobotComm::OVirtualRobotComm().
int CRobotControlSimulatedRobots::selectedRobot [private] |
The selected simulated robot. If -1, then no robot is selected.
Definition at line 132 of file RobotControlSimulatedRobots.h.
Referenced by create(), getSelectedRobot(), onIdle(), selectFirstActiveRobot(), setSelectedRobot(), setStateAndDesign(), and ~CRobotControlSimulatedRobots().
bool CRobotControlSimulatedRobots::sendOracle [private] |
determines, if world models computed by the oracle should be sent to the simulated robots
Definition at line 135 of file RobotControlSimulatedRobots.h.
Referenced by create(), getSendOracle(), setSendOracle(), and ~CRobotControlSimulatedRobots().
bool CRobotControlSimulatedRobots::simulatedRobotsAreDisabled [private] |
A flag that globally disables all simulated robots. If true, the robots are nevertheless constructed but not triggered. This is used to bypass messages from physical robots directly to the queue to gui without sending them through the simulated robots.
Definition at line 108 of file RobotControlSimulatedRobots.h.
Referenced by create(), getSimulatedRobotsAreDisabled(), setSimulatedRobotsAreDisabled(), and ~CRobotControlSimulatedRobots().
State CRobotControlSimulatedRobots::state[8] [private] |
The states of the simulated robots
Definition at line 111 of file RobotControlSimulatedRobots.h.
Referenced by create(), getState(), onIdle(), selectFirstActiveRobot(), setSelectedRobot(), setStateAndDesign(), and ~CRobotControlSimulatedRobots().