joint.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2008, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of the Willow Garage nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 /*
35  *
36  */
37 #ifndef JOINT_H
38 #define JOINT_H
39 
40 #include <tinyxml.h>
41 #include <urdf_model/joint.h>
42 
43 
44 namespace pr2_mechanism_model {
45 
46 class JointState;
47 
48 class JointStatistics
49 {
50  public:
53  violated_limits_(false), initialized_(false){}
54 
55  void update(JointState* s);
56  void reset();
57 
58  double odometer_;
60  double max_abs_velocity_;
61  double max_abs_effort_;
62  bool violated_limits_;
63 
64  private:
65  bool initialized_;
66  double old_position_;
67 };
68 
69 
70 
71 class JointState
72 {
73 public:
75  void enforceLimits();
76 
78  void getLimits(double &effort_low, double &effort_high);
79 
81 #if URDFDOM_1_0_0_API
82  urdf::JointConstSharedPtr joint_;
83 #else
85 #endif
86 
88  double position_;
89 
91  double velocity_;
92 
95 
96  // joint statistics
98 
100  double commanded_effort_;
101 
104 
106  double reference_position_;
107 
109  JointState() : position_(0.0), velocity_(0.0), measured_effort_(0.0),
111 };
112 
113 enum
114 {
115  JOINT_NONE,
119  JOINT_FIXED,
122 };
123 
124 
125 }
126 
127 #endif /* JOINT_H */
pr2_mechanism_model::JointStatistics::JointStatistics
JointStatistics()
Definition: joint.h:83
pr2_mechanism_model::JointState::enforceLimits
void enforceLimits()
Modify the commanded_effort_ of the joint state so that the joint limits are satisfied.
Definition: joint.cpp:77
boost::shared_ptr< const urdf::Joint >
pr2_mechanism_model::JointState::velocity_
double velocity_
The joint velocity in randians/sec or meters/sec (read-only variable)
Definition: joint.h:123
pr2_mechanism_model
Definition: chain.h:41
pr2_mechanism_model::JointStatistics
Definition: joint.h:80
pr2_mechanism_model::JointState::JointState
JointState()
Constructor.
Definition: joint.h:141
pr2_mechanism_model::JointStatistics::reset
void reset()
Definition: joint.cpp:66
pr2_mechanism_model::JointState::position_
double position_
The joint position in radians or meters (read-only variable)
Definition: joint.h:120
pr2_mechanism_model::JOINT_FIXED
@ JOINT_FIXED
Definition: joint.h:151
pr2_mechanism_model::JointStatistics::max_abs_effort_
double max_abs_effort_
Definition: joint.h:93
pr2_mechanism_model::JointState::joint_
boost::shared_ptr< const urdf::Joint > joint_
A pointer to the corresponding urdf::Joint from the urdf::Model.
Definition: joint.h:116
pr2_mechanism_model::JointState::getLimits
void getLimits(double &effort_low, double &effort_high)
Returns the safety effort limits given the current position and velocity.
Definition: joint.cpp:88
pr2_mechanism_model::JointStatistics::violated_limits_
bool violated_limits_
Definition: joint.h:94
pr2_mechanism_model::JOINT_NONE
@ JOINT_NONE
Definition: joint.h:147
pr2_mechanism_model::JointStatistics::max_position_
double max_position_
Definition: joint.h:91
pr2_mechanism_model::JointState::commanded_effort_
double commanded_effort_
The effort the joint should apply in Nm or N (write-to variable)
Definition: joint.h:132
pr2_mechanism_model::JointStatistics::update
void update(JointState *s)
Definition: joint.cpp:46
pr2_mechanism_model::JointState::calibrated_
bool calibrated_
Bool to indicate if the joint has been calibrated or not.
Definition: joint.h:135
pr2_mechanism_model::JOINT_CONTINUOUS
@ JOINT_CONTINUOUS
Definition: joint.h:149
pr2_mechanism_model::JointStatistics::old_position_
double old_position_
Definition: joint.h:98
pr2_mechanism_model::JOINT_TYPES_MAX
@ JOINT_TYPES_MAX
Definition: joint.h:153
pr2_mechanism_model::JointStatistics::initialized_
bool initialized_
Definition: joint.h:97
pr2_mechanism_model::JointState::measured_effort_
double measured_effort_
The measured joint effort in Nm or N (read-only variable)
Definition: joint.h:126
pr2_mechanism_model::JOINT_PRISMATIC
@ JOINT_PRISMATIC
Definition: joint.h:150
pr2_mechanism_model::JOINT_PLANAR
@ JOINT_PLANAR
Definition: joint.h:152
pr2_mechanism_model::JointState::reference_position_
double reference_position_
The position of the optical flag that was used to calibrate this joint.
Definition: joint.h:138
pr2_mechanism_model::JointState::joint_statistics_
JointStatistics joint_statistics_
Definition: joint.h:129
pr2_mechanism_model::JointStatistics::max_abs_velocity_
double max_abs_velocity_
Definition: joint.h:92
pr2_mechanism_model::JointStatistics::min_position_
double min_position_
Definition: joint.h:91
pr2_mechanism_model::JOINT_ROTARY
@ JOINT_ROTARY
Definition: joint.h:148
pr2_mechanism_model::JointStatistics::odometer_
double odometer_
Definition: joint.h:90


pr2_mechanism_model
Author(s): Eric Berger berger@willowgarage.com, Stuart Glaser, Wim Meeussen
autogenerated on Mon Mar 6 2023 03:49:17