Skip to content

Commit e8c594e

Browse files
committed
add method for random joint config
1 parent 9616da0 commit e8c594e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

roboticstoolbox/robot/Robot.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,25 @@ def n(self):
210210
"""
211211
return self._n
212212

213+
@property
214+
def qrandom(self):
215+
"""
216+
Return a random joint configuration
217+
218+
:return: Random joint configuration :rtype: ndarray(n)
219+
220+
The value for each joint is uniform randomly distributed between the
221+
limits set for the robot.
222+
223+
.. note:: The joint limit for all joints must be set.
224+
225+
:seealso: :func:`Robot.qlim`, :func:`Link.qlim`
226+
"""
227+
qlim = self.qlim
228+
if np.any(np.isnan(qlim)):
229+
raise ValueError('some joint limits not defined')
230+
return np.random.uniform(low=qlim[0, :], high=qlim[1, :], size=(self.n,))
231+
213232
def addconfiguration(self, name, q, unit='rad'):
214233
"""
215234
Add a named joint configuration (Robot superclass)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy