Main Page
Namespaces
Classes
Files
File List
File Members
client
ros_lib
ros
publisher.h
Go to the documentation of this file.
1
/*
2
* Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
18
#ifndef _ROS_PUBLISHER_H_
19
#define _ROS_PUBLISHER_H_
20
21
#include "
rosserial_msgs/TopicInfo.h
"
22
#include "
node_handle.h
"
23
24
namespace
ros
{
25
26
/* Generic Publisher */
27
class
Publisher
28
{
29
public
:
30
Publisher
(
const
char
* topic_name, Msg * msg,
int
endpoint=
rosserial_msgs::TopicInfo::ID_PUBLISHER
) :
31
topic_(topic_name),
32
msg_(msg),
33
endpoint_(endpoint) {};
34
35
int
publish
(
const
Msg * msg ) {
return
nh_->
publish
(id_, msg); };
36
int
getEndpointType(){
return
endpoint_; }
37
38
const
char
* topic_;
39
Msg *msg_;
40
// id_ and no_ are set by NodeHandle when we advertise
41
int
id_;
42
NodeHandleBase_* nh_;
43
44
private
:
45
int
endpoint_;
46
};
47
48
}
49
50
#endif
ros::Publisher::publish
void publish(const boost::shared_ptr< M > &message) const
ros::Publisher::Publisher
Publisher()
node_handle.h
ros::NodeHandleBase_::publish
virtual int publish(int id, const Msg *msg)=0
rosserial_msgs::TopicInfo::ID_PUBLISHER
Definition:
TopicInfo.h:37
ros
TopicInfo.h
cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Tue Oct 20 2020 03:35:57