Main Content

Gazebo Apply Command

Send command to Gazebo simulator

  • Library:
  • Robotics System Toolbox / Gazebo Co-Simulation

  • Gazebo Apply Command block

Description

The Apply Command block sends commands to a Gazebo simulation. The block accepts a command message, input as a bus signal, and sends the command to the Gazebo server.

To send command messages, connect to a Gazebo simulation. Open the block mask and click Configure Gazebo network and simulation settings.

This block is part of a co-simulation interface between MATLAB® and Gazebo for exchanging data and sending commands. To see a basic example, check Perform Co-Simulation between Simulink and Gazebo.

Limitations

  • Models that use this block do not support Code Generation or Rapid Accelerator mode.

Ports

Input

expand all

Gazebo command message, specified as a bus. The command is an instruction for a specified model link or joint. Specify the model name as part of the bus signal using the Gazebo Select Entity block.

There are seven different command types with specific fields:

  • ApplyLinkWrench:

    • model_name –– Variable-size uint8 array representing the name of the model in the Gazebo simulator. You can specify this field using the Gazebo Select Entity block.

    • link_name –– Variable-size uint8 array representing the name of the link in the model in the Gazebo simulator. You can specify this field using the Gazebo Select Entity block.

    • force_type –– Variable-size uint8 array specified as 'SET' or 'ADD'. 'SET' overwrites any existing force command for the specified duration. 'ADD' adds the value with existing commands.

    • Fx, fy, fz –– double values specifying the amount of force applied to the Gazebo model link in world coordinates and Newtons.

    • torque_type –– Variable-size uint8 array specified as 'SET' or 'ADD'. 'SET' overwrites any existing torque command for the specified duration. 'ADD' adds the value with existing commands.

    • Tx, ty, tz –– double values specifying the amount of torque applied to the Gazebo model link in world coordinates and Newton-meters.

    • duration –– Bus containing seconds and nanoseconds as double integers, which specify how long to apply the torque in simulation time.

  • ApplyJointTorque:

    • model_name –– Variable-size uint8 array representing the name of the model in the Gazebo simulator. You can specify this field using the Gazebo Select Entity block.

    • joint_name –– Variable-size uint8 array representing the name of the joint in the model in the Gazebo simulator. You can specify this field using the Gazebo Select Entity block.

    • index –– uint32 integer that identifies which joint axis the torque should be applied to.

    • effort –– double scalar value specifying the amount of torque or force to apply to the joint.

    • duration –– Bus containing seconds and nanoseconds as double integers, which specify how long to apply the torque in simulation time.

  • SetLinkWorldPose — Set world pose in Gazebo world for selected link of Gazebo model

  • SetLinkLinearVelocity — Set linear velocity of selected link of Gazebo model

  • SetLinkAngularVelocity — Set angular velocity of selected link of Gazebo model

  • SetJointPosition — Set position (angle) of selected joint of Gazebo model

  • SetJointVelocity — Set velocity of selected joint of Gazebo model

Data Types: bus

Parameters

expand all

Click Select to get a list of command types available in Gazebo. The input Cmd must contain the correct command message structure that matches this type.

Sample time indicates the interval which commands are sent to the Gazebo simulator.

Introduced in R2019b