Skip to content

Commit deb416f

Browse files
committed
include old p_servo
1 parent 371e087 commit deb416f

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

roboticstoolbox/tools/p_servo.py

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,59 @@
55
import math
66

77

8-
# def p_servo(wTe, wTep, gain=2, threshold=0.1):
9-
# """
10-
# Position-based servoing.
8+
def p_servo_old(wTe, wTep, gain=2, threshold=0.1):
9+
"""
10+
Position-based servoing.
11+
12+
Returns the end-effector velocity which will cause the robot to approach
13+
the desired pose.
14+
15+
:param wTe: The current pose of the end-effecor in the base frame.
16+
:type wTe: SE3
17+
:param wTep: The desired pose of the end-effecor in the base frame.
18+
:type wTep: SE3
19+
:param gain: The gain for the controller
20+
:type gain: float
21+
:param threshold: The threshold or tolerance of the final error between
22+
the robot's pose and desired pose
23+
:type threshold: float
24+
25+
:returns v: The velocity of the end-effecotr which will casue the robot
26+
to approach wTep
27+
:rtype v: ndarray(6)
28+
:returns arrived: True if the robot is within the threshold of the final
29+
pose
30+
:rtype arrived: bool
31+
32+
"""
1133

12-
# Returns the end-effector velocity which will cause the robot to approach
13-
# the desired pose.
14-
15-
# :param wTe: The current pose of the end-effecor in the base frame.
16-
# :type wTe: SE3
17-
# :param wTep: The desired pose of the end-effecor in the base frame.
18-
# :type wTep: SE3
19-
# :param gain: The gain for the controller
20-
# :type gain: float
21-
# :param threshold: The threshold or tolerance of the final error between
22-
# the robot's pose and desired pose
23-
# :type threshold: float
24-
25-
# :returns v: The velocity of the end-effecotr which will casue the robot
26-
# to approach wTep
27-
# :rtype v: ndarray(6)
28-
# :returns arrived: True if the robot is within the threshold of the final
29-
# pose
30-
# :rtype arrived: bool
31-
32-
# """
33-
34-
# if not isinstance(wTe, SE3):
35-
# wTe = SE3(wTe)
34+
if not isinstance(wTe, SE3):
35+
wTe = SE3(wTe)
3636

37-
# if not isinstance(wTep, SE3):
38-
# wTep = SE3(wTep)
37+
if not isinstance(wTep, SE3):
38+
wTep = SE3(wTep)
3939

40-
# # Pose difference
41-
# eTep = wTe.inv() * wTep
40+
# Pose difference
41+
eTep = wTe.inv() * wTep
4242

43-
# # Translational error
44-
# ev = eTep.t
43+
# Translational error
44+
ev = eTep.t
4545

46-
# # Angular error
47-
# ew = eTep.rpy("rad")
46+
# Angular error
47+
ew = eTep.rpy("rad")
4848

49-
# # Form error vector
50-
# e = np.r_[ev, ew]
49+
# Form error vector
50+
e = np.r_[ev, ew]
5151

52-
# # Desired end-effector velocity
53-
# v = gain * e
52+
# Desired end-effector velocity
53+
v = gain * e
5454

55-
# if np.sum(np.abs(e)) < threshold:
56-
# arrived = True
57-
# else:
58-
# arrived = False
55+
if np.sum(np.abs(e)) < threshold:
56+
arrived = True
57+
else:
58+
arrived = False
5959

60-
# return v, arrived
60+
return v, arrived
6161

6262

6363
def _angle_axis(T, Td):

0 commit comments

Comments
 (0)