Using the active_joints vector and then getting the joint positions using the variable map of the robot state is most certainly not the most efficient way of getting this information.