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])
31 lines
731 B
C++
31 lines
731 B
C++
#ifndef B3_PLUGIN_CONTEXT_H
|
|
#define B3_PLUGIN_CONTEXT_H
|
|
|
|
#include "../PhysicsClientC_API.h"
|
|
|
|
struct b3PluginContext
|
|
{
|
|
b3PhysicsClientHandle m_physClient;
|
|
|
|
//plugin can modify the m_userPointer to store persistent object pointer (class or struct instance etc)
|
|
void* m_userPointer;
|
|
|
|
const struct b3VRControllerEvent* m_vrControllerEvents;
|
|
int m_numVRControllerEvents;
|
|
const struct b3KeyboardEvent* m_keyEvents;
|
|
int m_numKeyEvents;
|
|
const struct b3MouseEvent* m_mouseEvents;
|
|
int m_numMouseEvents;
|
|
const struct b3Notification* m_notifications;
|
|
int m_numNotifications;
|
|
|
|
//only used for grpc/processClientCommands
|
|
class PhysicsCommandProcessorInterface* m_rpcCommandProcessorInterface;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif //B3_PLUGIN_CONTEXT_H
|