Log time stamp and step count.
This commit is contained in:
@@ -578,6 +578,7 @@ struct GenericRobotStateLogger : public InternalStateLogger
|
||||
m_loggingType = STATE_LOGGING_GENERIC_ROBOT;
|
||||
|
||||
btAlignedObjectArray<std::string> structNames;
|
||||
structNames.push_back("stepCount");
|
||||
structNames.push_back("timeStamp");
|
||||
structNames.push_back("objectId");
|
||||
structNames.push_back("posX");
|
||||
@@ -619,7 +620,7 @@ struct GenericRobotStateLogger : public InternalStateLogger
|
||||
structNames.push_back("u10");
|
||||
structNames.push_back("u11");
|
||||
|
||||
m_structTypes = "fIfffffffffffffIffffffffffffffffffffffff";
|
||||
m_structTypes = "IfIfffffffffffffIffffffffffffffffffffffff";
|
||||
const char* fileNameC = fileName.c_str();
|
||||
|
||||
m_logFileHandle = createMinitaurLogFile(fileNameC, structNames, m_structTypes);
|
||||
@@ -647,7 +648,10 @@ struct GenericRobotStateLogger : public InternalStateLogger
|
||||
}
|
||||
|
||||
MinitaurLogRecord logData;
|
||||
logData.m_values.push_back(m_loggingTimeStamp);
|
||||
int stepCount = m_loggingTimeStamp;
|
||||
float timeStamp = m_loggingTimeStamp*m_dynamicsWorld->getSolverInfo().m_timeStep;
|
||||
logData.m_values.push_back(stepCount);
|
||||
logData.m_values.push_back(timeStamp);
|
||||
|
||||
btVector3 pos = mb->getBasePos();
|
||||
btQuaternion ori = mb->getWorldToBaseRot().inverse();
|
||||
|
||||
@@ -67,14 +67,14 @@ print('item num:'),
|
||||
print(itemNum)
|
||||
|
||||
for record in log:
|
||||
Id = record[1]
|
||||
pos = [record[2],record[3],record[4]]
|
||||
orn = [record[5],record[6],record[7],record[8]]
|
||||
Id = record[2]
|
||||
pos = [record[3],record[4],record[5]]
|
||||
orn = [record[6],record[7],record[8],record[9]]
|
||||
p.resetBasePositionAndOrientation(Id,pos,orn)
|
||||
numJoints = p.getNumJoints(Id)
|
||||
for i in range (numJoints):
|
||||
jointInfo = p.getJointInfo(Id,i)
|
||||
qIndex = jointInfo[3]
|
||||
if qIndex > -1:
|
||||
p.resetJointState(Id,i,record[qIndex-7+16])
|
||||
p.resetJointState(Id,i,record[qIndex-7+17])
|
||||
sleep(0.0005)
|
||||
Reference in New Issue
Block a user