I am new to OpenSim and recently compiled version 3.3 on Linux (Ubuntu Xenial 16.04) with Simbody 3.5.4. Now I am trying to reproduce the "Performing a Simulation" example (https://simtk-confluence.stanford.edu/d ... Simulation). I followed the tutorial until including the "Get the Model's Ground Body" section (see code below) and copied the .vtp-files into the project directory.
As I understand it, the Windows GUI is not available on Linux, thus I tried to use the API Visualizer (as outlined in https://simtk-confluence.stanford.edu/d ... Visualizer). Now, when I compile and execute the code, the visualizer window opens, but not geometry is rendered. I merely get a blank screen with the "View" and "Show" menus.
Here is the code:
Code: Select all
#include <OpenSim/OpenSim.h>
using namespace OpenSim;
int main() {
try {
// Create an OpenSim model and set its name
Model osimModel;
osimModel.setUseVisualizer(true);
ModelDisplayHints &displayHints = osimModel.updDisplayHints();
displayHints.setShowWrapGeometry(true)
.setShowContactGeometry(true)
.setShowMusclePaths(true)
.setShowPathPoints(true)
.setShowMarkers(true)
.setShowForces(true)
.setShowFrames(true)
.setShowLabels(true)
.setShowDebugGeometry(true);
osimModel.setName("tugOfWar");
// Get a reference to the model's ground body
OpenSim::Body& ground = osimModel.getGroundBody();
// Add display geometry to the ground to visualize
ground.addDisplayGeometry("ground.vtp");
ground.addDisplayGeometry("anchor1.vtp");
ground.addDisplayGeometry("anchor2.vtp");
osimModel.print("tugOfWar_model.osim");
osimModel.initSystem();
std::cin.get();
} catch (OpenSim::Exception ex) {
std::cout << ex.getMessage() << std::endl;
return 1;
}
std::cout << "OpenSim example completed successfully.\n";
return 0;
}
Thanks in advance. Any help is appreciated.
Lucas