Generate random configuration of robot
Show different configurations of a robot created using a
RigidBodyTree model. Use the
randomConfiguation functions to generate the structure that defines all the joint positions.
Load example robots as
Create a structure for the home configuration of a Puma robot. The structure has joint names and positions for each body on the robot model.
config = homeConfiguration(puma1)
config=1×6 struct array with fields: JointName JointPosition
Show the home configuration using
show. You do not need to specify a configuration input.
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(puma1,config);
Create random configurations and show them.
configuration— Robot configuration
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
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
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
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