@@ -831,5 +831,41 @@ bool JointModelGroup::isValidVelocityMove(const double* from_joint_pose, const d
831
831
832
832
return true ;
833
833
}
834
+
835
+ std::pair<Eigen::VectorXd, Eigen::VectorXd> getLowerAndUpperLimits (const moveit::core::JointModelGroup& group)
836
+ {
837
+ // Get the group joints lower/upper position limits.
838
+ Eigen::VectorXd lower_limits (group.getActiveVariableCount ());
839
+ Eigen::VectorXd upper_limits (group.getActiveVariableCount ());
840
+ const moveit::core::JointBoundsVector& group_bounds = group.getActiveJointModelsBounds ();
841
+ int joint_index = 0 ;
842
+ for (const moveit::core::JointModel::Bounds* joint_bounds : group_bounds)
843
+ {
844
+ for (const moveit::core::VariableBounds& variable_bounds : *joint_bounds)
845
+ {
846
+ lower_limits[joint_index] = variable_bounds.min_position_ ;
847
+ upper_limits[joint_index] = variable_bounds.max_position_ ;
848
+ joint_index++;
849
+ }
850
+ }
851
+ return { lower_limits, upper_limits };
852
+ }
853
+
854
+ std::pair<Eigen::VectorXd, Eigen::VectorXd>
855
+ getMaximumVelocitiesAndAccelerations (const moveit::core::JointModelGroup& group)
856
+ {
857
+ const std::size_t n_dofs = group.getActiveVariableCount ();
858
+ Eigen::VectorXd max_joint_velocities = Eigen::VectorXd::Constant (n_dofs, 0.0 );
859
+ Eigen::VectorXd max_joint_accelerations = Eigen::VectorXd::Constant (n_dofs, 0.0 );
860
+ const moveit::core::JointBoundsVector& bounds = group.getActiveJointModelsBounds ();
861
+ assert (bounds.size () == n_dofs);
862
+ for (std::size_t i = 0 ; i < bounds.size (); ++i)
863
+ {
864
+ assert (bounds[i]->size () == 1 ); // single-variable joints.
865
+ max_joint_velocities[i] = std::min (-bounds[i]->at (0 ).min_velocity_ , bounds[i]->at (0 ).max_velocity_ );
866
+ max_joint_accelerations[i] = std::min (-bounds[i]->at (0 ).min_acceleration_ , bounds[i]->at (0 ).max_acceleration_ );
867
+ }
868
+ return { max_joint_velocities, max_joint_accelerations };
869
+ }
834
870
} // end of namespace core
835
871
} // end of namespace moveit
0 commit comments