memory leak test
This commit is contained in:
parent
dbf4711a81
commit
9f487bbe87
|
@ -48,6 +48,7 @@ namespace carla {
|
|||
if (!worldConnected())
|
||||
return false;
|
||||
readed = _pimpl->communication.tryReadEpisodeStart(startIndex, endIndex);
|
||||
std::cout << "Episode Start: " << readed << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -62,6 +63,7 @@ namespace carla {
|
|||
if (!worldConnected())
|
||||
return false;
|
||||
newEpisode = _pimpl->communication.tryReadRequestNewEpisode();
|
||||
std::cout << "New Episode Request: " << newEpisode << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -77,6 +79,8 @@ namespace carla {
|
|||
if (!worldConnected())
|
||||
return false;
|
||||
_pimpl->communication.sendScene(values);
|
||||
|
||||
std::cout << "Send scene values" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -84,6 +88,9 @@ namespace carla {
|
|||
if (!worldConnected())
|
||||
return false;
|
||||
_pimpl->communication.sendReset();
|
||||
|
||||
std::cout << "Send end reset" << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -233,6 +233,8 @@ namespace server {
|
|||
if (scene->SerializeToString(message.get())) {
|
||||
_worldThread.push(std::move(message));
|
||||
}
|
||||
|
||||
free(scene);
|
||||
}
|
||||
|
||||
void CarlaCommunication::sendReset() {
|
||||
|
|
|
@ -193,7 +193,7 @@ namespace server {
|
|||
}
|
||||
|
||||
|
||||
static bool getJPEGImages(const std::vector<Image> &images, Reward &rwd){
|
||||
static bool getPNGImages(const std::vector<Image> &images, Reward &rwd){
|
||||
std::string image_data;
|
||||
std::string depth_data;
|
||||
std::string image_size_data;
|
||||
|
@ -236,11 +236,6 @@ static bool getJPEGImages(const std::vector<Image> &images, Reward &rwd){
|
|||
|
||||
}
|
||||
|
||||
std::cout << "send depth size: " << depth_size_data.size() <<
|
||||
" send image size: " << image_size_data.size()<<
|
||||
" send image: " << image_data.size()<<
|
||||
" send depth: " << depth_data.size() << std::endl;
|
||||
|
||||
rwd.set_depth_sizes(depth_size_data);
|
||||
rwd.set_image_sizes(image_size_data);
|
||||
rwd.set_images(image_data);
|
||||
|
@ -273,10 +268,8 @@ static bool getJPEGImages(const std::vector<Image> &images, Reward &rwd){
|
|||
|
||||
#ifdef WITH_TURBOJPEG
|
||||
|
||||
//constexpr int JPEG_QUALITY = 75;
|
||||
|
||||
if (!getJPEGImages(values.images, reward)) {
|
||||
std::cerr << "Error compressing image to JPEG" << std::endl;
|
||||
if (!getPNGImages(values.images, reward)) {
|
||||
std::cerr << "Error compressing image to PNG" << std::endl;
|
||||
}
|
||||
|
||||
#endif // WITH_TURBOJPEG
|
||||
|
|
|
@ -36,7 +36,12 @@ namespace carla {
|
|||
port(port),
|
||||
_service(),
|
||||
_socket(_service),
|
||||
_connected(false){}
|
||||
_connected(false){
|
||||
|
||||
//int32_t timeout = 500;
|
||||
//setsockopt(_socket.native(), SOL_SOCKET, SO_SNDTIMEO, (const char*)&timeout, sizeof(timeout));
|
||||
|
||||
}
|
||||
|
||||
TCPServer::~TCPServer() {}
|
||||
|
||||
|
@ -60,7 +65,6 @@ namespace carla {
|
|||
void TCPServer::writeString(const std::string &message, error_code &error) {
|
||||
const int messageSize = static_cast<int>(message.length());
|
||||
std::string outMessage(GetBytes(messageSize) + message);
|
||||
|
||||
boost::asio::write(_socket, boost::asio::buffer(outMessage), error);
|
||||
|
||||
if (error)
|
||||
|
|
|
@ -162,7 +162,11 @@ int main(int argc, char *argv[]) {
|
|||
uint32_t startPoint, endPoint;
|
||||
bool error = false, readed = false;
|
||||
do {
|
||||
|
||||
std::cout << "Try read episode Start: ";
|
||||
error = !server.tryReadEpisodeStart(startPoint, endPoint, readed);
|
||||
std::cout << error << std::endl;
|
||||
|
||||
} while (!readed && !error);
|
||||
|
||||
if (error) {
|
||||
|
@ -181,12 +185,13 @@ int main(int argc, char *argv[]) {
|
|||
break;
|
||||
} else if (readed) {
|
||||
std::cout << "CONTROL --> gas: " << gas << " steer: " << steer << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (!server.sendReward(makeReward().release())) {
|
||||
std::cerr << "ERROR while sending Reward" << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!server.sendReward(makeReward().release())) {
|
||||
std::cerr << "ERROR while sending Reward" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cout << " ----- RESTARTING -----" << std::endl;
|
||||
|
|
Loading…
Reference in New Issue