Exporting a SolidWorks model

A tutorial on how to use the SolidWorks Gazebo plugin to export a robot model.

Open the Desired Model

Open the robot model that you desire to import.

Create Collision Models

For each link, click the "Select Visual Components" buttons to switch to the Solidworks window and select components in the assembly that should be part of the link. Re-click a selected part to de-select it. Select the green checkbox to return to the "Manage Robot" window.

Repeat for with the "Select Physical Components" and "Select Collision Components" buttons to specify different models for calculating the center of mass/inertia values and for use by simulator. Switch Solidworks configurations in between selecting components, if you created a separate collision robot model. This is not necessary, but recommended for complex models.

For more details, see the article: Assigning components to links.

Open the Manage Robot Tab

Open the Manage Robot Tab

Click on the "Manage Robot" button in the Gazebo tab to open up the Manager Robot Window. This window will let you edit various properties of the robot, its links, its joints, and its attachments.

The Manage Robot window

The Manage Robot window

The Manage Robot window has 3 areas:

  • in the top-left is a graphical representation of the robot as links connected to one or more other links by joint(s)
  • in the bottom are the link and attachments that can be added to the robot graph
  • in the right is a property manager panel where you can edit the properties of links, joints, sensors, and the robot after clicking something in the graph area.

Name the Robot Model

Name the Robot Model

In the name box on the right hand side, give a name to the robot model. This is the name that will be used in Gazebo.

Set robot orientation

Set robot orientation

Click the "Select Model Origin" button to select an origin point for the robot, the base plane on which the robot stands, and the axis along which the robot faces. A set of coordinate axes will be drawn at the origin point based on your selections; if the arrow on the chosen axis is in the opposite direction, toggle the direction of the axis or plane as necessary by clicking the direction button to the left of the selection box.

Note that the base plane represents the offset from the origin point to the ground as well as defining the Z-axis of the robot. When the robot is brought into gazebo the robot will start with this base plane being coplanar to the ground plane.

Click the green checkmark to return to the "Manage Robot" window.

Set robot settings

Set robot settings

If you have enabled FRCSim components in the Exporter Settings, you have the option to export your robot model with a FRC competition field in a world file.

Note: The option to export in .URDF format is not yet supported.

Create links and joints

Create links and joints

Custom collision models should be created for complex models in order to not slow down the physics simulation. These models should be made to only represent the important geometry for simulation. Custom collision models are not required, but are strongly suggested for all but the simplest of models. For more information on collision models see article: ARTICLE

If you have not done so already, you should also set the material of your model parts in the Feature Manager Design Tree Tab.

Delete links and joints

Delete links and joints

To delete a link or joint, select it in the graph area, and press the remove button in the right panel.

Note that this will also delete any attachments, dependent sublinks, and connected joints. Thus, if removing a joint or link completely cuts off a set of links from the base link, the link(s)  and their associated joints and attachments will be removed.

Set link properties

Set link properties

For each link, select the link's box in the graph panel, give it a unique name, and set the following property values in the right panel:

  • mu1 and mu2 represent friction coefficients along both directions of the surface of a contact joint (unitless).

These properties can often be left blank, but for some models may be helpful to adjust:

  • kp represents¬†the contact stiffness coefficient of the link, and is to a material as the spring constant is to a spring. This is usually a very large value as greater values indicate harder surfaces. Soft, deformable surfaces can be simulated by adjusting this coefficient and the kd coefficient. The smaller the values the softer the material will be. An example of a good value for a hard rubber gripper would be about 10000.
  • kd represents the contact damping coefficient of the link. Like the kp value, this coefficient represents the stifness of the link. This value tends to be much smaller than the kp value. A hard rubber gripper would have a value of about 1.
  • Linear damping and angular damping is represents how much the link resists force (in Newton-seconds/meter), similar to the damping property of joints.
  • Checking "Self Collide" enables this link to collide with other links of the robot. Note, even with self collide enabled a link will never collide with any links it is directly connected to via a joint.

Set link components

Set link components

A link is a set of components that do not move relative to one another and can be treated as one part of the robot, and links are connected by joints.

To add a child link to an existing link, drag a new link from bottom selection panel onto any link in the graph area. This will automatically create a joint connecting these links.

To connect any two existing links with a new joint, simply click on the desired parent link, drag the mouse, and release on the desired child link. Note that the link that the drag is started from will be the parent link of the joint, and the other link will be the child of the joint.

Color components by link

Color components by link

You can see which components have been assigned to other links by checking "Color components by link". The links will be colored based on the colors chosen in the robot manager. Note that if a component is assigned to multiple links, it will only be colored to the color of one link.

This is helpful to check that all your components have been assigned to at least one link.

Set Manual Inertia Values (optional)

Set Manual Inertia Values (optional)

By default, the mass and inertial values are calculated using the physical properties of the model, but they can also be set manually, if needed. To do this, first check the box labeled "Use Custom Inertial Values." The values can then be edited using the text boxes. A triad will also appear at the center of mass to give a preview of its location. This handler can also be dragged around to adjust the location of the center of mass. All values are metric.

Define Joints

Define Joints

The next step is to define the joints. For each joint, select by clicking on it in the graph area, and edit its properties in the right panel. For more detailed instructions and a list of currently supported joints and their properties, see the article: Setting joints

Add attachments and sensors

Add attachments and sensors

Once you have defined all your links and joints, you may add attachments to them by dragging the desired attachment from the bottom panel to a link in the graph. Then, click on the attachment to edit the attachment's properties in the right panel. To remove the selected attachment, click the "Delete" button.

For more detailed instructions and a list of attachments, see the article: Adding Motors and Sensors to a model.

Export the Robot

Export the Robot

Once all settings have been adjusted, export the robot by clicking the "Export" button under the Gazebo tab.

Verifying model

Verifying model

A window will appear while the exporter verifies the model. The exporter will run through a series of steps to verify that the model will successfully export.

Any minor issues will be reported in yellow. These warnings will not prevent the model from being exported but may cause issues when running the simulation.

Any major errors will be reported in red These errors will prevent the model from exporting and the model must be corrected before the model can be exported.

Exporting model

Exporting model

Once the verification is successfully completed without any errors, click the export button in the window.

A window will appear where you can select the location that the exported model should be saved to. The window will default to the HOME\wpilib\simulation directory if one exists as this is the default location for using the models in windows. If you are using Gazebo in linux you can save the model to another location and then transfer the files to your linux computer.

Once this is done hit OK, and then the model will be exported. The export can be canceled any time by clicking on the cancel button. Once the export has finished, you may close the window.

0 Report Errors

Use this form to report any errors with the documentation. For help with WPILib, please use the FIRST Forums at http://forums.usfirst.org For reporting WPILib bugs, please submit an issue on GitHub at https://github.com/wpilibsuite/allwpilib/issues/new

Ignore