more fixes in pybullet_gym envs/data.

implement pybullet.setAdditionalSearchPath
This commit is contained in:
Erwin Coumans
2017-08-27 19:34:00 -07:00
parent d9faea8c1c
commit 1569f3845c
18 changed files with 151 additions and 197 deletions

View File

@@ -3768,6 +3768,7 @@ void b3SetTimeOut(b3PhysicsClientHandle physClient, double timeOutInSeconds)
}
double b3GetTimeOut(b3PhysicsClientHandle physClient)
{
PhysicsClient* cl = (PhysicsClient*)physClient;
@@ -3779,6 +3780,25 @@ double b3GetTimeOut(b3PhysicsClientHandle physClient)
return -1;
}
b3SharedMemoryCommandHandle b3SetAdditionalSearchPath(b3PhysicsClientHandle physClient, char* path)
{
PhysicsClient* cl = (PhysicsClient*)physClient;
b3Assert(cl);
b3Assert(cl->canSubmitCommand());
struct SharedMemoryCommand* command = cl->getAvailableSharedMemoryCommand();
b3Assert(command);
command->m_type = CMD_SET_ADDITIONAL_SEARCH_PATH;
command->m_updateFlags = 0;
int len = strlen(path);
if (len<MAX_FILENAME_LENGTH)
{
strcpy(command->m_searchPathArgs.m_path,path);
}
return (b3SharedMemoryCommandHandle)command;
}
void b3MultiplyTransforms(const double posA[3], const double ornA[4], const double posB[3], const double ornB[4], double outPos[3], double outOrn[4])
{
b3Transform trA;

View File

@@ -482,6 +482,8 @@ void b3SetProfileTimingDuractionInMicroSeconds(b3SharedMemoryCommandHandle comma
void b3SetTimeOut(b3PhysicsClientHandle physClient, double timeOutInSeconds);
double b3GetTimeOut(b3PhysicsClientHandle physClient);
b3SharedMemoryCommandHandle b3SetAdditionalSearchPath(b3PhysicsClientHandle physClient, char* path);
void b3MultiplyTransforms(const double posA[3], const double ornA[4], const double posB[3], const double ornB[4], double outPos[3], double outOrn[4]);
void b3InvertTransform(const double pos[3], const double orn[4], double outPos[3], double outOrn[4]);

View File

@@ -4001,6 +4001,14 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
}
break;
}
case CMD_SET_ADDITIONAL_SEARCH_PATH:
{
BT_PROFILE("CMD_SET_ADDITIONAL_SEARCH_PATH");
b3ResourcePath::setAdditionalSearchPath(clientCmd.m_searchPathArgs.m_path);
serverStatusOut.m_type = CMD_CLIENT_COMMAND_COMPLETED;
hasStatus = true;
break;
}
case CMD_LOAD_URDF:
{
BT_PROFILE("CMD_LOAD_URDF");

View File

@@ -1,4 +1,3 @@
#ifndef SHARED_MEMORY_COMMANDS_H
#define SHARED_MEMORY_COMMANDS_H
@@ -105,6 +104,12 @@ struct MjcfArgs
int m_flags;
};
struct b3SearchPathfArgs
{
char m_path[MAX_FILENAME_LENGTH];
};
struct BulletDataStreamArgs
{
char m_bulletFileName[MAX_FILENAME_LENGTH];
@@ -960,6 +965,7 @@ struct SharedMemoryCommand
struct b3CreateMultiBodyArgs m_createMultiBodyArgs;
struct b3RequestCollisionInfoArgs m_requestCollisionInfoArgs;
struct b3ChangeTextureArgs m_changeTextureArgs;
struct b3SearchPathfArgs m_searchPathArgs;
};
};

View File

@@ -4,7 +4,9 @@
#define SHARED_MEMORY_KEY 12347
///increase the SHARED_MEMORY_MAGIC_NUMBER whenever incompatible changes are made in the structures
///my convention is year/month/day/rev
#define SHARED_MEMORY_MAGIC_NUMBER 201707140
#define SHARED_MEMORY_MAGIC_NUMBER 201708270
//#define SHARED_MEMORY_MAGIC_NUMBER 201707140
//#define SHARED_MEMORY_MAGIC_NUMBER 201706015
//#define SHARED_MEMORY_MAGIC_NUMBER 201706001
//#define SHARED_MEMORY_MAGIC_NUMBER 201703024
@@ -69,6 +71,7 @@ enum EnumSharedMemoryClientCommand
CMD_REQUEST_COLLISION_INFO,
CMD_REQUEST_MOUSE_EVENTS_DATA,
CMD_CHANGE_TEXTURE,
CMD_SET_ADDITIONAL_SEARCH_PATH,
//don't go beyond this command!
CMD_MAX_CLIENT_COMMANDS,