rrbot_hw_interface.cpp
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2015, University of Colorado, Boulder
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 Univ of CO, Boulder 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 /* Author: Dave Coleman
36  Desc: Example ros_control hardware interface blank template for the RRBot
37  For a more detailed simulation example, see sim_hw_interface.cpp
38 */
39 
41 
42 namespace rrbot_control
43 {
44 
46  : ros_control_boilerplate::GenericHWInterface(nh, urdf_model)
47 {
48  ROS_INFO_NAMED("rrbot_hw_interface", "RRBotHWInterface Ready.");
49 }
50 
52 {
53  // ----------------------------------------------------
54  // ----------------------------------------------------
55  // ----------------------------------------------------
56  //
57  // FILL IN YOUR READ COMMAND FROM USB/ETHERNET/ETHERCAT/SERIAL ETC HERE
58  //
59  // ----------------------------------------------------
60  // ----------------------------------------------------
61  // ----------------------------------------------------
62 }
63 
65 {
66  // Safety
67  enforceLimits(elapsed_time);
68 
69  // ----------------------------------------------------
70  // ----------------------------------------------------
71  // ----------------------------------------------------
72  //
73  // FILL IN YOUR WRITE COMMAND TO USB/ETHERNET/ETHERCAT/SERIAL ETC HERE
74  //
75  // FOR A EASY SIMULATION EXAMPLE, OR FOR CODE TO CALCULATE
76  // VELOCITY FROM POSITION WITH SMOOTHING, SEE
77  // sim_hw_interface.cpp IN THIS PACKAGE
78  //
79  // DUMMY PASS-THROUGH CODE
80  for (std::size_t joint_id = 0; joint_id < num_joints_; ++joint_id)
81  joint_position_[joint_id] += joint_position_command_[joint_id];
82  // END DUMMY CODE
83  //
84  // ----------------------------------------------------
85  // ----------------------------------------------------
86  // ----------------------------------------------------
87 }
88 
90 {
91  // ----------------------------------------------------
92  // ----------------------------------------------------
93  // ----------------------------------------------------
94  //
95  // CHOOSE THE TYPE OF JOINT LIMITS INTERFACE YOU WANT TO USE
96  // YOU SHOULD ONLY NEED TO USE ONE SATURATION INTERFACE,
97  // DEPENDING ON YOUR CONTROL METHOD
98  //
99  // EXAMPLES:
100  //
101  // Saturation Limits ---------------------------
102  //
103  // Enforces position and velocity
105  //
106  // Enforces velocity and acceleration limits
107  // vel_jnt_sat_interface_.enforceLimits(period);
108  //
109  // Enforces position, velocity, and effort
110  // eff_jnt_sat_interface_.enforceLimits(period);
111 
112  // Soft limits ---------------------------------
113  //
114  // pos_jnt_soft_limits_.enforceLimits(period);
115  // vel_jnt_soft_limits_.enforceLimits(period);
116  // eff_jnt_soft_limits_.enforceLimits(period);
117  //
118  // ----------------------------------------------------
119  // ----------------------------------------------------
120  // ----------------------------------------------------
121 }
122 
123 } // namespace
virtual void read(ros::Duration &elapsed_time)
Read the state from the robot hardware.
#define ROS_INFO_NAMED(name,...)
RRBotHWInterface(ros::NodeHandle &nh, urdf::Model *urdf_model=NULL)
Constructor.
void enforceLimits(const ros::Duration &period)
virtual void write(ros::Duration &elapsed_time)
Write the command to the robot hardware.
virtual void enforceLimits(ros::Duration &period)
joint_limits_interface::PositionJointSaturationInterface pos_jnt_sat_interface_


ros_control_boilerplate
Author(s): Dave Coleman
autogenerated on Thu Feb 25 2021 03:58:54