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:
29
examples/SharedMemory/plugins/grpcPlugin/grpcPlugin.h
Normal file
29
examples/SharedMemory/plugins/grpcPlugin/grpcPlugin.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef GRPC_PLUGIN_H
|
||||
#define GRPC_PLUGIN_H
|
||||
|
||||
#include "../b3PluginAPI.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//the following 3 APIs are required
|
||||
B3_SHARED_API int initPlugin_grpcPlugin(struct b3PluginContext* context);
|
||||
B3_SHARED_API void exitPlugin_grpcPlugin(struct b3PluginContext* context);
|
||||
B3_SHARED_API int executePluginCommand_grpcPlugin(struct b3PluginContext* context, const struct b3PluginArguments* arguments);
|
||||
|
||||
//all the APIs below are optional
|
||||
B3_SHARED_API int preTickPluginCallback_grpcPlugin(struct b3PluginContext* context);
|
||||
B3_SHARED_API int postTickPluginCallback_grpcPlugin(struct b3PluginContext* context);
|
||||
|
||||
B3_SHARED_API int processClientCommands_grpcPlugin(struct b3PluginContext* context);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif//#define GRPC_PLUGIN_H
|
||||
Reference in New Issue
Block a user