rdiankov / openrave

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

allow name mismatch when IAM_AllowRenaming is used #1188

Open eisoku9618 opened 1 year ago

eisoku9618 commented 1 year ago
{
  "name": "hello world file name",
  "keywords": [
    "part"
  ],
  "bodies": [
    {
      "name": "hello world body name",
      "links": [
        {
          "name": "hello world link name",
          "geometries": [
            {
              "type": "box",
              "halfExtents": [
                0.05,
                0.05,
                0.05
              ]
            }
          ]
        }
      ],
      "isRobot": false
    }
  ]
}

When I load this file to openrave environment, I get this error.

openravepy._openravepy_0_105.openravepy_int._OpenRAVEException: ('openrave (InvalidArguments): [virtual void Environment::UpdateFromInfo(const OpenRAVE::EnvironmentBase::EnvironmentBaseInfo&, std::vector<boost::shared_ptr<OpenRAVE::KinBody> >&, std::vector<boost::shared_ptr<OpenRAVE::KinBody> >&, std::vector<boost::shared_ptr<OpenRAVE::KinBody> >&, OpenRAVE::UpdateFromInfoMode):2987] pInitBody->GetName() == pKinBodyInfo->_name, (eval hello_world_body_name == hello world body name) names should be matching', 'InvalidArguments')

This is because when we add a kinbody in UpdateFromInfo() of environment-core.h, we use IAM_AllowRenaming for new body or robot, so name can be changed e.g. ` (white space) ->_(underscore) but we compare the original name and the renamed name. For new body or robot, since we useIAM_AllowRenaming`, we don't need to check name matching in that case.

rdiankov commented 1 year ago

not sure we should be supporting this case.... how about calling utils::ConvertToOpenRAVEName in UpdateFromInfo ?

eisoku9618 commented 1 year ago

@rdiankov Thank you for checking.

not sure we should be supporting this case....

There was a problem that a user used webapi to register an item with white spaces in the name and then our system does not start properly with that names should be matching exception. If openrave should not support this case, I think we should reject such a query in webapi side and change IAM_AllowRenaming to IAM_StrictNameChecking in UpdateFromInfo. Personally I prefer this (not supporting white spaces in openrave) because our registraion UI does not allow a user to input white spaces in bodies/name.

cc @woswos