Added LICENSE notices. Separated robot definition from implementation.
This commit is contained in:
25
robot.cpp
25
robot.cpp
@@ -35,32 +35,7 @@ Robot::Robot(std::string hostname, uint32_t port) {
|
||||
}
|
||||
|
||||
Robot::~Robot() {
|
||||
std::cout << "Destroying robot" << std::endl;
|
||||
delete _p_proxy;
|
||||
delete _r_proxy;
|
||||
delete _p_client;
|
||||
}
|
||||
|
||||
IASSS_Robot::IASSS_Robot(std::string hostname, uint32_t port) : Robot(hostname, port) {
|
||||
std::cout << "Creating IAS-SS robot on host \"" << hostname << "\" and port " << port << "." << std::endl;
|
||||
}
|
||||
|
||||
IASSS_Robot::~IASSS_Robot() {
|
||||
std::cout << "Destroying IAS-SS robot." << std::endl;
|
||||
}
|
||||
|
||||
void IASSS_Robot::run() {
|
||||
_p_client->Read();
|
||||
|
||||
if(_r_proxy->GetRange(1) < 1.0) {
|
||||
if(_r_proxy->GetRange(0) > 1.0)
|
||||
_p_proxy->SetSpeed(0.0f, PlayerCc::dtor(-45));
|
||||
else if(_r_proxy->GetRange(2) > 1.0)
|
||||
_p_proxy->SetSpeed(0.0f, PlayerCc::dtor(45));
|
||||
else
|
||||
_p_proxy->SetSpeed(0.0f, PlayerCc::dtor(180));
|
||||
} else {
|
||||
_p_proxy->SetSpeed(0.3f, 0.0f);
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user