Skip to content

Commit

Permalink
Fix serialiazationJson
Browse files Browse the repository at this point in the history
  • Loading branch information
LLipter committed Jan 15, 2024
1 parent 13d296f commit 8ee4599
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions include/openrave/kinbody.h
Original file line number Diff line number Diff line change
Expand Up @@ -2450,6 +2450,7 @@ class OPENRAVE_API KinBody : public InterfaceBase

bool _isRobot = false; ///< true if should create a RobotBasePtr
bool _isPartial = true; ///< true if this info contains partial information. false if the info contains the full body information and can ignore anything that is currently saved on the environment when updating.
bool _isDiffResult = false; ///< true if this info represents a diff result.

enum KinBodyInfoField {
KBIF_Transform = (1 << 0), // _transform field
Expand Down Expand Up @@ -3741,7 +3742,7 @@ class OPENRAVE_API KinBody : public InterfaceBase
KinBodyInfoPtr diffInfo = boost::make_shared<KinBody::KinBodyInfo>();
diffInfo->_id = _id;
diffInfo->_vLinkInfos.push_back(linkInfo);
diffInfo->_isPartial = true;
diffInfo->_isDiffResult = true;
diffInfo->_modifiedFields = 0;
_callbackOnModify(diffInfo);
}
Expand All @@ -3751,7 +3752,7 @@ class OPENRAVE_API KinBody : public InterfaceBase
KinBodyInfoPtr diffInfo = boost::make_shared<KinBody::KinBodyInfo>();
diffInfo->_id = _id;
diffInfo->_vJointInfos.push_back(jointInfo);
diffInfo->_isPartial = true;
diffInfo->_isDiffResult = true;
diffInfo->_modifiedFields = 0;
_callbackOnModify(diffInfo);
}
Expand Down
4 changes: 2 additions & 2 deletions src/libopenrave/kinbody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void KinBody::KinBodyInfo::SerializeJSON(rapidjson::Value& rKinBodyInfo, rapidjs
{
rKinBodyInfo.SetObject();

if (_isPartial) {
if (_isDiffResult) {
if (IsModifiedField(KinBody::KinBodyInfo::KBIF_Name)) {
orjson::SetJsonValueByKey(rKinBodyInfo, "name", _name, allocator);
}
Expand Down Expand Up @@ -902,7 +902,7 @@ void KinBody::SetName(const std::string& newname)
KinBody::KinBodyInfoPtr diffInfo = boost::make_shared<KinBody::KinBodyInfo>();
diffInfo->_id = _id;
diffInfo->_name = _name;
diffInfo->_isPartial = true;
diffInfo->_isDiffResult = true;
diffInfo->_modifiedFields = 0;
diffInfo->AddModifiedField(KinBody::KinBodyInfo::KBIF_Name);
_callbackOnModify(diffInfo);
Expand Down

0 comments on commit 8ee4599

Please sign in to comment.