utils.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
7 namespace tasks
8 {
9 
10 namespace qp
11 {
12 
13 inline int findJointFromVector(const rbd::MultiBody & mb, int line, bool withBase)
14 {
15  int start = withBase ? 0 : 1;
16  for(int j = start; j < int(mb.nrJoints()); ++j)
17  {
18  if(line >= start && line <= (start + mb.joint(j).dof())) { return j; }
19  start += mb.joint(j).dof();
20  }
21  return -1;
22 }
23 
24 inline bool compareDof(const rbd::MultiBody & mb1, const rbd::MultiBody & mb2)
25 {
26  return mb1.nrDof() < mb2.nrDof();
27 }
28 
29 } // namespace qp
30 
31 } // namespace tasks
tasks::qp::findJointFromVector
int findJointFromVector(const rbd::MultiBody &mb, int line, bool withBase)
Definition: utils.h:13
tasks::qp::compareDof
bool compareDof(const rbd::MultiBody &mb1, const rbd::MultiBody &mb2)
Definition: utils.h:24
tasks
Definition: GenQPUtils.h:18