joint_states_publisher_mock.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Pilz GmbH & Co. KG
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13 
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef PRBT_HARDWARE_SUPPORT_JOINT_STATES_PUBLISHER_MOCK_H
19 #define PRBT_HARDWARE_SUPPORT_JOINT_STATES_PUBLISHER_MOCK_H
20 
21 #include <atomic>
22 #include <mutex>
23 #include <thread>
24 
25 #include <ros/ros.h>
26 #include <sensor_msgs/JointState.h>
27 
28 namespace prbt_hardware_support
29 {
30 
35 {
36 public:
38 
40 
46  void startAsync(bool move = false);
47 
48  void terminate();
49 
53  sensor_msgs::JointStateConstPtr getNextMessage();
54 
55 private:
56  void start(bool positions_fixed);
57 
58 private:
61  std::thread thread_;
62  std::atomic_bool terminate_;
63  std::mutex msg_mutex_;
64  sensor_msgs::JointState msg_;
65 };
66 
67 } // namespace prbt_hardware_support
68 
69 #endif
void startAsync(bool move=false)
Start a new thread publishing joint states.
Asynchronously publishes predefined messages on the /joint_states topic with rate ~100Hz...
sensor_msgs::JointStateConstPtr getNextMessage()
Obtain the message that is published next.


prbt_hardware_support
Author(s):
autogenerated on Tue Feb 2 2021 03:50:17