remove pre-build proto/grpc files (they differ for each platform and proto/grpc version)

This commit is contained in:
erwincoumans
2018-09-07 15:44:33 -07:00
parent 12409f1118
commit 5164f2f9a7
17 changed files with 48 additions and 39063 deletions

View File

@@ -1,6 +1,6 @@
#ifdef BT_ENABLE_GRPC
#include "PhysicsClientGRPC.h"
#include "grpc/pybullet.grpc.pb.h"
#include "SharedMemory/grpc/proto/pybullet.grpc.pb.h"
#include <grpc++/grpc++.h>
using grpc::Channel;
#include <stdio.h>
@@ -12,8 +12,9 @@ using grpc::Channel;
#include <string>
#include "Bullet3Common/b3Logging.h"
#include "Bullet3Common/b3AlignedObjectArray.h"
#include "grpc/ConvertGRPCBullet.h"
#include "SharedMemory/grpc/ConvertGRPCBullet.h"
using pybullet_grpc::PyBulletAPI;
static unsigned int b3DeserializeInt2(const unsigned char* input)
{
@@ -27,7 +28,7 @@ bool gVerboseNetworkMessagesClient3 = false;
struct GRPCNetworkedInternalData
{
std::shared_ptr<grpc::Channel> m_grpcChannel;
std::unique_ptr< pybullet_grpc::PyBulletAPI::Stub> m_stub;
std::unique_ptr< PyBulletAPI::Stub> m_stub;
bool m_isConnected;
@@ -70,7 +71,7 @@ struct GRPCNetworkedInternalData
m_grpcChannel = grpc::CreateChannel(
hostport, grpc::InsecureChannelCredentials());
m_stub = pybullet_grpc::PyBulletAPI::NewStub(m_grpcChannel);
m_stub = PyBulletAPI::NewStub(m_grpcChannel);

View File

@@ -1,13 +1,13 @@
#include "ConvertGRPCBullet.h"
#include "PhysicsClientC_API.h"
#include "SharedMemoryCommands.h"
#include "SharedMemory/PhysicsClientC_API.h"
#include "SharedMemory/SharedMemoryCommands.h"
#include <memory>
#include <iostream>
#include <string>
#include <thread>
#include <grpc++/grpc++.h>
#include <grpc/support/log.h>
#include "pybullet.grpc.pb.h"
#include "SharedMemory/grpc/proto/pybullet.grpc.pb.h"
#include "LinearMath/btMinMax.h"
#define ALLOW_GRPC_COMMAND_CONVERSION
@@ -21,7 +21,6 @@ using grpc::ServerCompletionQueue;
using grpc::Status;
using pybullet_grpc::PyBulletCommand;
using pybullet_grpc::PyBulletStatus;
using pybullet_grpc::PyBulletAPI;
pybullet_grpc::PyBulletCommand* convertBulletToGRPCCommand(const struct SharedMemoryCommand& clientCmd, pybullet_grpc::PyBulletCommand& grpcCommand)
{
@@ -472,7 +471,7 @@ pybullet_grpc::PyBulletCommand* convertBulletToGRPCCommand(const struct SharedMe
default:
{
printf("convertBulletToGRPCCommand: Unknown command\n");
//printf("convertBulletToGRPCCommand: Unknown command\n");
//assert(0);
}
@@ -568,7 +567,7 @@ SharedMemoryCommand* convertGRPCToBulletCommand(const PyBulletCommand& grpcComma
}
else
{
printf("Ignore unexpected unknowncommandbinaryblob\n");
printf("Error: Ignore unexpected unknowncommandbinaryblob\n");
}
cmdPtr = &cmd;
}
@@ -1276,7 +1275,7 @@ bool convertGRPCToStatus(const PyBulletStatus& grpcReply, SharedMemoryStatus& se
const char* data = grpcReply.binaryblob().Get(0).c_str();
int numBytes = grpcReply.binaryblob().Get(0).size();
printf("copied binary blob of %d bytes\n", numBytes);
//printf("copied binary blob of %d bytes\n", numBytes);
memcpy(bufferServerToClient, data, numBytes);
serverStatus.m_numDataStreamBytes = numBytes;
}

View File

@@ -28,7 +28,7 @@ typedef SharedMemoryCommandProcessor MyCommandProcessor;
#include <grpc++/grpc++.h>
#include <grpc/support/log.h>
#include "pybullet.grpc.pb.h"
#include "proto/pybullet.grpc.pb.h"
using grpc::Server;
@@ -67,7 +67,7 @@ public:
cq_ = builder.AddCompletionQueue();
// Finally assemble the server.
server_ = builder.BuildAndStart();
std::cout << "Server listening on " << hostNamePort << std::endl;
std::cout << "Standalone Bullet Physics GRPC server listening on " << hostNamePort << std::endl;
// Proceed to the server's main loop.
HandleRpcs(comProc);

View File

@@ -1,19 +1,13 @@
del ..\pybullet.pb.cpp
del ..\pybullet.pb.h
del ..\pybullet.grpc.pb.cpp
del ..\pybullet.grpc.pb.h
del pybullet.pb.cpp
del pybullet.pb.h
del pybullet.grpc.pb.cpp
del pybullet.grpc.pb.h
..\..\..\ThirdPartyLibs\grpc\lib\win32\protoc --proto_path=. --cpp_out=. pybullet.proto
..\..\..\ThirdPartyLibs\grpc\lib\win32\protoc.exe --plugin=protoc-gen-grpc="..\..\..\ThirdPartyLibs\grpc\lib\win32\grpc_cpp_plugin.exe" --grpc_out=. pybullet.proto
move pybullet.grpc.pb.cc ..\pybullet.grpc.pb.cpp
move pybullet.grpc.pb.h ..\pybullet.grpc.pb.h
move pybullet.pb.cc ..\pybullet.pb.cpp
move pybullet.pb.h ..\pybullet.pb.h
del ..\pybullet_pb2.py
del ..\pybullet_pb2_grpc.py
del pybullet_pb2.py
del pybullet_pb2_grpc.py
..\..\..\ThirdPartyLibs\grpc\lib\win32\protoc --proto_path=. --python_out=. pybullet.proto
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. pybullet.proto
move pybullet_pb2.py ..\pybullet_pb2.py
move pybullet_pb2_grpc.py ..\pybullet_pb2_grpc.py

View File

@@ -1,59 +0,0 @@
// Generated by the gRPC C++ plugin.
// If you make any local change, they will be lost.
// source: pybullet.proto
#include "pybullet.pb.h"
#include "pybullet.grpc.pb.h"
#include <grpc++/impl/codegen/async_stream.h>
#include <grpc++/impl/codegen/async_unary_call.h>
#include <grpc++/impl/codegen/channel_interface.h>
#include <grpc++/impl/codegen/client_unary_call.h>
#include <grpc++/impl/codegen/method_handler_impl.h>
#include <grpc++/impl/codegen/rpc_service_method.h>
#include <grpc++/impl/codegen/service_type.h>
#include <grpc++/impl/codegen/sync_stream.h>
namespace pybullet_grpc {
static const char* PyBulletAPI_method_names[] = {
"/pybullet_grpc.PyBulletAPI/SubmitCommand",
};
std::unique_ptr< PyBulletAPI::Stub> PyBulletAPI::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
std::unique_ptr< PyBulletAPI::Stub> stub(new PyBulletAPI::Stub(channel));
return stub;
}
PyBulletAPI::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)
: channel_(channel), rpcmethod_SubmitCommand_(PyBulletAPI_method_names[0], ::grpc::RpcMethod::NORMAL_RPC, channel)
{}
::grpc::Status PyBulletAPI::Stub::SubmitCommand(::grpc::ClientContext* context, const ::pybullet_grpc::PyBulletCommand& request, ::pybullet_grpc::PyBulletStatus* response) {
return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_SubmitCommand_, context, request, response);
}
::grpc::ClientAsyncResponseReader< ::pybullet_grpc::PyBulletStatus>* PyBulletAPI::Stub::AsyncSubmitCommandRaw(::grpc::ClientContext* context, const ::pybullet_grpc::PyBulletCommand& request, ::grpc::CompletionQueue* cq) {
return new ::grpc::ClientAsyncResponseReader< ::pybullet_grpc::PyBulletStatus>(channel_.get(), cq, rpcmethod_SubmitCommand_, context, request);
}
PyBulletAPI::Service::Service() {
AddMethod(new ::grpc::RpcServiceMethod(
PyBulletAPI_method_names[0],
::grpc::RpcMethod::NORMAL_RPC,
new ::grpc::RpcMethodHandler< PyBulletAPI::Service, ::pybullet_grpc::PyBulletCommand, ::pybullet_grpc::PyBulletStatus>(
std::mem_fn(&PyBulletAPI::Service::SubmitCommand), this)));
}
PyBulletAPI::Service::~Service() {
}
::grpc::Status PyBulletAPI::Service::SubmitCommand(::grpc::ServerContext* context, const ::pybullet_grpc::PyBulletCommand* request, ::pybullet_grpc::PyBulletStatus* response) {
(void) context;
(void) request;
(void) response;
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
} // namespace pybullet_grpc

View File

@@ -1,130 +0,0 @@
// Generated by the gRPC C++ plugin.
// If you make any local change, they will be lost.
// source: pybullet.proto
#ifndef GRPC_pybullet_2eproto__INCLUDED
#define GRPC_pybullet_2eproto__INCLUDED
#include "pybullet.pb.h"
#include <grpc++/impl/codegen/async_stream.h>
#include <grpc++/impl/codegen/async_unary_call.h>
#include <grpc++/impl/codegen/method_handler_impl.h>
#include <grpc++/impl/codegen/proto_utils.h>
#include <grpc++/impl/codegen/rpc_method.h>
#include <grpc++/impl/codegen/service_type.h>
#include <grpc++/impl/codegen/status.h>
#include <grpc++/impl/codegen/stub_options.h>
#include <grpc++/impl/codegen/sync_stream.h>
namespace grpc {
class CompletionQueue;
class Channel;
class RpcService;
class ServerCompletionQueue;
class ServerContext;
} // namespace grpc
namespace pybullet_grpc {
class PyBulletAPI final {
public:
class StubInterface {
public:
virtual ~StubInterface() {}
// Sends a greeting
virtual ::grpc::Status SubmitCommand(::grpc::ClientContext* context, const ::pybullet_grpc::PyBulletCommand& request, ::pybullet_grpc::PyBulletStatus* response) = 0;
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::pybullet_grpc::PyBulletStatus>> AsyncSubmitCommand(::grpc::ClientContext* context, const ::pybullet_grpc::PyBulletCommand& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::pybullet_grpc::PyBulletStatus>>(AsyncSubmitCommandRaw(context, request, cq));
}
private:
virtual ::grpc::ClientAsyncResponseReaderInterface< ::pybullet_grpc::PyBulletStatus>* AsyncSubmitCommandRaw(::grpc::ClientContext* context, const ::pybullet_grpc::PyBulletCommand& request, ::grpc::CompletionQueue* cq) = 0;
};
class Stub final : public StubInterface {
public:
Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);
::grpc::Status SubmitCommand(::grpc::ClientContext* context, const ::pybullet_grpc::PyBulletCommand& request, ::pybullet_grpc::PyBulletStatus* response) override;
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::pybullet_grpc::PyBulletStatus>> AsyncSubmitCommand(::grpc::ClientContext* context, const ::pybullet_grpc::PyBulletCommand& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::pybullet_grpc::PyBulletStatus>>(AsyncSubmitCommandRaw(context, request, cq));
}
private:
std::shared_ptr< ::grpc::ChannelInterface> channel_;
::grpc::ClientAsyncResponseReader< ::pybullet_grpc::PyBulletStatus>* AsyncSubmitCommandRaw(::grpc::ClientContext* context, const ::pybullet_grpc::PyBulletCommand& request, ::grpc::CompletionQueue* cq) override;
const ::grpc::RpcMethod rpcmethod_SubmitCommand_;
};
static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
class Service : public ::grpc::Service {
public:
Service();
virtual ~Service();
// Sends a greeting
virtual ::grpc::Status SubmitCommand(::grpc::ServerContext* context, const ::pybullet_grpc::PyBulletCommand* request, ::pybullet_grpc::PyBulletStatus* response);
};
template <class BaseClass>
class WithAsyncMethod_SubmitCommand : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
public:
WithAsyncMethod_SubmitCommand() {
::grpc::Service::MarkMethodAsync(0);
}
~WithAsyncMethod_SubmitCommand() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status SubmitCommand(::grpc::ServerContext* context, const ::pybullet_grpc::PyBulletCommand* request, ::pybullet_grpc::PyBulletStatus* response) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
void RequestSubmitCommand(::grpc::ServerContext* context, ::pybullet_grpc::PyBulletCommand* request, ::grpc::ServerAsyncResponseWriter< ::pybullet_grpc::PyBulletStatus>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag);
}
};
typedef WithAsyncMethod_SubmitCommand<Service > AsyncService;
template <class BaseClass>
class WithGenericMethod_SubmitCommand : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
public:
WithGenericMethod_SubmitCommand() {
::grpc::Service::MarkMethodGeneric(0);
}
~WithGenericMethod_SubmitCommand() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status SubmitCommand(::grpc::ServerContext* context, const ::pybullet_grpc::PyBulletCommand* request, ::pybullet_grpc::PyBulletStatus* response) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
};
template <class BaseClass>
class WithStreamedUnaryMethod_SubmitCommand : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
public:
WithStreamedUnaryMethod_SubmitCommand() {
::grpc::Service::MarkMethodStreamed(0,
new ::grpc::StreamedUnaryHandler< ::pybullet_grpc::PyBulletCommand, ::pybullet_grpc::PyBulletStatus>(std::bind(&WithStreamedUnaryMethod_SubmitCommand<BaseClass>::StreamedSubmitCommand, this, std::placeholders::_1, std::placeholders::_2)));
}
~WithStreamedUnaryMethod_SubmitCommand() override {
BaseClassMustBeDerivedFromService(this);
}
// disable regular version of this method
::grpc::Status SubmitCommand(::grpc::ServerContext* context, const ::pybullet_grpc::PyBulletCommand* request, ::pybullet_grpc::PyBulletStatus* response) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
// replace default version of method with streamed unary
virtual ::grpc::Status StreamedSubmitCommand(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::pybullet_grpc::PyBulletCommand,::pybullet_grpc::PyBulletStatus>* server_unary_streamer) = 0;
};
typedef WithStreamedUnaryMethod_SubmitCommand<Service > StreamedUnaryService;
typedef Service SplitStreamedService;
typedef WithStreamedUnaryMethod_SubmitCommand<Service > StreamedService;
};
} // namespace pybullet_grpc
#endif // GRPC_pybullet_2eproto__INCLUDED

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,46 +0,0 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
import pybullet_pb2 as pybullet__pb2
class PyBulletAPIStub(object):
# missing associated documentation comment in .proto file
pass
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.SubmitCommand = channel.unary_unary(
'/pybullet_grpc.PyBulletAPI/SubmitCommand',
request_serializer=pybullet__pb2.PyBulletCommand.SerializeToString,
response_deserializer=pybullet__pb2.PyBulletStatus.FromString,
)
class PyBulletAPIServicer(object):
# missing associated documentation comment in .proto file
pass
def SubmitCommand(self, request, context):
"""Sends a greeting
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_PyBulletAPIServicer_to_server(servicer, server):
rpc_method_handlers = {
'SubmitCommand': grpc.unary_unary_rpc_method_handler(
servicer.SubmitCommand,
request_deserializer=pybullet__pb2.PyBulletCommand.FromString,
response_serializer=pybullet__pb2.PyBulletStatus.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'pybullet_grpc.PyBulletAPI', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))

View File

@@ -1,22 +1,21 @@
//tinyRendererPlugin implements the TinyRenderer as a plugin
//it is statically linked when using preprocessor #define STATIC_LINK_VR_PLUGIN
//otherwise you can dynamically load it using pybullet.loadPlugin
///grpcPlugin add a GRPC server to any PyBullet/BulletRobotics
///physics server. You can connect using PyBullet connect.GRPC method
#include "grpcPlugin.h"
#include "../../SharedMemoryPublic.h"
#include "SharedMemory/SharedMemoryPublic.h"
#include "../b3PluginContext.h"
#include "Bullet3Common/b3AlignedObjectArray.h"
#include "SharedMemoryCommands.h"
#include "PhysicsCommandProcessorInterface.h"
#include "SharedMemory/SharedMemoryCommands.h"
#include "SharedMemory/PhysicsCommandProcessorInterface.h"
#include <stdio.h>
#include <grpc++/grpc++.h>
#include <grpc/support/log.h>
#include "../../../Utils/b3Clock.h"
#include "../../grpc/pybullet.grpc.pb.h"
#include "../../grpc/ConvertGRPCBullet.h"
#include "SharedMemory/grpc/proto/pybullet.grpc.pb.h"
#include "SharedMemory/grpc/ConvertGRPCBullet.h"
using grpc::Server;
using grpc::ServerAsyncResponseWriter;
using grpc::ServerBuilder;
@@ -28,7 +27,7 @@ using pybullet_grpc::PyBulletStatus;
using pybullet_grpc::PyBulletAPI;
bool gVerboseNetworkMessagesServer4 = true;
bool gVerboseNetworkMessagesServer4 = false;
class ServerImpl final {
@@ -64,7 +63,7 @@ public:
cq_ = m_builder.AddCompletionQueue();
// Finally assemble the server.
server_ = m_builder.BuildAndStart();
std::cout << "Server listening on " << hostNamePort << std::endl;
std::cout << "grpcPlugin Bullet Physics GRPC server listening on " << hostNamePort << std::endl;
// Proceed to the server's main loop.
InitRpcs(comProc);
@@ -314,7 +313,7 @@ B3_SHARED_API int executePluginCommand_grpcPlugin(struct b3PluginContext* contex
grpcMyClass* obj = (grpcMyClass*)context->m_userPointer;
if (arguments->m_text && strlen(arguments->m_text))
if (strlen(arguments->m_text))
{
if (!obj->m_grpcInitialized && context->m_rpcCommandProcessorInterface)
{