can we pass publisher as an argument in a function (ros2)?

asked 2019-02-11 23:06:01 -0500

himanshu gravatar image

updated 2019-02-12 02:46:23 -0500

gvdhoorn gravatar image

I am using 3-5 publisher in my code implementation and I want to pass it as a argument but it is giving error related to type.

ERROR:-
‘rclcpp::Publisher’ is not a type
 static inline void handlePacket(const Packet *packet , rclcpp::Publisher &pub_fix)
                                                                ^
edit retag flag offensive close merge delete

Comments

I would quite like to know this too! I have ros code that was passing "ros::Publisher & markerPublisher" as an argument and I'm trying to migrate it to ros2

CPE gravatar image CPE  ( 2022-06-29 19:54:15 -0500 )edit

i have the same problem, did you fix this ?

longcucong gravatar image longcucong  ( 2022-12-06 22:18:23 -0500 )edit