small improvement to the shared memory physics server/client

This commit is contained in:
=
2015-05-28 17:49:55 -07:00
parent 82576d0bee
commit 7abefca6f1
4 changed files with 96 additions and 22 deletions

View File

@@ -1,7 +1,7 @@
#ifndef SHARED_MEMORY_INTERFACE_H
#define SHARED_MEMORY_INTERFACE_H
#define SHARED_MEMORY_KEY 12345
#define SHARED_MEMORY_KEY 12347
#define SHARED_MEMORY_MAGIC_NUMBER 64738
#define SHARED_MEMORY_MAX_COMMANDS 64
@@ -26,17 +26,33 @@ enum SharedMemoryClientCommand{
#define MAX_NUM_SENSORS 1024
#define MAX_URDF_FILENAME_LENGTH 1024
struct CommandArguments
struct UrdfCommandArgument
{
char m_urdfFileName[MAX_URDF_FILENAME_LENGTH];
};
struct StepSimulationCommandArgument
{
double m_deltaTimeInSeconds;
char m_urdfFileName[MAX_URDF_FILENAME_LENGTH];
};
struct SharedMemoryCommand
{
int m_type;
union
{
UrdfCommandArgument m_urdfArguments;
StepSimulationCommandArgument m_stepSimulationArguments;
};
};
struct SharedMemoryExampleData
{
int m_magicId;
int m_clientCommands[SHARED_MEMORY_MAX_COMMANDS];
int m_serverCommands[SHARED_MEMORY_MAX_COMMANDS];
SharedMemoryCommand m_clientCommands[SHARED_MEMORY_MAX_COMMANDS];
SharedMemoryCommand m_serverCommands[SHARED_MEMORY_MAX_COMMANDS];
int m_numClientCommands;
int m_numProcessedClientCommands;
@@ -44,13 +60,17 @@ struct SharedMemoryExampleData
int m_numServerCommands;
int m_numProcessedServerCommands;
//desired state is only written by the client, read-only access by server is expected
double m_desiredStateQ[MAX_DEGREE_OF_FREEDOM];
double m_desiredStateQdot[MAX_DEGREE_OF_FREEDOM];
double m_desiredStateSensors[MAX_NUM_SENSORS];//these are force sensors and IMU information
double m_stateQ[MAX_DEGREE_OF_FREEDOM];
double m_stateQdot[MAX_DEGREE_OF_FREEDOM];
double m_stateSensors[MAX_NUM_SENSORS];//these are force sensors and IMU information
//actual state is only written by the server, read-only access by client is expected
double m_actualStateQ[MAX_DEGREE_OF_FREEDOM];
double m_actualStateQdot[MAX_DEGREE_OF_FREEDOM];
double m_actualStateSensors[MAX_NUM_SENSORS];//these are force sensors and IMU information
CommandArguments m_clientCommandArguments[SHARED_MEMORY_MAX_COMMANDS];
CommandArguments m_serverCommandArguments[SHARED_MEMORY_MAX_COMMANDS];
};