Skip to content

Commit

Permalink
use unordered set instead of vector
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Maisonneuve committed Oct 6, 2021
1 parent 7247d06 commit 256e760
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <set>
#include <chrono>
#include <unordered_set>

namespace
{
Expand Down Expand Up @@ -812,7 +813,7 @@ kortex_driver::KortexError KortexArmSimulation::ExecuteReachJointAngles(const ko

// Transform kortex structure to trajectory_msgs to fill endpoint structure
trajectory_msgs::JointTrajectoryPoint endpoint;
std::vector<int> limited_joints; // joints limited in range
std::unordered_set<int> limited_joints; // joints limited in range
int degrees_of_freedom = constrained_joint_angles.joint_angles.joint_angles.size();
if (degrees_of_freedom == 6)
{
Expand All @@ -833,7 +834,7 @@ kortex_driver::KortexError KortexArmSimulation::ExecuteReachJointAngles(const ko
// If the current actuator has turned on itself many times, we need the endpoint to follow that trend too
int n_turns = 0;
double rad_wrapped_goal;
if (std::count (limited_joints.begin(), limited_joints.end(), i))
if (limited_joints.count(i))
{
rad_wrapped_goal = m_math_util.wrapRadiansFromMinusPiToPi(m_math_util.toRad(constrained_joint_angles.joint_angles.joint_angles[i].value));
}
Expand Down

0 comments on commit 256e760

Please sign in to comment.