Loading...
Searching...
No Matches
Body.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// includes
8// std
9#include <string>
10
11// SpaceVecAlg
12#include <SpaceVecAlg/SpaceVecAlg>
13
14namespace rbd
15{
16
20class Body
21{
22public:
23 Body() {}
24
29 Body(const sva::RBInertiad & rbInertia, std::string name) : inertia_(rbInertia), name_(std::move(name)) {}
30
37 Body(double mass, const Eigen::Vector3d & com, const Eigen::Matrix3d & inertia, std::string name)
38 : inertia_(mass, mass * com, inertia), name_(std::move(name))
39 {
40 }
41
43 const std::string & name() const
44 {
45 return name_;
46 }
47
49 const sva::RBInertiad & inertia() const
50 {
51 return inertia_;
52 }
53
54 bool operator==(const Body & b) const
55 {
56 return name_ == b.name_;
57 }
58
59 bool operator!=(const Body & b) const
60 {
61 return name_ != b.name_;
62 }
63
64private:
65 sva::RBInertiad inertia_;
66 std::string name_;
67};
68
69inline std::ostream & operator<<(std::ostream & out, const Body & b)
70{
71 out << "Body: " << b.name();
72 return out;
73}
74
75} // namespace rbd
Definition Body.h:21
bool operator!=(const Body &b) const
Definition Body.h:59
Body(double mass, const Eigen::Vector3d &com, const Eigen::Matrix3d &inertia, std::string name)
Definition Body.h:37
bool operator==(const Body &b) const
Definition Body.h:54
const std::string & name() const
Definition Body.h:43
Body()
Definition Body.h:23
Body(const sva::RBInertiad &rbInertia, std::string name)
Definition Body.h:29
const sva::RBInertiad & inertia() const
Definition Body.h:49
Definition common.h:21
std::ostream & operator<<(std::ostream &out, const Body &b)
Definition Body.h:69