Collision.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2019 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
7 #include <mc_rbdyn/api.h>
8 
9 #include <optional>
10 #include <string>
11 #include <vector>
12 
17 namespace mc_rbdyn
18 {
19 
21 {
22  Collision() : body1("NONE"), body2("NONE") {}
23  Collision(const std::string & b1,
24  const std::string & b2,
25  double i,
26  double s,
27  double d,
28  const std::optional<std::vector<std::string>> & r1Joints = {},
29  const std::optional<std::vector<std::string>> & r2Joints = {},
30  bool r1JointsInactive = false,
31  bool r2JointsInactive = false)
32  : body1(b1), body2(b2), iDist(i), sDist(s), damping(d), r1Joints(r1Joints), r2Joints(r2Joints),
33  r1JointsInactive(r1JointsInactive), r2JointsInactive(r2JointsInactive)
34  {
35  }
36  std::string body1;
37  std::string body2;
38  double iDist;
39  double sDist;
40  double damping;
48  std::optional<std::vector<std::string>> r1Joints;
49  std::optional<std::vector<std::string>>
51  bool r1JointsInactive = false;
52  bool r2JointsInactive = false;
53  inline bool isNone() { return body1 == "NONE" && body2 == "NONE"; }
54 
55  bool operator==(const Collision & rhs) const;
56  bool operator!=(const Collision & rhs) const;
57 };
58 
59 MC_RBDYN_DLLAPI std::ostream & operator<<(std::ostream & os, const Collision & c);
60 
61 } // namespace mc_rbdyn
mc_rbdyn::Collision::iDist
double iDist
Definition: Collision.h:38
mc_rbdyn::Collision::body1
std::string body1
Definition: Collision.h:36
api.h
mc_rbdyn::Collision::Collision
Collision()
Definition: Collision.h:22
Collision
Used to define a collision constraint between two bodies.
mc_rbdyn::Collision::r1Joints
std::optional< std::vector< std::string > > r1Joints
Definition: Collision.h:48
mc_rbdyn::Collision::r2Joints
std::optional< std::vector< std::string > > r2Joints
Definition: Collision.h:50
MC_RBDYN_DLLAPI
#define MC_RBDYN_DLLAPI
Definition: api.h:50
mc_rbdyn::operator==
bool operator==(const mc_rbdyn::BodySensor &lhs, const mc_rbdyn::BodySensor &rhs)
Definition: BodySensor.h:147
mc_rbdyn
Definition: generic_gripper.h:14
mc_rbdyn::Collision::damping
double damping
Definition: Collision.h:40
mc_rbdyn::Collision
Definition: Collision.h:20
mc_rbdyn::Collision::isNone
bool isNone()
Definition: Collision.h:53
mc_rbdyn::Collision::Collision
Collision(const std::string &b1, const std::string &b2, double i, double s, double d, const std::optional< std::vector< std::string >> &r1Joints={}, const std::optional< std::vector< std::string >> &r2Joints={}, bool r1JointsInactive=false, bool r2JointsInactive=false)
Definition: Collision.h:23
mc_rbdyn::Collision::sDist
double sDist
Definition: Collision.h:39
mc_rbdyn::operator<<
MC_RBDYN_DLLAPI std::ostream & operator<<(std::ostream &os, const Collision &c)
mc_rbdyn::Collision::body2
std::string body2
Definition: Collision.h:37