Skip to content

Commit

Permalink
First commit of horizontal spine generated using yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
zhu-edward committed Jun 6, 2016
1 parent 4a5e516 commit 1b2ff14
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/dev/ultra-spine/CMakeLists.txt
Expand Up @@ -3,4 +3,5 @@ Project(ultra-spine)
subdirs(
VerticalSpine
VerticalSpine_CableCollision
HorizontalSpine
)
78 changes: 78 additions & 0 deletions src/dev/ultra-spine/HorizontalSpine/AppHorizontalSpine.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 AppHorizontalSpine.cpp
* @brief Contains the definition function main() for AppHorizontalSpine
* which builds a horizontal spine structure defined in YAML
* @author Edward Zhu, Andrew Sabelhaus & Lara Janse van Vuuren
* $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/ultra-spine/HorizontalSpine/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(AppHorizontalSpine
# TensegrityModel.cpp
AppHorizontalSpine.cpp)


27 changes: 27 additions & 0 deletions src/dev/ultra-spine/HorizontalSpine/TetrahedralSpine.yaml
@@ -0,0 +1,27 @@
substructures:
t1/t2/t3/t4/t5/t6:
path: ./Tetrahedron.yaml
offset: [0, 0 , -12]

bond_groups:
string:
t1/t2/t3/t4/t5/t6/node_node:
- [front, front]
- [right, right]
- [back, back]
- [left, left]
- [right, front]
- [right, left]
- [back, front]
- [back, left]

builders:
string:
class: tgBasicActuatorInfo
parameters:
stiffness: 1000.0
damping: 10.0
pretension: 0.0
history: 1
max_tension: 7000.0
target_velocity: 12.0
20 changes: 20 additions & 0 deletions src/dev/ultra-spine/HorizontalSpine/Tetrahedron.yaml
@@ -0,0 +1,20 @@
nodes:
center: [0, 10, 0]
front: [10, 20, 10]
right: [10, 0, -10]
back: [-10, 20, -10]
left: [-10, 0,10]

pair_groups:
rod:
- [center, front]
- [center, right]
- [center, back]
- [center, left]

builders:
rod:
class: tgRodInfo
parameters:
density: 0.014
radius: 0.5

0 comments on commit 1b2ff14

Please sign in to comment.