randomConfiguration
Generate random configuration of robot
Description
configuration = randomConfiguration(robot)PositionLimits
                property of the corresponding rigidBodyJoint object in the robot
                model.
Examples
Show different configurations of a robot created using a rigidBodyTree model. Use the homeConfiguration or randomConfiguration functions to generate the structure that defines all the joint positions.
Load a FANUC LR Mate 200ib from the Robotics System Toolbox™ loadrobot. It is returned as a rigidBodyTree object.
robot = loadrobot("fanucLRMate200ib");
showdetails(robot)-------------------- Robot: (9 bodies) Idx Body Name Joint Name Joint Type Parent Name(Idx) Children Name(s) --- --------- ---------- ---------- ---------------- ---------------- 1 base base_link-base fixed base_link(0) 2 link_1 joint_1 revolute base_link(0) link_2(3) 3 link_2 joint_2 revolute link_1(2) link_3(4) 4 link_3 joint_3 revolute link_2(3) link_4(5) 5 link_4 joint_4 revolute link_3(4) link_5(6) 6 link_5 joint_5 revolute link_4(5) link_6(7) 7 link_6 joint_6 revolute link_5(6) flange(8) tool0(9) 8 flange joint_6-flange fixed link_6(7) 9 tool0 link_6-tool0 fixed link_6(7) --------------------
Create a structure for the home configuration of the robot. The structure has joint names and positions for each body on the robot model.
config = homeConfiguration(robot)
config=1×6 struct array with fields:
    JointName
    JointPosition
Show the home configuration using show. You do not need to specify a configuration input.
show(robot);

Modify the configuration and set the second joint position to pi/2. Show the resulting change in the robot configuration.
config(2).JointPosition = pi/2; show(robot,config);

Create random configurations and show them.
show(robot,randomConfiguration(robot));

Input Arguments
Robot model, specified as a rigidBodyTree
                        object.
Output Arguments
Robot configuration, returned as a vector of joint positions or a
                        structure with joint names and positions for all the bodies in the robot
                        model. You can generate a configuration using
                            homeConfiguration(robot),
                            randomConfiguration(robot), or by specifying your own
                        joint positions in a structure. To use the vector form of
                            configuration, set the
                            DataFormat property for the robot to either
                            'row' or 'column'.
Extended Capabilities
Usage notes and limitations:
When creating the rigidBodyTree object, use the syntax that specifies the
            MaxNumBodies as an upper bound for adding bodies to the robot model.
        You must also specify the DataFormat property as a name-value pair. For
        example:
robot = rigidBodyTree("MaxNumBodies",15,"DataFormat","row")
To minimize data usage, limit the upper bound to a number close to the expected number of bodies in the model. All data formats are supported for code generation. To use the dynamics functions, the data format must be set to "row" or "column".
The show and showdetails functions do not support code generation.
Version History
Introduced in R2016brandomConfiguration now supports code generation with disabled dynamic memory allocation. For more information about disabling dynamic memory allocation, see Set Dynamic Memory Allocation Threshold (MATLAB Coder).
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)