Getting Started¶
Installation¶
See the GitHub page for installation instructions.
Loading Articulated Bodies with URDFs¶
URDF specifications get loaded into an ArticulatedBody
object. This object
is the central data structure of spatial-dyn.
C++¶
#include <spatial_dyn/spatial_dyn>
namespace dyn = spatial_dyn;
int main(int argc, char* argv[]) {
// Load URDF model.
dyn::ArticulatedBody ab(dyn::urdf::LoadModel("resources/robot.urdf"));
// Set robot state.
Eigen::VectorXd q;
q << 0., 0., 0., 0., 0., 0.;
ab.set_q(q);
return 0;
}
See the C++ spatial_dyn::ArticulatedBody reference for more details.
Python¶
import numpy as np
import spatialdyn as dyn
# Load URDF model.
ab = dyn.ArticulatedBody(dyn.urdf.load_model("resources/robot.urdf"))
# Set robot state.
ab.q = np.zeros((6,))
See the Python spatialdyn.ArticulatedBody
reference for more details.