Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pendulum for ApplyForceTorque and MouseDrag demo #19

Merged
merged 3 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions harmonic_demo/Pendulum/model.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<model>
<name>Pendulum</name>
<version>1.0</version>
<sdf version="1.11">model.sdf</sdf>

<author>
<name>Henrique Barros Oliveira</name>
<email>henrique.barrosoliveira@usp.br</email>
</author>

<description>
Pendulum for demonstrating ApplyForceTorque and MouseDrag plugins
</description>

</model>
119 changes: 119 additions & 0 deletions harmonic_demo/Pendulum/model.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<sdf version="1.11">
<model name="pendulum">
<link name="base">
<inertial auto="true"/>
<visual name="vis_plate_on_ground">
<pose>0 0 0.01 0 0 0</pose>
<geometry>
<cylinder>
<radius>0.1</radius>
<length>0.02</length>
</cylinder>
</geometry>
<material>
<diffuse>0.2 0.1 0.1</diffuse>
<specular>0.2 0.2 0.2</specular>
</material>
</visual>
<visual name="vis_pole">
<pose>-0.05 0 0.2 0 0 0</pose>
<geometry>
<box>
<size>0.05 0.05 0.4</size>
</box>
</geometry>
<material>
<diffuse>0.2 0.1 0.1</diffuse>
<specular>0.2 0.2 0.2</specular>
</material>
</visual>
<collision name="col_plate_on_ground">
<density>1</density>
<pose>0 0 0.01 0 0 0</pose>
<geometry>
<cylinder>
<radius>0.1</radius>
<length>0.02</length>
</cylinder>
</geometry>
</collision>
<collision name="col_pole">
<density>1000</density>
<pose>-0.05 0 0.2 0 0 0</pose>
<geometry>
<box>
<size>0.05 0.05 0.4</size>
</box>
</geometry>
</collision>
</link>

<!-- upper link, length 1, IC -90 degrees -->
<link name="upper_link">
<pose>0 0 0.35 3.1415 0 0</pose>
<self_collide>0</self_collide>
<inertial auto="true"/>
<visual name="vis_upper_joint">
<pose>0.04 0 0 0 1.5708 0</pose>
<geometry>
<cylinder>
<radius>0.02</radius>
<length>0.2</length>
</cylinder>
</geometry>
<material>
<diffuse>0.0 1.0 1.0</diffuse>
<specular>1.0 1.0 1.0</specular>
</material>
</visual>
<visual name="vis_cylinder">
<pose>0.1 0 0.15 0 0 0</pose>
<geometry>
<cylinder>
<radius>0.02</radius>
<length>0.3</length>
</cylinder>
</geometry>
<material>
<diffuse>0.0 1.0 1.0</diffuse>
<specular>1.0 1.0 1.0</specular>
</material>
</visual>
<collision name="col_upper_joint">
<density>1000</density>
<pose>0.04 0 0 0 1.5708 0</pose>
<geometry>
<cylinder>
<radius>0.02</radius>
<length>0.2</length>
</cylinder>
</geometry>
</collision>
<collision name="col_cylinder">
<density>1000</density>
<pose>0.1 0 0.15 0 0 0</pose>
<geometry>
<cylinder>
<radius>0.02</radius>
<length>0.3</length>
</cylinder>
</geometry>
</collision>
</link>

<!-- pin joint for upper link, at origin of upper link -->
<joint name="upper_joint" type="revolute">
<parent>base</parent>
<child>upper_link</child>
<axis>
<xyz>1.0 0 0</xyz>
</axis>
</joint>

<joint name="fix_to_world" type="fixed">
<parent>world</parent>
<child>base</child>
</joint>
</model>
</sdf>
23 changes: 22 additions & 1 deletion harmonic_demo/harmonic.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,23 @@
<property type="string" key="state">docked_collapsed</property>
</gz-gui>
</plugin>

<!-- Apply Force and Torque -->
<plugin filename="ApplyForceTorque">
<gz-gui>
<property type="string" key="state">docked_collapsed</property>
</gz-gui>
</plugin>

<!-- Mouse Drag -->
<plugin filename="MouseDrag">
<gz-gui>
<property type="string" key="state">docked_collapsed</property>
</gz-gui>

<rotation_stiffness>50</rotation_stiffness>
<position_stiffness>200</position_stiffness>
</plugin>

</gui>

Expand Down Expand Up @@ -443,6 +460,11 @@
<name>Office Chair</name>
<uri>Office Chair</uri>
</include>
<include>
<pose>1.85 -5.05 7.82 0 0 0</pose>
<name>Pendulum</name>
<uri>Pendulum</uri>
</include>
<include>
<name>Pendulum_sculpture</name>
<pose>3.43 -3.82 7.64 0 0 1.57</pose>
Expand Down Expand Up @@ -496,4 +518,3 @@
</model>
</world>
</sdf>