GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
#include "pinocchio/parsers/urdf.hpp" |
||
2 |
|||
3 |
#include "pinocchio/algorithm/joint-configuration.hpp" |
||
4 |
#include "pinocchio/algorithm/kinematics.hpp" |
||
5 |
|||
6 |
#include <iostream> |
||
7 |
|||
8 |
// PINOCCHIO_MODEL_DIR is defined by the CMake but you can define your own directory here. |
||
9 |
#ifndef PINOCCHIO_MODEL_DIR |
||
10 |
#define PINOCCHIO_MODEL_DIR "path_to_the_model_dir" |
||
11 |
#endif |
||
12 |
|||
13 |
1 |
int main(int argc, char ** argv) |
|
14 |
{ |
||
15 |
using namespace pinocchio; |
||
16 |
|||
17 |
// You should change here to set up your own URDF file or just pass it as an argument of this example. |
||
18 |
✓✗✓✗ ✓✗✗✗ ✗✓✓✗ ✓✗✗✗ ✗✗✗✗ |
3 |
const std::string urdf_filename = (argc<=1) ? PINOCCHIO_MODEL_DIR + std::string("/example-robot-data/robots/ur_description/urdf/ur5_robot.urdf") : argv[1]; |
19 |
|||
20 |
// Load the urdf model |
||
21 |
✓✗ | 2 |
Model model; |
22 |
✓✗ | 1 |
pinocchio::urdf::buildModel(urdf_filename,model); |
23 |
✓✗✓✗ ✓✗ |
1 |
std::cout << "model name: " << model.name << std::endl; |
24 |
|||
25 |
// Create data required by the algorithms |
||
26 |
✓✗ | 2 |
Data data(model); |
27 |
|||
28 |
// Sample a random configuration |
||
29 |
✓✗ | 2 |
Eigen::VectorXd q = randomConfiguration(model); |
30 |
✓✗✓✗ ✓✗✓✗ |
1 |
std::cout << "q: " << q.transpose() << std::endl; |
31 |
|||
32 |
// Perform the forward kinematics over the kinematic tree |
||
33 |
✓✗ | 1 |
forwardKinematics(model,data,q); |
34 |
|||
35 |
// Print out the placement of each joint of the kinematic tree |
||
36 |
✓✓ | 8 |
for(JointIndex joint_id = 0; joint_id < (JointIndex)model.njoints; ++joint_id) |
37 |
✓✗✓✗ |
7 |
std::cout << std::setw(24) << std::left |
38 |
✓✗✓✗ |
7 |
<< model.names[joint_id] << ": " |
39 |
✓✗✓✗ |
7 |
<< std::fixed << std::setprecision(2) |
40 |
✓✗✓✗ ✓✗ |
14 |
<< data.oMi[joint_id].translation().transpose() |
41 |
✓✗ | 7 |
<< std::endl; |
42 |
1 |
} |
Generated by: GCOVR (Version 4.2) |