Skip to content

Commit

Permalink
First commit of ezhu dev directory with 6 bar generated through yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
zhu-edward committed Jun 7, 2016
1 parent 6b21e70 commit 00445f6
Show file tree
Hide file tree
Showing 5 changed files with 289 additions and 0 deletions.
68 changes: 68 additions & 0 deletions src/dev/ezhu/6BarSphere.yaml
@@ -0,0 +1,68 @@
# Convention refers to the Solidworks file 6BarGeoModel.sldprt. n0-n3 refer to the 4 nodes of the 2 non-overlapping and non-point-view parallel rods in the front view starting with the bottom left one and going CW, n4-n7 refer to the same in the right view, and n8-n13 refer to the same in the top view.
nodes:
n0: [0, 0, 0]
n1: [0, 10, 0]
n2: [6.18, 10, 0]
n3: [6.18, 0, 0]
n4: [3.09, 1.91, 5]
n5: [3.09, 8.09, 5]
n6: [3.09, 8.09, -5]
n7: [3.09, 1.91, -5]
n8: [-1.91, 5, 3.09]
n11: [-1.91, 5, -3.09]
n12: [8.09, 5, -3.09]
n13: [8.09, 5, 3.09]

pair_groups:
rod:
# Front view
- [n0, n1]
- [n2, n3]

# Right view
- [n4, n5]
- [n6, n7]

# Top view
- [n8, n9]
- [n10, n11]

string:
- [n0, n4]
- [n0, n7]
- [n0, n8]
- [n0, n9]

- [n1, n5]
- [n1, n6]
- [n1, n8]
- [n1, n9]

- [n2, n5]
- [n2, n6]
- [n2, n10]
- [n2, n11]

- [n3, n4]
- [n3, n7]
- [n3, n10]
- [n3, n11]

- [n4, n8]
- [n4, n11]

- [n5, n8]
- [n5, n11]

- [n6, n9]
- [n6, n10]

- [n7, n9]
- [n7, n10]

builders:
rod:
class: tgRodInfo
parameters:
density: 0.688
radius: 0.31
118 changes: 118 additions & 0 deletions src/dev/ezhu/6BarTensegrity/6BarSphere.yaml
@@ -0,0 +1,118 @@
# Convention refers to the Solidworks file 6BarGeoModel.sldprt. n0-n3 refer to the 4 nodes of the 2 non-overlapping and non-point-view parallel rods in the front view starting with the bottom left one and going CW, n4-n7 refer to the same in the right view, and n8-n13 refer to the same in the top view.
nodes:
# Scaling factor of 10 from meters
# n0: [0, 0, 0]
# n1: [0, 10.0, 0]
# n2: [6.18, 10.0, 0]
# n3: [6.18, 0, 0]
# n4: [3.09, 1.91, 5.0]
# n5: [3.09, 8.09, 5.0]
# n6: [3.09, 8.09, -5.0]
# n7: [3.09, 1.91, -5.0]
# n8: [-1.91, 5.0, 3.09]
# n9: [-1.91, 5.0, -3.09]
# n10: [8.09, 5.0, -3.09]
# n11: [8.09, 5.0, 3.09]

# Scaling factor of 30 from meters
n0: [0, 0, 0]
n1: [0, 30.0, 0]
n2: [18.54, 30.0, 0]
n3: [18.54, 0, 0]
n4: [9.27, 5.73, 15.0]
n5: [9.27, 24.27, 15.0]
n6: [9.27, 24.27, -15.0]
n7: [9.27, 5.73, -15.0]
n8: [-5.73, 15.0, 9.27]
n9: [-5.73, 15.0, -9.27]
n10: [24.27, 15.0, -9.27]
n11: [24.27, 15.0, 9.27]

pair_groups:
rod:
# Front view
- [n0, n1]
- [n2, n3]

# Right view
- [n4, n7]
- [n5, n6]

# Top view
- [n8, n11]
- [n9, n10]

string:
- [n0, n4]
- [n0, n7]
- [n0, n8]
- [n0, n9]

- [n1, n5]
- [n1, n6]
- [n1, n8]
- [n1, n9]

- [n2, n5]
- [n2, n6]
- [n2, n10]
- [n2, n11]

- [n3, n4]
- [n3, n7]
- [n3, n10]
- [n3, n11]

- [n4, n8]
- [n4, n11]

- [n5, n8]
- [n5, n11]

- [n6, n9]
- [n6, n10]

- [n7, n9]
- [n7, n10]

# Builders with scaling factor 10
#builders:
# rod:
# class: tgRodInfo
# parameters:
# density: 0.688
# radius: 0.21
# friction: 0.99
# roll_friction: 0.01
# restitution: 0.0
#
# string:
# class: tgBasicActuatorInfo
# parameters:
# stiffness: 400.0
# damping: 20.0
# pretension: 400.0
# history: 0
# max_tension: 1000
# target_velocity: 10

# Builders with scaling factor 30
builders:
rod:
class: tgRodInfo
parameters:
density: 0.688
radius: 0.21
friction: 0.99
roll_friction: 0.01
restitution: 0.0

string:
class: tgBasicActuatorInfo
parameters:
stiffness: 400.0
damping: 60.0
pretension: 1200.0
history: 0
max_tension: 3000
target_velocity: 10
78 changes: 78 additions & 0 deletions src/dev/ezhu/6BarTensegrity/App6Bar.cpp
@@ -0,0 +1,78 @@
/*
* Copyright © 2012, United States Government, as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All rights reserved.
*
* The NASA Tensegrity Robotics Toolkit (NTRT) v1 platform is licensed
* under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/

/**
* @file App6Bar.cpp
* @brief Contains the definition function main() for App6Bar
* which builds a 6 bar tensegrity structure defined in YAML
* @author Edward Zhu
* $Id$
*/

// This application
#include "../../../yamlbuilder/TensegrityModel.h"
// This library
#include "core/terrain/tgBoxGround.h"
#include "core/tgModel.h"
#include "core/tgSimulation.h"
#include "core/tgSimViewGraphics.h"
#include "core/tgWorld.h"
// Bullet Physics
#include "LinearMath/btVector3.h"
// The C++ Standard Library
#include <iostream>

/**
* The entry point.
* @param[in] argc the number of command-line arguments
* @param[in] argv argv[0] is the executable name
* @param[in] argv argv[1] is the path of the YAML encoded structure
* @return 0
*/
int main(int argc, char** argv)
{
// create the ground and world. Specify ground rotation in radians
const double yaw = 0.0;
const double pitch = 0.0;
const double roll = 0.0;
const tgBoxGround::Config groundConfig(btVector3(yaw, pitch, roll));
// the world will delete this
tgBoxGround* ground = new tgBoxGround(groundConfig);

const tgWorld::Config config(98.1); // gravity, dm/sec^2
tgWorld world(config, ground);

// create the view
const double timestep_physics = 0.001; // seconds
const double timestep_graphics = 1.f/60.f; // seconds
tgSimViewGraphics view(world, timestep_physics, timestep_graphics);

// create the simulation
tgSimulation simulation(view);

// create the models with their controllers and add the models to the simulation
TensegrityModel* const myModel = new TensegrityModel(argv[1]);

// Add the model to the world
simulation.addModel(myModel);

simulation.run();

// teardown is handled by delete
return 0;
}
20 changes: 20 additions & 0 deletions src/dev/ezhu/6BarTensegrity/CMakeLists.txt
@@ -0,0 +1,20 @@
link_directories(${LIB_DIR})

link_libraries(core
tgcreator
util
sensors
terrain
tgOpenGLSupport
yaml-cpp
Adapters
TensegrityModel)

# add_library(TensegrityModel
# TensegrityModel.cpp)

add_executable(App6Bar
# TensegrityModel.cpp
App6Bar.cpp)


5 changes: 5 additions & 0 deletions src/dev/ezhu/CMakeLists.txt
@@ -0,0 +1,5 @@
Project(ezhu)

subdirs(
6BarTensegrity
)

0 comments on commit 00445f6

Please sign in to comment.