@@ -968,35 +968,37 @@ JointModel* RobotModel::constructJointModel(const urdf::Joint* urdf_joint, const
968
968
{
969
969
new_joint_model->setDistanceFactor (new_joint_model->getStateSpaceDimension ());
970
970
const std::vector<srdf::Model::PassiveJoint>& pjoints = srdf_model.getPassiveJoints ();
971
+ std::string joint_name = new_joint_model->getName ();
971
972
for (const srdf::Model::PassiveJoint& pjoint : pjoints)
972
973
{
973
- if (new_joint_model-> getName () == pjoint.name_ )
974
+ if (joint_name == pjoint.name_ )
974
975
{
975
976
new_joint_model->setPassive (true );
976
977
break ;
977
978
}
978
979
}
979
- for (const srdf::Model::JointProperty & property : srdf_model.getJointProperties (new_joint_model-> getName () ))
980
+ for (const auto & property : srdf_model.getJointProperties (joint_name ))
980
981
{
981
- if (property.property_name_ == " angular_distance_weight" )
982
+ std::string property_name = property.first ;
983
+ std::string property_value = property.second ;
984
+ if (property_name == " angular_distance_weight" )
982
985
{
983
986
double angular_distance_weight;
984
987
try
985
988
{
986
989
std::string::size_type sz;
987
- angular_distance_weight = std::stod (property. value_ , &sz);
988
- if (sz != property. value_ .size ())
990
+ angular_distance_weight = std::stod (property_value , &sz);
991
+ if (sz != property_value .size ())
989
992
{
990
- ROS_WARN_STREAM_NAMED (LOGNAME, " Extra characters after property "
991
- << property. property_name_ << " for joint " << property. joint_name_
992
- << " as double: ' " << property. value_ .substr (sz) << " '" );
993
+ ROS_WARN_STREAM_NAMED (LOGNAME, " Extra characters after property " << property_name << " for joint "
994
+ << joint_name << " as double: ' "
995
+ << property_value .substr (sz) << " '" );
993
996
}
994
997
}
995
998
catch (const std::invalid_argument& e)
996
999
{
997
- ROS_ERROR_STREAM_NAMED (LOGNAME, " Unable to parse property " << property.property_name_ << " for joint "
998
- << property.joint_name_ << " as double: '"
999
- << property.value_ << " '" );
1000
+ ROS_ERROR_STREAM_NAMED (LOGNAME, " Unable to parse property " << property_name << " for joint " << joint_name
1001
+ << " as double: '" << property_value << " '" );
1000
1002
continue ;
1001
1003
}
1002
1004
@@ -1010,71 +1012,70 @@ JointModel* RobotModel::constructJointModel(const urdf::Joint* urdf_joint, const
1010
1012
}
1011
1013
else
1012
1014
{
1013
- ROS_ERROR_NAMED (LOGNAME, " Cannot apply property %s to joint type: %s" , property. property_name_ .c_str (),
1015
+ ROS_ERROR_NAMED (LOGNAME, " Cannot apply property %s to joint type: %s" , property_name .c_str (),
1014
1016
new_joint_model->getTypeName ().c_str ());
1015
1017
}
1016
1018
}
1017
- else if (property. property_name_ == " motion_model" )
1019
+ else if (property_name == " motion_model" )
1018
1020
{
1019
1021
if (new_joint_model->getType () != JointModel::JointType::PLANAR)
1020
1022
{
1021
- ROS_ERROR_NAMED (LOGNAME, " Cannot apply property %s to joint type: %s" , property. property_name_ .c_str (),
1023
+ ROS_ERROR_NAMED (LOGNAME, " Cannot apply property %s to joint type: %s" , property_name .c_str (),
1022
1024
new_joint_model->getTypeName ().c_str ());
1023
1025
continue ;
1024
1026
}
1025
1027
1026
1028
PlanarJointModel::MotionModel motion_model;
1027
- if (property. value_ == " holonomic" )
1029
+ if (property_value == " holonomic" )
1028
1030
{
1029
1031
motion_model = PlanarJointModel::MotionModel::HOLONOMIC;
1030
1032
}
1031
- else if (property. value_ == " diff_drive" )
1033
+ else if (property_value == " diff_drive" )
1032
1034
{
1033
1035
motion_model = PlanarJointModel::MotionModel::DIFF_DRIVE;
1034
1036
}
1035
1037
else
1036
1038
{
1037
- ROS_ERROR_STREAM_NAMED (LOGNAME, " Unknown value for property " << property.property_name_ << " ("
1038
- << property.joint_name_ << " ): '"
1039
- << property.value_ << " '" );
1039
+ ROS_ERROR_STREAM_NAMED (LOGNAME, " Unknown value for property " << property_name << " (" << joint_name << " ): '"
1040
+ << property_value << " '" );
1040
1041
ROS_ERROR_NAMED (LOGNAME, " Valid values are 'holonomic' and 'diff_drive'" );
1041
1042
continue ;
1042
1043
}
1043
1044
1044
1045
((PlanarJointModel*)new_joint_model)->setMotionModel (motion_model);
1045
1046
}
1046
- else if (property. property_name_ == " min_translational_distance" )
1047
+ else if (property_name == " min_translational_distance" )
1047
1048
{
1048
1049
if (new_joint_model->getType () != JointModel::JointType::PLANAR)
1049
1050
{
1050
- ROS_ERROR_NAMED (LOGNAME, " Cannot apply property %s to joint type: %s" , property. property_name_ .c_str (),
1051
+ ROS_ERROR_NAMED (LOGNAME, " Cannot apply property %s to joint type: %s" , property_name .c_str (),
1051
1052
new_joint_model->getTypeName ().c_str ());
1052
1053
continue ;
1053
1054
}
1054
1055
double min_translational_distance;
1055
1056
try
1056
1057
{
1057
1058
std::string::size_type sz;
1058
- min_translational_distance = std::stod (property. value_ , &sz);
1059
- if (sz != property. value_ .size ())
1059
+ min_translational_distance = std::stod (property_value , &sz);
1060
+ if (sz != property_value .size ())
1060
1061
{
1061
- ROS_WARN_STREAM_NAMED (LOGNAME, " Extra characters after property "
1062
- << property. property_name_ << " for joint " << property. joint_name_
1063
- << " as double: ' " << property. value_ .substr (sz) << " '" );
1062
+ ROS_WARN_STREAM_NAMED (LOGNAME, " Extra characters after property " << property_name << " for joint "
1063
+ << joint_name << " as double: ' "
1064
+ << property_value .substr (sz) << " '" );
1064
1065
}
1065
1066
}
1066
1067
catch (const std::invalid_argument& e)
1067
1068
{
1068
- ROS_ERROR_NAMED (LOGNAME, " Unable to parse property %s for joint %s as double: '%s'" ,
1069
- property. property_name_ . c_str (), property. joint_name_ . c_str (), property. value_ .c_str ());
1069
+ ROS_ERROR_NAMED (LOGNAME, " Unable to parse property %s for joint %s as double: '%s'" , property_name. c_str (),
1070
+ joint_name. c_str (), property_value .c_str ());
1070
1071
continue ;
1071
1072
}
1072
1073
1073
1074
((PlanarJointModel*)new_joint_model)->setMinTranslationalDistance (min_translational_distance);
1074
1075
}
1075
1076
else
1076
1077
{
1077
- ROS_ERROR_NAMED (LOGNAME, " Unknown joint property: %s" , property. property_name_ .c_str ());
1078
+ ROS_ERROR_NAMED (LOGNAME, " Unknown joint property: %s" , property_name .c_str ());
1078
1079
}
1079
1080
}
1080
1081
}
0 commit comments