Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove workaround for empty struct in RPC #2812

Merged
merged 1 commit into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions AirLib/include/api/RpcLibAdapatorsBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,12 +405,6 @@ class RpcLibAdapatorsBase {
image_data_uint8 = s.image_data_uint8;
image_data_float = s.image_data_float;

//TODO: remove bug workaround for https://github.com/rpclib/rpclib/issues/152
if (image_data_uint8.size() == 0)
image_data_uint8.push_back(0);
if (image_data_float.size() == 0)
image_data_float.push_back(0);

camera_name = s.camera_name;
camera_position = Vector3r(s.camera_position);
camera_orientation = Quaternionr(s.camera_orientation);
Expand Down Expand Up @@ -481,11 +475,6 @@ class RpcLibAdapatorsBase {
{
time_stamp = s.time_stamp;
point_cloud = s.point_cloud;

//TODO: remove bug workaround for https://github.com/rpclib/rpclib/issues/152
if (point_cloud.size() == 0)
point_cloud.push_back(0);

pose = s.pose;
}

Expand Down
7 changes: 1 addition & 6 deletions AirLib/src/api/RpcLibServerBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,7 @@ RpcLibServerBase::RpcLibServerBase(ApiProvider* api_provider, const std::string&
return RpcLibAdapatorsBase::ImageResponse::from(response);
});
pimpl_->server.bind("simGetImage", [&](const std::string& camera_name, ImageCaptureBase::ImageType type, const std::string& vehicle_name) -> vector<uint8_t> {
auto result = getVehicleSimApi(vehicle_name)->getImage(camera_name, type);
if (result.size() == 0) {
// rpclib has a bug with serializing empty vectors, so we return a 1 byte vector instead.
result.push_back(0);
}
return result;
return getVehicleSimApi(vehicle_name)->getImage(camera_name, type);
});

pimpl_->server.bind("simGetMeshPositionVertexBuffers", [&]() ->vector<RpcLibAdapatorsBase::MeshPositionVertexBuffersResponse> {
Expand Down