Merge branch 'xisco' of https://bitbucket.org/carla-cvc/carla-ue4-plugin into xisco
This commit is contained in:
commit
dab689759f
|
@ -153,12 +153,11 @@ APlayerStart *CarlaGameController::ChoosePlayerStart(
|
|||
RestartLevel(true);
|
||||
}
|
||||
}
|
||||
uint32 StartIndex;
|
||||
if (SendAndReadSceneValues(*Server, AvailableStartSpots, StartIndex)) {
|
||||
return AvailableStartSpots[StartIndex];
|
||||
} else {
|
||||
uint32 StartIndex = 0u;
|
||||
if (!SendAndReadSceneValues(*Server, AvailableStartSpots, StartIndex)) {
|
||||
RestartLevel(true);
|
||||
}
|
||||
return AvailableStartSpots[StartIndex];
|
||||
}
|
||||
|
||||
void CarlaGameController::RegisterPlayer(AController &NewPlayer)
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace carla {
|
|||
_pimpl(std::make_unique<Pimpl>(worldPort, writePort, readPort)) {}
|
||||
|
||||
CarlaServer::~CarlaServer() {}
|
||||
|
||||
|
||||
void CarlaServer::init(uint32_t LevelCount) {
|
||||
_pimpl->sendWorld(static_cast<uint32_t>(Mode::NUMBER_OF_MODES), LevelCount);
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ namespace carla {
|
|||
bool CarlaServer::tryReadControl(float &steer, float &throttle) {
|
||||
return _pimpl->tryReadControl(steer, throttle);
|
||||
}
|
||||
|
||||
bool CarlaServer::tryReadRequestNewEpisode(){
|
||||
|
||||
bool CarlaServer::newEpisodeRequested() {
|
||||
return _pimpl->tryReadRequestNewEpisode();
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace carla {
|
|||
if (needsRestart()) return false;
|
||||
_pimpl->sendSceneValues(values);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool CarlaServer::sendEndReset() {
|
||||
if (needsRestart()) return false;
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace carla {
|
|||
/// is empty.
|
||||
bool tryReadControl(float &steer, float &throttle);
|
||||
|
||||
bool tryReadRequestNewEpisode();
|
||||
bool newEpisodeRequested();
|
||||
|
||||
/// Send values of the current player status.
|
||||
bool sendReward(const Reward_Values &values);
|
||||
|
|
|
@ -38,7 +38,7 @@ static std::vector<carla::Color> makeImage(uint32_t width, uint32_t height) {
|
|||
img[4 * width * i + 4 * e + 3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::vector<carla::Color> image(width * height);
|
||||
size_t i = 0u;
|
||||
for (carla::Color &color : image) {
|
||||
|
@ -96,7 +96,7 @@ int main(int argc, char *argv[]) {
|
|||
{
|
||||
carla::Mode mode;
|
||||
uint32_t scene;
|
||||
|
||||
|
||||
while(!server.needsRestart() && !server.tryReadSceneInit(mode, scene));
|
||||
|
||||
std::cout << "Received: mode = "
|
||||
|
@ -107,7 +107,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
carla::Scene_Values sceneValues;
|
||||
|
||||
|
||||
|
||||
sceneValues.possible_positions.push_back({0.0f, 0.0f});
|
||||
sceneValues.possible_positions.push_back({1.0f, 2.0f});
|
||||
sceneValues.possible_positions.push_back({3.0f, 4.0f});
|
||||
|
@ -127,13 +127,13 @@ int main(int argc, char *argv[]) {
|
|||
while (!server.needsRestart() && !server.tryReadEpisodeStart(start, end));
|
||||
std::cout << "Received: startIndex = " << start
|
||||
<< ", endIndex = " << end << std::endl;
|
||||
|
||||
|
||||
|
||||
server.sendEndReset();
|
||||
while (!server.needsRestart()) {
|
||||
float steer, gas;
|
||||
uint32_t startPoint, endPoint;
|
||||
if (server.tryReadRequestNewEpisode()){
|
||||
if (server.newEpisodeRequested()){
|
||||
std::cout << "-------- RESET --------" << std::endl;
|
||||
server.sendSceneValues(sceneValues);
|
||||
while (!server.needsRestart() && !server.tryReadEpisodeStart(startPoint, endPoint));
|
||||
|
|
Loading…
Reference in New Issue