transmission.h
Go to the documentation of this file.
1 // Copyright (C) 2013, PAL Robotics S.L.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright notice,
7 // this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name of PAL Robotics S.L. nor the names of its
12 // contributors may be used to endorse or promote products derived from
13 // this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 // POSSIBILITY OF SUCH DAMAGE.
27 
29 
30 #pragma once
31 
32 
33 #include <cstddef>
34 #include <string>
35 #include <vector>
36 #include <memory>
37 #include <stdexcept>
38 
39 namespace transmission_interface
40 {
41 
51 {
52  std::vector<double*> position;
53  std::vector<double*> velocity;
54  std::vector<double*> effort;
55  std::vector<double*> absolute_position;
56  std::vector<double*> torque_sensor;
57 };
58 
63 struct JointData
64 {
65  std::vector<double*> position;
66  std::vector<double*> velocity;
67  std::vector<double*> effort;
68  std::vector<double*> absolute_position;
69  std::vector<double*> torque_sensor;
70 };
71 
92 {
93 public:
94  virtual ~Transmission() = default;
95 
104  virtual void actuatorToJointEffort(const ActuatorData& act_data,
105  JointData& jnt_data) = 0;
106 
115  virtual void actuatorToJointVelocity(const ActuatorData& act_data,
116  JointData& jnt_data) = 0;
117 
126  virtual void actuatorToJointPosition(const ActuatorData& act_data,
127  JointData& jnt_data) = 0;
128 
130  JointData&)
131  {
132  throw std::runtime_error("transmission does not support actuator to joint absolute position");
133  }
134 
136  JointData&)
137  {
138  throw std::runtime_error("transmission does not support actuator to joint torque sensor");
139  }
140 
141  virtual bool hasActuatorToJointAbsolutePosition() const {return false;}
142  virtual bool hasActuatorToJointTorqueSensor() const {return false;}
143 
152  virtual void jointToActuatorEffort(const JointData& jnt_data,
153  ActuatorData& act_data) = 0;
154 
163  virtual void jointToActuatorVelocity(const JointData& jnt_data,
164  ActuatorData& act_data) = 0;
165 
174  virtual void jointToActuatorPosition(const JointData& jnt_data,
175  ActuatorData& act_data) = 0;
176 
178  virtual std::size_t numActuators() const = 0;
179 
181  virtual std::size_t numJoints() const = 0;
182 };
183 
184 typedef std::shared_ptr<Transmission> TransmissionSharedPtr;
185 
186 } // transmission_interface
transmission_interface::Transmission::hasActuatorToJointAbsolutePosition
virtual bool hasActuatorToJointAbsolutePosition() const
Definition: transmission.h:141
transmission_interface::Transmission::jointToActuatorVelocity
virtual void jointToActuatorVelocity(const JointData &jnt_data, ActuatorData &act_data)=0
Transform velocity variables from joint to actuator space.
transmission_interface::Transmission::numActuators
virtual std::size_t numActuators() const =0
transmission_interface::Transmission::~Transmission
virtual ~Transmission()=default
transmission_interface::TransmissionSharedPtr
std::shared_ptr< Transmission > TransmissionSharedPtr
Definition: transmission.h:184
transmission_interface::ActuatorData::velocity
std::vector< double * > velocity
Definition: transmission.h:53
transmission_interface
Definition: bidirectional_effort_joint_interface_provider.h:36
transmission_interface::Transmission::actuatorToJointPosition
virtual void actuatorToJointPosition(const ActuatorData &act_data, JointData &jnt_data)=0
Transform position variables from actuator to joint space.
transmission_interface::Transmission::numJoints
virtual std::size_t numJoints() const =0
transmission_interface::Transmission::hasActuatorToJointTorqueSensor
virtual bool hasActuatorToJointTorqueSensor() const
Definition: transmission.h:142
transmission_interface::JointData::position
std::vector< double * > position
Definition: transmission.h:65
transmission_interface::JointData
Contains pointers to raw data representing the position, velocity and acceleration of a transmission'...
Definition: transmission.h:63
transmission_interface::JointData::torque_sensor
std::vector< double * > torque_sensor
Definition: transmission.h:69
transmission_interface::Transmission::jointToActuatorEffort
virtual void jointToActuatorEffort(const JointData &jnt_data, ActuatorData &act_data)=0
Transform effort variables from joint to actuator space.
transmission_interface::ActuatorData::effort
std::vector< double * > effort
Definition: transmission.h:54
transmission_interface::Transmission
Abstract base class for representing mechanical transmissions.
Definition: transmission.h:91
transmission_interface::Transmission::actuatorToJointEffort
virtual void actuatorToJointEffort(const ActuatorData &act_data, JointData &jnt_data)=0
Transform effort variables from actuator to joint space.
transmission_interface::ActuatorData::position
std::vector< double * > position
Definition: transmission.h:52
transmission_interface::JointData::absolute_position
std::vector< double * > absolute_position
Definition: transmission.h:68
transmission_interface::JointData::effort
std::vector< double * > effort
Definition: transmission.h:67
transmission_interface::ActuatorData::torque_sensor
std::vector< double * > torque_sensor
Definition: transmission.h:56
transmission_interface::JointData::velocity
std::vector< double * > velocity
Definition: transmission.h:66
transmission_interface::Transmission::jointToActuatorPosition
virtual void jointToActuatorPosition(const JointData &jnt_data, ActuatorData &act_data)=0
Transform position variables from joint to actuator space.
transmission_interface::ActuatorData::absolute_position
std::vector< double * > absolute_position
Definition: transmission.h:55
transmission_interface::Transmission::actuatorToJointTorqueSensor
virtual void actuatorToJointTorqueSensor(const ActuatorData &, JointData &)
Definition: transmission.h:135
transmission_interface::ActuatorData
Contains pointers to raw data representing the position, velocity and acceleration of a transmission'...
Definition: transmission.h:50
transmission_interface::Transmission::actuatorToJointVelocity
virtual void actuatorToJointVelocity(const ActuatorData &act_data, JointData &jnt_data)=0
Transform velocity variables from actuator to joint space.
transmission_interface::Transmission::actuatorToJointAbsolutePosition
virtual void actuatorToJointAbsolutePosition(const ActuatorData &, JointData &)
Definition: transmission.h:129


transmission_interface
Author(s): Adolfo Rodriguez Tsouroukdissian
autogenerated on Tue Jun 22 2021 07:34:32