2424#include " franky/relative_dynamics_factor.hpp"
2525#include " franky/joint_state.hpp"
2626#include " franky/dynamics_limit.hpp"
27+ #include " franky/util.hpp"
2728
2829namespace franky {
2930
@@ -37,13 +38,6 @@ struct InvalidMotionTypeException : std::runtime_error {
3738 using std::runtime_error::runtime_error;
3839};
3940
40- constexpr std::array<double , 7 > scaleArr7 (const std::array<double , 7 > &arr, const double factor) {
41- std::array<double , arr.size ()> result{};
42- for (size_t i = 0 ; i < arr.size (); ++i)
43- result[i] = arr[i] * factor;
44- return result;
45- }
46-
4741/* *
4842 * @brief A class representing a Franka robot.
4943 *
@@ -155,31 +149,30 @@ class Robot : public franka::Robot {
155149 DynamicsLimit<double > elbow_jerk_limit{
156150 " elbow jerk" , 5000.0 , 800.0 , control_mutex_, std::bind (&Robot::is_in_control_unsafe, this )};
157151
158-
159152 /* *
160153 * @brief Joint velocity limit [rad/s].
161154 */
162- #define MAX_JOINT_VEL {2.175 , 2.175 , 2.175 , 2.175 , 2.610 , 2.610 , 2.610 }
163- DynamicsLimit<std::array< double , 7 > > joint_velocity_limit{
155+ #define MAX_JOINT_VEL toEigenD< 7 >( {2.175 , 2.175 , 2.175 , 2.175 , 2.610 , 2.610 , 2.610 })
156+ DynamicsLimit<Vector7d > joint_velocity_limit{
164157 " joint_velocity" , MAX_JOINT_VEL, MAX_JOINT_VEL, control_mutex_,
165158 std::bind (&Robot::is_in_control_unsafe, this )
166159 };
167160
168161 /* *
169162 * @brief Joint acceleration limit [rad/s²].
170163 */
171- #define MAX_JOINT_ACC {15.0 , 7.5 , 10.0 , 12.5 , 15.0 , 20.0 , 20.0 }
172- DynamicsLimit<std::array< double , 7 > > joint_acceleration_limit{
173- " joint_acceleration" , MAX_JOINT_ACC, scaleArr7 ( MAX_JOINT_ACC, 0.3 ) , control_mutex_,
164+ #define MAX_JOINT_ACC toEigenD< 7 >( {15.0 , 7.5 , 10.0 , 12.5 , 15.0 , 20.0 , 20.0 })
165+ DynamicsLimit<Vector7d > joint_acceleration_limit{
166+ " joint_acceleration" , MAX_JOINT_ACC, MAX_JOINT_ACC * 0.3 , control_mutex_,
174167 std::bind (&Robot::is_in_control_unsafe, this )
175168 };
176169
177170 /* *
178171 * @brief Joint jerk limit [rad/s³].
179172 */
180- #define MAX_JOINT_JERK {7500.0 , 3750.0 , 5000.0 , 6250.0 , 7500.0 , 10000.0 , 10000.0 }
181- DynamicsLimit<std::array< double , 7 > > joint_jerk_limit{
182- " joint_jerk" , MAX_JOINT_JERK, scaleArr7 ( MAX_JOINT_JERK, 0.3 ) , control_mutex_,
173+ #define MAX_JOINT_JERK toEigenD< 7 >( {7500.0 , 3750.0 , 5000.0 , 6250.0 , 7500.0 , 10000.0 , 10000.0 })
174+ DynamicsLimit<Vector7d > joint_jerk_limit{
175+ " joint_jerk" , MAX_JOINT_JERK, MAX_JOINT_JERK * 0.3 , control_mutex_,
183176 std::bind (&Robot::is_in_control_unsafe, this )
184177 };
185178
0 commit comments