Use "change" instead of "reset" for changing dynamics info.
This commit is contained in:
@@ -1240,39 +1240,39 @@ int b3GetDynamicsInfo(b3SharedMemoryStatusHandle statusHandle, struct b3Dynamics
|
||||
return true;
|
||||
}
|
||||
|
||||
b3SharedMemoryCommandHandle b3InitResetDynamicsInfo(b3PhysicsClientHandle physClient)
|
||||
b3SharedMemoryCommandHandle b3InitChangeDynamicsInfo(b3PhysicsClientHandle physClient)
|
||||
{
|
||||
PhysicsClient* cl = (PhysicsClient* ) physClient;
|
||||
b3Assert(cl);
|
||||
b3Assert(cl->canSubmitCommand());
|
||||
struct SharedMemoryCommand* command = cl->getAvailableSharedMemoryCommand();
|
||||
b3Assert(command);
|
||||
command->m_type = CMD_RESET_DYNAMICS_INFO;
|
||||
command->m_type = CMD_CHANGE_DYNAMICS_INFO;
|
||||
command->m_updateFlags = 0;
|
||||
|
||||
return (b3SharedMemoryCommandHandle) command;
|
||||
}
|
||||
|
||||
int b3ResetDynamicsInfoSetMass(b3SharedMemoryCommandHandle commandHandle, int bodyUniqueId, int linkIndex, double mass)
|
||||
int b3ChangeDynamicsInfoSetMass(b3SharedMemoryCommandHandle commandHandle, int bodyUniqueId, int linkIndex, double mass)
|
||||
{
|
||||
struct SharedMemoryCommand* command = (struct SharedMemoryCommand*) commandHandle;
|
||||
b3Assert(command->m_type == CMD_RESET_DYNAMICS_INFO);
|
||||
b3Assert(command->m_type == CMD_CHANGE_DYNAMICS_INFO);
|
||||
b3Assert(mass > 0);
|
||||
command->m_resetDynamicsInfoArgs.m_bodyUniqueId = bodyUniqueId;
|
||||
command->m_resetDynamicsInfoArgs.m_linkIndex = linkIndex;
|
||||
command->m_resetDynamicsInfoArgs.m_mass = mass;
|
||||
command->m_updateFlags |= RESET_DYNAMICS_INFO_SET_MASS;
|
||||
command->m_changeDynamicsInfoArgs.m_bodyUniqueId = bodyUniqueId;
|
||||
command->m_changeDynamicsInfoArgs.m_linkIndex = linkIndex;
|
||||
command->m_changeDynamicsInfoArgs.m_mass = mass;
|
||||
command->m_updateFlags |= CHANGE_DYNAMICS_INFO_SET_MASS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int b3ResetDynamicsInfoSetLateralFriction(b3SharedMemoryCommandHandle commandHandle, int bodyUniqueId, int linkIndex, double lateralFriction)
|
||||
int b3ChangeDynamicsInfoSetLateralFriction(b3SharedMemoryCommandHandle commandHandle, int bodyUniqueId, int linkIndex, double lateralFriction)
|
||||
{
|
||||
struct SharedMemoryCommand* command = (struct SharedMemoryCommand*) commandHandle;
|
||||
b3Assert(command->m_type == CMD_RESET_DYNAMICS_INFO);
|
||||
command->m_resetDynamicsInfoArgs.m_bodyUniqueId = bodyUniqueId;
|
||||
command->m_resetDynamicsInfoArgs.m_linkIndex = linkIndex;
|
||||
command->m_resetDynamicsInfoArgs.m_lateralFriction = lateralFriction;
|
||||
command->m_updateFlags |= RESET_DYNAMICS_INFO_SET_LATERAL_FRICTION;
|
||||
b3Assert(command->m_type == CMD_CHANGE_DYNAMICS_INFO);
|
||||
command->m_changeDynamicsInfoArgs.m_bodyUniqueId = bodyUniqueId;
|
||||
command->m_changeDynamicsInfoArgs.m_linkIndex = linkIndex;
|
||||
command->m_changeDynamicsInfoArgs.m_lateralFriction = lateralFriction;
|
||||
command->m_updateFlags |= CHANGE_DYNAMICS_INFO_SET_LATERAL_FRICTION;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,12 +78,12 @@ int b3GetNumJoints(b3PhysicsClientHandle physClient, int bodyIndex);
|
||||
int b3GetJointInfo(b3PhysicsClientHandle physClient, int bodyIndex, int jointIndex, struct b3JointInfo* info);
|
||||
|
||||
b3SharedMemoryCommandHandle b3GetDynamicsInfoCommandInit(b3PhysicsClientHandle physClient, int bodyUniqueId, int linkIndex);
|
||||
///given a body unique id and link index, return the dynamic information. See b3DynamicInfo in SharedMemoryPublic.h
|
||||
///given a body unique id and link index, return the dynamics information. See b3DynamicsInfo in SharedMemoryPublic.h
|
||||
int b3GetDynamicsInfo(b3SharedMemoryStatusHandle statusHandle, struct b3DynamicsInfo* info);
|
||||
|
||||
b3SharedMemoryCommandHandle b3InitResetDynamicsInfo(b3PhysicsClientHandle physClient);
|
||||
int b3ResetDynamicsInfoSetMass(b3SharedMemoryCommandHandle commandHandle, int bodyUniqueId, int linkIndex, double mass);
|
||||
int b3ResetDynamicsInfoSetLateralFriction(b3SharedMemoryCommandHandle commandHandle, int bodyUniqueId, int linkIndex, double lateralFriction);
|
||||
b3SharedMemoryCommandHandle b3InitChangeDynamicsInfo(b3PhysicsClientHandle physClient);
|
||||
int b3ChangeDynamicsInfoSetMass(b3SharedMemoryCommandHandle commandHandle, int bodyUniqueId, int linkIndex, double mass);
|
||||
int b3ChangeDynamicsInfoSetLateralFriction(b3SharedMemoryCommandHandle commandHandle, int bodyUniqueId, int linkIndex, double lateralFriction);
|
||||
|
||||
b3SharedMemoryCommandHandle b3InitCreateUserConstraintCommand(b3PhysicsClientHandle physClient, int parentBodyIndex, int parentJointIndex, int childBodyIndex, int childJointIndex, struct b3JointInfo* info);
|
||||
|
||||
|
||||
@@ -1045,7 +1045,7 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus() {
|
||||
}
|
||||
case CMD_GET_DYNAMICS_INFO_FAILED:
|
||||
{
|
||||
b3Warning("Request dynamic info failed");
|
||||
b3Warning("Request dynamics info failed");
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
||||
@@ -3898,15 +3898,15 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
|
||||
break;
|
||||
};
|
||||
case CMD_RESET_DYNAMICS_INFO:
|
||||
case CMD_CHANGE_DYNAMICS_INFO:
|
||||
{
|
||||
BT_PROFILE("CMD_RESET_DYNAMICS_INFO");
|
||||
BT_PROFILE("CMD_CHANGE_DYNAMICS_INFO");
|
||||
|
||||
if (clientCmd.m_updateFlags & RESET_DYNAMICS_INFO_SET_MASS)
|
||||
if (clientCmd.m_updateFlags & CHANGE_DYNAMICS_INFO_SET_MASS)
|
||||
{
|
||||
int bodyUniqueId = clientCmd.m_resetDynamicsInfoArgs.m_bodyUniqueId;
|
||||
int linkIndex = clientCmd.m_resetDynamicsInfoArgs.m_linkIndex;
|
||||
double mass = clientCmd.m_resetDynamicsInfoArgs.m_mass;
|
||||
int bodyUniqueId = clientCmd.m_changeDynamicsInfoArgs.m_bodyUniqueId;
|
||||
int linkIndex = clientCmd.m_changeDynamicsInfoArgs.m_linkIndex;
|
||||
double mass = clientCmd.m_changeDynamicsInfoArgs.m_mass;
|
||||
btAssert(bodyUniqueId >= 0);
|
||||
btAssert(linkIndex >= -1);
|
||||
|
||||
@@ -3925,11 +3925,11 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
}
|
||||
}
|
||||
|
||||
if (clientCmd.m_updateFlags & RESET_DYNAMICS_INFO_SET_LATERAL_FRICTION)
|
||||
if (clientCmd.m_updateFlags & CHANGE_DYNAMICS_INFO_SET_LATERAL_FRICTION)
|
||||
{
|
||||
int bodyUniqueId = clientCmd.m_resetDynamicsInfoArgs.m_bodyUniqueId;
|
||||
int linkIndex = clientCmd.m_resetDynamicsInfoArgs.m_linkIndex;
|
||||
double lateralFriction = clientCmd.m_resetDynamicsInfoArgs.m_lateralFriction;
|
||||
int bodyUniqueId = clientCmd.m_changeDynamicsInfoArgs.m_bodyUniqueId;
|
||||
int linkIndex = clientCmd.m_changeDynamicsInfoArgs.m_linkIndex;
|
||||
double lateralFriction = clientCmd.m_changeDynamicsInfoArgs.m_lateralFriction;
|
||||
btAssert(bodyUniqueId >= 0);
|
||||
btAssert(linkIndex >= -1);
|
||||
|
||||
|
||||
@@ -106,14 +106,14 @@ struct BulletDataStreamArgs
|
||||
char m_bodyName[MAX_FILENAME_LENGTH];
|
||||
};
|
||||
|
||||
enum EnumResetDynamicsInfoFlags
|
||||
enum EnumChangeDynamicsInfoFlags
|
||||
{
|
||||
RESET_DYNAMICS_INFO_SET_MASS=1,
|
||||
RESET_DYNAMICS_INFO_SET_COM=2,
|
||||
RESET_DYNAMICS_INFO_SET_LATERAL_FRICTION=4,
|
||||
CHANGE_DYNAMICS_INFO_SET_MASS=1,
|
||||
CHANGE_DYNAMICS_INFO_SET_COM=2,
|
||||
CHANGE_DYNAMICS_INFO_SET_LATERAL_FRICTION=4,
|
||||
};
|
||||
|
||||
struct ResetDynamicsInfoArgs
|
||||
struct ChangeDynamicsInfoArgs
|
||||
{
|
||||
int m_bodyUniqueId;
|
||||
int m_linkIndex;
|
||||
@@ -744,7 +744,7 @@ struct SharedMemoryCommand
|
||||
struct MjcfArgs m_mjcfArguments;
|
||||
struct FileArgs m_fileArguments;
|
||||
struct SdfRequestInfoArgs m_sdfRequestInfoArgs;
|
||||
struct ResetDynamicsInfoArgs m_resetDynamicsInfoArgs;
|
||||
struct ChangeDynamicsInfoArgs m_changeDynamicsInfoArgs;
|
||||
struct GetDynamicsInfoArgs m_getDynamicsInfoArgs;
|
||||
struct InitPoseArgs m_initPoseArgs;
|
||||
struct SendPhysicsSimulationParameters m_physSimParamArgs;
|
||||
|
||||
@@ -56,7 +56,7 @@ enum EnumSharedMemoryClientCommand
|
||||
CMD_REQUEST_KEYBOARD_EVENTS_DATA,
|
||||
CMD_REQUEST_OPENGL_VISUALIZER_CAMERA,
|
||||
CMD_REMOVE_BODY,
|
||||
CMD_RESET_DYNAMICS_INFO,
|
||||
CMD_CHANGE_DYNAMICS_INFO,
|
||||
CMD_GET_DYNAMICS_INFO,
|
||||
CMD_PROFILE_TIMING,
|
||||
//don't go beyond this command!
|
||||
|
||||
Reference in New Issue
Block a user