Scale a Joint Velocity Command to Its Limits
Implement scale_to_limits(q_dot, q_dot_max) returning the scaled velocity array, the same length as the input.
Examples
Already legal: the command passes through untouched, not sped up
- Input
- scale_to_limits([0.5, -0.5], [1, 1])
- Output
- [0.5, -0.5]
One joint over the limit: both are halved, so the direction survives
- Input
- scale_to_limits([2, 1], [1, 1])
- Output
- [1, 0.5]
A stationary joint must not cause a division by zero
- Input
- scale_to_limits([4, 0], [2, 1])
- Output
- [2, 0]
Hints
Hint 1
Convert the input with before doing elementwise work.
Hint 2
Watch for this: clipped each joint independently which changes the direction of travel.
Requirements
q_dot: (n,) commanded joint velocitiesq_dot_max: (n,) per-joint speed limits, all positiveReturn (n,) scaled command, parallel to q_dot
Constraints
Allowed library: NumPy only
Time limit: 200 ms, Memory: 64 MB
Try similar problems(4)
Industrial Robotics: Kinematics and Control · ~12 min
Industrial Robotics: Kinematics and Control · ~12 min
Industrial Robotics: Kinematics and Control · ~10 min
Industrial Robotics: Kinematics and Control · ~14 min
Where this shows up
6 employers weight this skill
4 autonomy companies, 2 defense companies. Top match scores 93.
import numpy as np
def scale_to_limits(q_dot, q_dot_max):
"""
Uniformly slow a joint velocity command until every joint is legal.
Args:
q_dot: (n,) commanded joint velocities
q_dot_max: (n,) per-joint speed limits, all positive
Returns:
(n,) scaled command, parallel to q_dot
"""
# YOUR CODE HERE
pass