rdiankov / openrave

Open Robotics Automation Virtual Environment: An environment for testing, developing, and deploying robotics motion planning algorithms.
http://www.openrave.org
Other
706 stars 344 forks source link

Minor cleanup #1354

Closed eisoku9618 closed 8 months ago

eisoku9618 commented 8 months ago

Remove unnecessary code from JSONReader::_Extract()

pipelineid=435316

eisoku9618 commented 8 months ago

I converted this PR to a draft unless review is done.

@ziyan Could you review this change? Currently ReadKinBodyJSON() has an unspoken restriction that ignores transform info found in non first body even when the first body does not have transform info, but I think that it is not intentional.


body = env.ReadKinBodyJSON({'unitInfo': {u'lengthUnit': u'm'},
                            'bodies': [{'name': 'eisoku', 'referenceUri': '#ziyan'},
                                       {'id': 'ziyan', 'transform': [1, 0, 0, 0, 2, 2, 2], 'links': [{'mass': 100}]}
                                       ]},
                           {'openravescheme': 'mujin'})
body.GetTransformPose()[4:]

-> should return [2, 2, 2] but returns [0, 0, 0]


body = env.ReadKinBodyJSON({'unitInfo': {u'lengthUnit': u'm'},
                            'bodies': [{'name': 'eisoku', 'referenceUri': '#ziyan', 'transform': [1, 0, 0, 0, 1, 1, 1]},
                                       {'id': 'ziyan', 'transform': [1, 0, 0, 0, 2, 2, 2], 'links': [{'mass': 100}]}
                                       ]},
                           {'openravescheme': 'mujin'})
body.GetTransformPose()[4:]

-> returns [1, 1, 1] as expected.

rdiankov commented 8 months ago

Actually in your first example, body is pointing to eisoku, so translation of [0,0,0] is expected

eisoku9618 commented 8 months ago

@rdiankov I see, so the behavior that not specifying transform (and name as well) in the first body is equal to specifying [1, 0, 0, 0, 0, 0] (empty string for name) is intentional. Thank you.

ziyan commented 8 months ago

Is it "expected"? Seems odd to me.

I would expect it inherits the transform.