allow pybullet to connect to GRPC server. (need to use flag --enable_grpc in premake build system)

add grpcPlugin, it can work in GUI, SHARED_MEMORY_SERVER, DIRECT and other modes.
example script to start server from pybullet:
import pybullet as p
p.connect(p.GUI)
#if statically linked plugin
id = p.loadPlugin("grpcPlugin")
#dynamics loading the plugin
#id = p.loadPlugin("E:/develop/bullet3/bin/pybullet_grpcPlugin_vs2010_x64_debug.dll", postFix="_grpcPlugin")

#start the GRPC server at hostname, port
if (id>=0):
	p.executePluginCommand(id, "localhost:1234")

Only in DIRECT mode, since there is no 'ping' you need to call to handle RCPs:
numRPC = 10
while (1):
	p.executePluginCommand(id, intArgs=[numRPC])
This commit is contained in:
erwincoumans
2018-09-05 17:58:14 -07:00
parent 31b06f508a
commit 0efc67841d
22 changed files with 11620 additions and 8387 deletions

View File

@@ -3,6 +3,13 @@
#include "plugins/b3PluginAPI.h"
enum b3PluginManagerTickMode
{
B3_PRE_TICK_MODE=1,
B3_POST_TICK_MODE,
B3_PROCESS_CLIENT_COMMANDS_TICK,
};
class b3PluginManager
{
struct b3PluginManagerInternalData* m_data;
@@ -20,11 +27,10 @@ class b3PluginManager
void addNotification(const struct b3Notification& notification);
void reportNotifications();
void tickPlugins(double timeStep, bool isPreTick);
int registerStaticLinkedPlugin(const char* pluginPath, PFN_INIT initFunc,PFN_EXIT exitFunc, PFN_EXECUTE executeCommandFunc, PFN_TICK preTickFunc, PFN_TICK postTickFunc, PFN_GET_RENDER_INTERFACE getRendererFunc);
void tickPlugins(double timeStep, b3PluginManagerTickMode tickMode);
int registerStaticLinkedPlugin(const char* pluginPath, PFN_INIT initFunc, PFN_EXIT exitFunc, PFN_EXECUTE executeCommandFunc, PFN_TICK preTickFunc, PFN_TICK postTickFunc, PFN_GET_RENDER_INTERFACE getRendererFunc, PFN_TICK processClientCommandsFunc);
void selectPluginRenderer(int pluginUniqueId);
UrdfRenderingInterface* getRenderInterface();
};