Add preliminary GRPC server for PyBullet and BulletRobotics.

Will add GRPC client and PyBullet GRPC server plugin.
Will cover most/all SharedMemoryCommand/SharedMemoryStatus messages.
Run the server, then test using the pybullet_client.py
This commit is contained in:
erwincoumans
2018-08-29 21:12:13 -07:00
parent 65175425b0
commit 4f7dfc2069
18 changed files with 6556 additions and 29 deletions

View File

@@ -0,0 +1,19 @@
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
..\..\..\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

@@ -0,0 +1,85 @@
syntax = "proto3";
option java_multiple_files = true;
option java_package = "io.grpc.pybullet_grpc";
option java_outer_classname = "PyBulletProto";
option objc_class_prefix = "PBG";
package pybullet_grpc;
service PyBulletAPI {
// Sends a greeting
rpc SubmitCommand (PyBulletCommand) returns (PyBulletStatus) {}
}
message vec3
{
double x=1;
double y=2;
double z=3;
};
message quat4
{
double x=1;
double y=2;
double z=3;
double w=4;
};
message TerminateServerCommand
{
string exitReason=1;
};
message StepSimulationCommand
{
};
message LoadUrdfCommand {
string urdfFileName=1;
vec3 initialPosition=2;
quat4 initialOrientation=3;
//for why oneof here, see the sad decision here:
//https://github.com/protocolbuffers/protobuf/issues/1606
oneof hasUseMultiBody { int32 useMultiBody=4; }
oneof hasUseFixedBase{ bool useFixedBase=5; }
int32 urdfFlags=6;
oneof hasGlobalScaling { double globalScaling=7;
}
};
message LoadUrdfStatus {
int32 objectUniqueId=1;
}
// The request message containing the command
message PyBulletCommand {
int32 commandType=1;
oneof commands {
LoadUrdfCommand loadUrdfCommand = 3;
TerminateServerCommand terminateServerCommand=4;
StepSimulationCommand stepSimulationCommand= 5;
}
}
// The response message containing the status
message PyBulletStatus {
int32 statusType=1;
oneof status
{
LoadUrdfStatus urdfStatus = 2;
}
}