Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cf8696
commit d2cefc0
Showing
9 changed files
with
558 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,6 @@ subdirs( | |
CPG_feedback | ||
eajung | ||
ezhu | ||
mcdaly | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
nodes: | ||
n0: [-1.85, 0, -.43] | ||
n1: [-0.76, -3.69, 0.65] | ||
n2: [-1.85, 0, -1.96] | ||
n3: [1.85, -1.08, -3.04] | ||
n4: [-0.76, 0, -3.04] | ||
n5: [-1.85, -3.69, -1.96] | ||
n6: [0.76, 0, -3.04] | ||
n7: [1.85, -1.08, 0.65] | ||
n8: [1.85, 0, -1.96] | ||
n9: [0.76, -3.69, -3.04] | ||
n10: [1.85, 0, -.43] | ||
n11: [-1.85, -1.08, 0.65] | ||
n12: [0.76, 0, 0.65] | ||
n13: [1.85, -3.69, -.43] | ||
n14: [-.76, 0, 0.65] | ||
n15: [-1.85, -1.08, -3.04] | ||
n16: [-1.85, -3.69, -0.43] | ||
n17: [1.85, -2.61, 0.65] | ||
n18: [-0.76, -3.69, -3.04] | ||
n19: [-1.85, -2.61, 0.65] | ||
n20: [1.85, -3.69, -1.96] | ||
n21: [-1.85, -2.61, -3.04] | ||
n22: [0.76, -3.69, 0.65] | ||
n23: [1.85, -2.61, -3.04] | ||
|
||
pair_groups: | ||
rod: | ||
- [n0, n1] | ||
- [n2, n3] | ||
- [n4, n5] | ||
- [n6, n7] | ||
- [n8, n9] | ||
- [n10, n11] | ||
- [n12, n13] | ||
- [n14, n15] | ||
- [n16, n17] | ||
- [n18, n19] | ||
- [n20, n21] | ||
- [n22, n23] | ||
|
||
string: | ||
- [n0, n2] | ||
- [n0, n14] | ||
- [n0, n11] | ||
- [n2, n4] | ||
- [n2, n15] | ||
- [n4, n15] | ||
- [n4, n6] | ||
- [n6, n8] | ||
- [n6, n3] | ||
- [n8, n3] | ||
- [n3, n23] | ||
- [n8, n10] | ||
- [n10, n12] | ||
- [n10, n7] | ||
- [n7, n12] | ||
- [n14, n12] | ||
- [n14, n11] | ||
- [n23, n20] | ||
- [n9, n23] | ||
- [n7, n17] | ||
- [n17, n13] | ||
- [n13, n22] | ||
- [n22, n17] | ||
- [n22, n1] | ||
- [n1, n16] | ||
- [n16, n19] | ||
- [n19, n1] | ||
- [n19, n11] | ||
- [n5, n18] | ||
- [n18, n21] | ||
- [n21, n5] | ||
- [n21, n15] | ||
- [n18, n9] | ||
- [n9, n20] | ||
- [n20, n13] | ||
- [n16, n5] | ||
|
||
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: 800.0 | ||
damping: 60.0 | ||
pretension: 400.0 | ||
history: 0 | ||
max_tension: 3000 | ||
target_velocity: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
substructures: | ||
12BarCube: | ||
path: ./12BarCube.yaml | ||
translation: [0, 25, 0] | ||
rotation: | ||
axis: [1, 1, 0] | ||
angle: 0 | ||
scale: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* 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" | ||
#include "RPLengthController.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]); | ||
|
||
RPLengthController* const tension_sensor = new RPLengthController(); | ||
myModel -> attach(tension_sensor); | ||
|
||
// Add the model to the world | ||
simulation.addModel(myModel); | ||
|
||
simulation.run(); | ||
|
||
// teardown is handled by delete | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
link_directories(${LIB_DIR}) | ||
|
||
link_libraries(core | ||
tgcreator | ||
controllers | ||
util | ||
sensors | ||
terrain | ||
tgOpenGLSupport | ||
yaml-cpp | ||
Adapters | ||
TensegrityModel) | ||
|
||
# add_library(TensegrityModel | ||
# TensegrityModel.cpp) | ||
|
||
add_executable(App12Bar | ||
# TensegrityModel.cpp | ||
App12Bar.cpp | ||
RPLengthController.h | ||
RPLengthController_rand.cpp) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
#ifndef RP_LENGTH_CONTROLLER_H | ||
#define RP_LENGTH_CONTROLLER_H | ||
|
||
/** | ||
* @file RPTensionController.h | ||
* @brief Contains the definition of class RPTensionController. | ||
* @author Brian Tietz | ||
* @version 1.0.0 | ||
* $Id$ | ||
*/ | ||
|
||
// This library | ||
#include "core/tgObserver.h" | ||
#include "controllers/tgBasicController.h" | ||
#include "core/tgBasicActuator.h" | ||
|
||
// The C++ Standard Library | ||
#include <vector> | ||
|
||
// Forward declarations | ||
class TensegrityModel; | ||
|
||
#include "core/abstractMarker.h" //needed in order to fetch node positions | ||
|
||
/** | ||
* A controller to apply uniform tension to a RPModel. Iterates through | ||
* all tgLinearString members and calls tensionMinLengthController | ||
*/ | ||
class RPLengthController : public tgObserver<TensegrityModel> | ||
{ | ||
public: | ||
|
||
/** | ||
* Construct a RPTensionController. | ||
* @param[in] tension, a double specifying the desired tension | ||
* throughougt structure. Must be non-negitive | ||
*/ | ||
RPLengthController(const double length = 400); | ||
|
||
/** | ||
* Nothing to delete, destructor must be virtual | ||
*/ | ||
virtual ~RPLengthController(); | ||
|
||
virtual void onSetup(TensegrityModel& subject); | ||
|
||
/** | ||
* Apply the tension controller. Called my notifyStep(dt) of its | ||
* subject. The tgLinearStrings will update using | ||
* their tensionMinLengthController each step | ||
* @param[in] subject - the RPModel that is being controlled. Must | ||
* have a list of allMuscles populated | ||
* @param[in] dt, current timestep must be positive | ||
*/ | ||
virtual void onStep(TensegrityModel& subject, double dt); | ||
|
||
std::vector<tgBasicController*> m_controllers; | ||
std::vector<double> rand_lengths; | ||
std::vector<tgSpringCableActuator*> actuators; | ||
|
||
private: | ||
|
||
/** | ||
* The tension setpoint that will be passed to the muscles. Set | ||
* in the constructor | ||
*/ | ||
const double m_length; | ||
double globalTime; | ||
int toggle; | ||
|
||
}; | ||
|
||
#endif // RP_LENGTH_CONTROLLER_H |
77 changes: 77 additions & 0 deletions
77
src/dev/mcdaly/12BarTensegrity/RPLengthController_rand.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* 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 RPTensionController.cpp | ||
* @brief Implementation of six strut tensegrity. | ||
* @author Brian Tietz | ||
* @version 1.0.0 | ||
* $Id$ | ||
*/ | ||
|
||
#include <iostream> | ||
// This module | ||
#include "RPLengthController.h" | ||
// This application | ||
#include "../../../yamlbuilder/TensegrityModel.h" | ||
// This library | ||
#include "core/tgBasicActuator.h" | ||
#include "core/tgCast.h" | ||
// The C++ Standard Library | ||
#include <cassert> | ||
#include <stdexcept> | ||
#include <time.h> | ||
|
||
using namespace std; | ||
|
||
RPLengthController::RPLengthController(const double length) : | ||
m_length(length) | ||
{ | ||
if (length < 0.0) | ||
{ | ||
throw std::invalid_argument("Negative length"); | ||
} | ||
} | ||
|
||
RPLengthController::~RPLengthController() | ||
{ | ||
} | ||
|
||
void RPLengthController::onSetup(TensegrityModel& subject) | ||
{ | ||
|
||
actuators = subject.getAllActuators(); | ||
|
||
} | ||
|
||
void RPLengthController::onStep(TensegrityModel& subject, double dt) | ||
{ | ||
if (dt <= 0.0) | ||
{ | ||
throw std::invalid_argument("dt is not positive"); | ||
} | ||
else{ | ||
for(int k=0;k<actuators.size();k++){ | ||
//std::cout << k << ": " << actuators[k]->getTension() << ", "; | ||
std::cout << actuators[k]->getTension() << ", "; | ||
} | ||
std::cout << std::endl; | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.