report localVisualFrame instead localInertialFrame
This commit is contained in:
@@ -329,7 +329,7 @@ struct b3VisualShapeData
|
|||||||
int m_visualGeometryType;//box primitive, sphere primitive, triangle mesh
|
int m_visualGeometryType;//box primitive, sphere primitive, triangle mesh
|
||||||
double m_dimensions[3];//meaning depends on m_visualGeometryType
|
double m_dimensions[3];//meaning depends on m_visualGeometryType
|
||||||
char m_meshAssetFileName[VISUAL_SHAPE_MAX_PATH_LEN];
|
char m_meshAssetFileName[VISUAL_SHAPE_MAX_PATH_LEN];
|
||||||
double m_localInertiaFrame[7];//pos[3], orn[4]
|
double m_localVisualFrame[7];//pos[3], orn[4]
|
||||||
//todo: add more data if necessary (material color etc, although material can be in asset file .obj file)
|
//todo: add more data if necessary (material color etc, although material can be in asset file .obj file)
|
||||||
double m_rgbaColor[4];
|
double m_rgbaColor[4];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -289,6 +289,13 @@ void convertURDFToVisualShape(const UrdfVisual* visual, const char* urdfPathPref
|
|||||||
visualShapeOut.m_dimensions[0] = visual->m_geometry.m_meshScale[0];
|
visualShapeOut.m_dimensions[0] = visual->m_geometry.m_meshScale[0];
|
||||||
visualShapeOut.m_dimensions[1] = visual->m_geometry.m_meshScale[1];
|
visualShapeOut.m_dimensions[1] = visual->m_geometry.m_meshScale[1];
|
||||||
visualShapeOut.m_dimensions[2] = visual->m_geometry.m_meshScale[2];
|
visualShapeOut.m_dimensions[2] = visual->m_geometry.m_meshScale[2];
|
||||||
|
visualShapeOut.m_localVisualFrame[0] = visual->m_linkLocalFrame.getOrigin()[0];
|
||||||
|
visualShapeOut.m_localVisualFrame[1] = visual->m_linkLocalFrame.getOrigin()[1];
|
||||||
|
visualShapeOut.m_localVisualFrame[2] = visual->m_linkLocalFrame.getOrigin()[2];
|
||||||
|
visualShapeOut.m_localVisualFrame[3] = visual->m_linkLocalFrame.getRotation()[0];
|
||||||
|
visualShapeOut.m_localVisualFrame[4] = visual->m_linkLocalFrame.getRotation()[1];
|
||||||
|
visualShapeOut.m_localVisualFrame[5] = visual->m_linkLocalFrame.getRotation()[2];
|
||||||
|
visualShapeOut.m_localVisualFrame[6] = visual->m_linkLocalFrame.getRotation()[3];
|
||||||
|
|
||||||
int sl = strlen(fullPath);
|
int sl = strlen(fullPath);
|
||||||
if (sl < (VISUAL_SHAPE_MAX_PATH_LEN-1))
|
if (sl < (VISUAL_SHAPE_MAX_PATH_LEN-1))
|
||||||
@@ -550,7 +557,7 @@ void TinyRendererVisualShapeConverter::convertVisualShapes(int linkIndex, const
|
|||||||
|
|
||||||
const UrdfLink* link = *linkPtr;
|
const UrdfLink* link = *linkPtr;
|
||||||
|
|
||||||
for (int v = 0; v < link->m_visualArray.size();v++)
|
for (int v1 = 0; v1 < link->m_visualArray.size();v1++)
|
||||||
{
|
{
|
||||||
btAlignedObjectArray<MyTexture2> textures;
|
btAlignedObjectArray<MyTexture2> textures;
|
||||||
btAlignedObjectArray<GLInstanceVertex> vertices;
|
btAlignedObjectArray<GLInstanceVertex> vertices;
|
||||||
@@ -558,7 +565,7 @@ void TinyRendererVisualShapeConverter::convertVisualShapes(int linkIndex, const
|
|||||||
btTransform startTrans; startTrans.setIdentity();
|
btTransform startTrans; startTrans.setIdentity();
|
||||||
//int graphicsIndex = -1;
|
//int graphicsIndex = -1;
|
||||||
|
|
||||||
const UrdfVisual& vis = link->m_visualArray[v];
|
const UrdfVisual& vis = link->m_visualArray[v1];
|
||||||
btTransform childTrans = vis.m_linkLocalFrame;
|
btTransform childTrans = vis.m_linkLocalFrame;
|
||||||
btHashString matName(vis.m_materialName.c_str());
|
btHashString matName(vis.m_materialName.c_str());
|
||||||
UrdfMaterial *const * matPtr = model.m_materials[matName];
|
UrdfMaterial *const * matPtr = model.m_materials[matName];
|
||||||
@@ -586,13 +593,13 @@ void TinyRendererVisualShapeConverter::convertVisualShapes(int linkIndex, const
|
|||||||
b3VisualShapeData visualShape;
|
b3VisualShapeData visualShape;
|
||||||
visualShape.m_objectUniqueId = bodyUniqueId;
|
visualShape.m_objectUniqueId = bodyUniqueId;
|
||||||
visualShape.m_linkIndex = linkIndex;
|
visualShape.m_linkIndex = linkIndex;
|
||||||
visualShape.m_localInertiaFrame[0] = localInertiaFrame.getOrigin()[0];
|
visualShape.m_localVisualFrame[0] = vis.m_linkLocalFrame.getOrigin()[0];
|
||||||
visualShape.m_localInertiaFrame[1] = localInertiaFrame.getOrigin()[1];
|
visualShape.m_localVisualFrame[1] = vis.m_linkLocalFrame.getOrigin()[1];
|
||||||
visualShape.m_localInertiaFrame[2] = localInertiaFrame.getOrigin()[2];
|
visualShape.m_localVisualFrame[2] = vis.m_linkLocalFrame.getOrigin()[2];
|
||||||
visualShape.m_localInertiaFrame[3] = localInertiaFrame.getRotation()[0];
|
visualShape.m_localVisualFrame[3] = vis.m_linkLocalFrame.getRotation()[0];
|
||||||
visualShape.m_localInertiaFrame[4] = localInertiaFrame.getRotation()[1];
|
visualShape.m_localVisualFrame[4] = vis.m_linkLocalFrame.getRotation()[1];
|
||||||
visualShape.m_localInertiaFrame[5] = localInertiaFrame.getRotation()[2];
|
visualShape.m_localVisualFrame[5] = vis.m_linkLocalFrame.getRotation()[2];
|
||||||
visualShape.m_localInertiaFrame[6] = localInertiaFrame.getRotation()[3];
|
visualShape.m_localVisualFrame[6] = vis.m_linkLocalFrame.getRotation()[3];
|
||||||
visualShape.m_rgbaColor[0] = rgbaColor[0];
|
visualShape.m_rgbaColor[0] = rgbaColor[0];
|
||||||
visualShape.m_rgbaColor[1] = rgbaColor[1];
|
visualShape.m_rgbaColor[1] = rgbaColor[1];
|
||||||
visualShape.m_rgbaColor[2] = rgbaColor[2];
|
visualShape.m_rgbaColor[2] = rgbaColor[2];
|
||||||
|
|||||||
@@ -2931,24 +2931,24 @@ static PyObject* pybullet_getVisualShapeData(PyObject* self, PyObject* args, PyO
|
|||||||
|
|
||||||
{
|
{
|
||||||
PyObject* vec = PyTuple_New(3);
|
PyObject* vec = PyTuple_New(3);
|
||||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localInertiaFrame[0]);
|
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localVisualFrame[0]);
|
||||||
PyTuple_SetItem(vec, 0, item);
|
PyTuple_SetItem(vec, 0, item);
|
||||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localInertiaFrame[1]);
|
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localVisualFrame[1]);
|
||||||
PyTuple_SetItem(vec, 1, item);
|
PyTuple_SetItem(vec, 1, item);
|
||||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localInertiaFrame[2]);
|
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localVisualFrame[2]);
|
||||||
PyTuple_SetItem(vec, 2, item);
|
PyTuple_SetItem(vec, 2, item);
|
||||||
PyTuple_SetItem(visualShapeObList, 5, vec);
|
PyTuple_SetItem(visualShapeObList, 5, vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
PyObject* vec = PyTuple_New(4);
|
PyObject* vec = PyTuple_New(4);
|
||||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localInertiaFrame[3]);
|
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localVisualFrame[3]);
|
||||||
PyTuple_SetItem(vec, 0, item);
|
PyTuple_SetItem(vec, 0, item);
|
||||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localInertiaFrame[4]);
|
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localVisualFrame[4]);
|
||||||
PyTuple_SetItem(vec, 1, item);
|
PyTuple_SetItem(vec, 1, item);
|
||||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localInertiaFrame[5]);
|
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localVisualFrame[5]);
|
||||||
PyTuple_SetItem(vec, 2, item);
|
PyTuple_SetItem(vec, 2, item);
|
||||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localInertiaFrame[6]);
|
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localVisualFrame[6]);
|
||||||
PyTuple_SetItem(vec, 3, item);
|
PyTuple_SetItem(vec, 3, item);
|
||||||
PyTuple_SetItem(visualShapeObList, 6, vec);
|
PyTuple_SetItem(visualShapeObList, 6, vec);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user