This tutorial will guide you through calculating the inertia for a rectangular box, configuring these values in a YAML file for the Virtual Shake Robot (VSR), and understanding how PyBullet reads these values in the createMultiBody
function.
The moments of inertia for a rectangular box aligned with the coordinate axes can be calculated using the following formulas:
Where:
- ( m ) is the mass of the box.
- ( w ) is the width (x-dimension).
- ( h ) is the height (y-dimension).
- ( d ) is the depth (z-dimension).
Given a rectangular box with:
- Dimensions:
[10.0, 10.0, 0.1]
(width, height, depth) - Mass:
10000.0
The moments of inertia are calculated as follows:
Since it is a simple geometric box and symmetrically distributed around its center of mass, the other non-diagonal elements are zero.
The calculated moments of inertia need to be configured in the YAML file used by the VSR. Here is how you can specify the configuration:
Create or modify the YAML configuration file as follows:
simulation_node:
ros__parameters:
structure:
world_box:
dimensions: [50.0, 14.0, 2.0]
mass: 0.00
inertia: [0.0, 0.0, 0.0]
pedestal:
dimensions: [10.0, 10.0, 0.1]
mass: 10000.0
inertia: [8334.167, 8334.167, 166666.67]
To determine the maximum force and velocity required for controlling the pedestal in the simulation based on given amplitude (A) and frequency (F) values.
- Mass of the pedestal (m): 10000 kg
- Amplitude (A): Variable
- Frequency (F): Variable
-
Acceleration Function: $$ a(t) = 4\pi^2 F^2 A \cos(2\pi F t) $$
- (a(t)): Acceleration as a function of time.
- (A): Amplitude.
- (F): Frequency.
- (t): Time.
-
Newton's Second Law: $$ F = ma $$
- (F): Force.
- (m): Mass.
- (a): Acceleration.
-
Velocity Function: $$ v(t) = 2\pi AF \sin(2\pi F t) $$
- (v(t)): Velocity as a function of time.
The maximum acceleration occurs when
For a given mass ((m)) of 10000 kg, the maximum force can be calculated using Newton's Second Law:
-
Calculate maximum acceleration: $$ a_{max} = 4\pi^2 \times 16^2 \times 1 = 10093.5104 , \text{m/s}^2 $$
-
Calculate maximum force: $$ F_{max} = 10000 \times 10093.5104 = 100935104 , \text{N} $$
The maximum velocity occurs when (\sin(2\pi F t) = 1):
- Calculate maximum velocity: $$ v_{max} = 2\pi \times 5 \times 5 = 157.08 , \text{m/s} $$
Amplitude (A) | Frequency (F) | Maximum Acceleration (m/s²) | Maximum Force (N) | Maximum Velocity (m/s) |
---|---|---|---|---|
1 | 16 | 10093.5104 | 100935104 | 100.53 |
10 | 1 | 3959.20139 | 39592013.9 | 62.83 |
2 | 2 | 3159.36111 | 31593611.1 | 25.13 |
2 | 1 | 789.18028 | 7891802.8 | 12.57 |
5 | 5 | 19739.5064 | 197395064 | 157.08 |
The maximum force calculated for ((A = 1, F = 16)) is (100935104) N, which is the highest among the test cases. Therefore, we decided to use this value to ensure the controller can handle the most extreme scenario.
The calculated maximum force is used in the setJointMotorControl2
function to ensure the joint motor can reach the desired positions and velocities:
p.setJointMotorControl2(
bodyUniqueId=robot_id,
jointIndex=0,
controlMode=p.POSITION_CONTROL,
targetPosition=positions[i],
targetVelocity=velocities[i],
force= 5 * 10**8, # Maximum force set based on calculations
maxVelocity=200, # Set maximum velocity
physicsClientId=client_id
)
- Open Fusion 360: Launch Autodesk Fusion 360 on your computer.
- Create a New Project: If you don’t already have a project, create a new one by clicking on the
New Project
button in theData Panel
. - Import the Mesh:
- Go to the
Insert
menu. - Select
Insert Mesh
. - Browse to your
.obj
file and select it. - Click
Open
to import the mesh into your project.
- Go to the
-
Prepare the Mesh:
- Right-click on the mesh in the
Browser
pane. - Select
Mesh to BRep
(Boundary Representation). - Fusion 360 will prompt you to convert the mesh. Confirm and proceed.
- Right-click on the mesh in the
-
Edit the Mesh (if necessary):
- Use the
Repair
tool to fix any issues with the mesh. This is available under theMesh
tab. - Simplify the mesh if it’s too detailed. This can be done using the
Reduce
tool.
- Use the
-
Create a New Component:
- Right-click on the
root component
in theBrowser
pane. - Select
New Component
.
- Right-click on the
-
Move the Solid into the New Component:
- Drag the solid body from the
Browser
pane into the newly created component.
- Drag the solid body from the
-
Go to the Inspect Menu:
- Click on the
Inspect
menu. - Select
Physical Properties
.
- Click on the
-
Select the Solid:
- Click on the solid body you want to analyze.
-
Calculate Properties:
- Fusion 360 will display the mass, volume, center of mass, and moments of inertia for the selected solid.
- You can view the moments of inertia in the results window.
-
Export the Inertia Data (Optional):
- Click on
Export
to save the physical properties data to a CSV file for further analysis or record-keeping.
- Click on
-
Check Units:
- Ensure the units of measurement are consistent with your requirements (e.g., kg·m² for moments of inertia).
- You can change units in the
Document Settings
at the bottom of theBrowser
pane.
-
Use the Data:
- The moments of inertia provided can be used for further simulations, control algorithms, or integrating with other software like PyBullet.
- Simplification: Before converting the mesh to a solid, it might be helpful to simplify the mesh to reduce complexity and improve performance.
- Mesh Repair: Always check for and repair any errors in the mesh to ensure accurate physical properties.
- Fusion 360 Help: Utilize Fusion 360’s help resources and community forums if you encounter any issues.
This tutorial should guide you through the process of calculating inertia for a mesh file in Autodesk Fusion 360. If you need more advanced features, Autodesk’s official documentation and support can provide additional assistance.