JointSensor.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2022 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
7 #include <mc_rbdyn/api.h>
8 
9 #include <limits>
10 #include <string>
11 
12 namespace mc_rbdyn
13 {
14 
18 {
20  inline JointSensor() : JointSensor("") {}
21 
27  inline JointSensor(const std::string & jointName) { joint_ = jointName; }
28 
29  JointSensor(const JointSensor &) = default;
30  JointSensor & operator=(const JointSensor &) = default;
31 
32  JointSensor(JointSensor &&) = default;
33  JointSensor & operator=(JointSensor &&) = default;
34 
35  ~JointSensor() noexcept = default;
36 
38  inline const std::string & joint() const noexcept { return joint_; }
39 
41  inline double motorTemperature() const noexcept { return motor_temperature_; }
42 
44  inline void motorTemperature(double motor_temperature) noexcept { motor_temperature_ = motor_temperature; }
45 
47  inline double driverTemperature() const noexcept { return driver_temperature_; }
48 
50  inline void driverTemperature(double driver_temperature) noexcept { driver_temperature_ = driver_temperature; }
51 
53  inline double motorCurrent() const noexcept { return motor_current_; }
54 
56  inline void motorCurrent(double motor_current) noexcept { motor_current_ = motor_current; }
57 
59  inline bool motorStatus() const noexcept { return motor_status_; }
60 
62  inline void motorStatus(bool motor_status) noexcept { motor_status_ = motor_status; }
63 
64 protected:
66  std::string joint_;
67 
68 private:
69  /* Motor temperature (Celcius) */
70  double motor_temperature_ = std::numeric_limits<double>::quiet_NaN();
71  /* Drive temperature (Celcius) */
72  double driver_temperature_ = std::numeric_limits<double>::quiet_NaN();
73  /* Motor current (Ampere) */
74  double motor_current_ = std::numeric_limits<double>::quiet_NaN();
75  /* Motor status (ON/OFF) */
76  bool motor_status_ = true;
77 };
78 
79 inline bool operator==(const JointSensor & lhs, const JointSensor & rhs)
80 {
81  return lhs.joint() == rhs.joint();
82 }
83 
84 } // namespace mc_rbdyn
mc_rbdyn::JointSensor::motorCurrent
double motorCurrent() const noexcept
Definition: JointSensor.h:53
mc_rbdyn::JointSensor::motorCurrent
void motorCurrent(double motor_current) noexcept
Definition: JointSensor.h:56
mc_rbdyn::JointSensor::joint_
std::string joint_
Definition: JointSensor.h:66
mc_rbdyn::JointSensor::driverTemperature
void driverTemperature(double driver_temperature) noexcept
Definition: JointSensor.h:50
mc_rbdyn::JointSensor::JointSensor
JointSensor()
Definition: JointSensor.h:20
mc_rbdyn::JointSensor::motorTemperature
void motorTemperature(double motor_temperature) noexcept
Definition: JointSensor.h:44
mc_rbdyn::JointSensor::joint
const std::string & joint() const noexcept
Definition: JointSensor.h:38
mc_rbdyn::JointSensor::motorStatus
void motorStatus(bool motor_status) noexcept
Definition: JointSensor.h:62
mc_rbdyn::JointSensor::JointSensor
JointSensor(const std::string &jointName)
Definition: JointSensor.h:27
mc_rbdyn::JointSensor::motorTemperature
double motorTemperature() const noexcept
Definition: JointSensor.h:41
api.h
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::JointSensor::driverTemperature
double driverTemperature() const noexcept
Definition: JointSensor.h:47
std
Definition: Contact.h:66
mc_rbdyn
Definition: generic_gripper.h:14
mc_rbdyn::JointSensor::motorStatus
bool motorStatus() const noexcept
Definition: JointSensor.h:59
mc_rbdyn::JointSensor
Definition: JointSensor.h:17