COLLADA 1.5 kinematics

Hello everyone !

yes, I think

As far as I’m concerned, I would like to write a function that returns which visual_node/node belongs to which link and the join of the link. I am using ColladaDom. I tried but it didn’t manage.

For example :

I have this visual scene

<visual_scene id="VISUAL_SCENE">
	<node id="GREIFER">
		<node id="OBERARM">
		<node id="UNTERARM">
		<node id="SCHWENKER1">
		<node id="SCHWENKER2">

these links :

<link name="link1">
	<attachment_full joint="KIN_GREIFER/j1">
		<translate>525 0 0</translate>
		<link name="link2">
			<attachment_full joint="KIN_GREIFER/j2">
				<translate>525 0 0</translate>
			<attachment_full joint="KIN_GREIFER/j3">
				<translate>525 0 0</translate>
				<rotate>1 0 0 180</rotate>

and this

<instance_kinematics_scene url="#KIN_SCENE">
	<bind_kinematics_model node="OBERARM">
	<bind_joint_axis target="UNTERARM/j1_axis">
	<bind_joint_axis target="SCHWENKER1/j1_axis">
	<bind_joint_axis target="SCHWENKER1/j2_axis">
	<bind_joint_axis target="SCHWENKER2/j1_axis">
	<bind_joint_axis target="SCHWENKER2/j3_axis">

If I give the parameter UNTERARM to the function, it returns <link name=“link1”> or <attachment_full joint=“KIN_GREIFER/j1”>
If I give the parameter SCHWENKER1 to the function, it returns <link name=“link2”> or <attachment_full joint=“KIN_GREIFER/j2”>
If I give the parameter SCHWENKER2 to the function, it returns <link name=“link2”> or <attachment_full joint=“KIN_GREIFER/j3”>

I know that :[ul]
[li]with <bind_joint_axis target=“UNTERARM/j1_axis”> I can reach the element <node id=“UNTERARM”> (Using daeSidRef(bind_joint->getTarget(), visual_instance_scene->getUrl().getElement()).resolve().elt))[/:m:2k0da5qi][/li][li]with <param>param.j1.axis</param>, I can reach the element <newparam sid=“param.j1.axis”> in the <instance_kinematics_model url="#KIN_GREIFER" sid=“inst_kin_greifer”>[/:m:2k0da5qi][/ul][/li]
How can I code this function ? Thanks for help ! :smiley:

OpenRAVE’s collada reader has a function called ExtractKinematicsVisualBindings which does something similar. The function itself is pretty isolated from the rest of the code, so you can copy it and use it for your own purposes, as long as you follow the LGPL license. … reader.cpp