ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to subscribe from ROS Publisher in Arduino?

asked 2021-08-20 03:50:39 -0500

jang22 gravatar image

I am currently working on arduino <-> ROS and now my problem is that I cannot receive published data in arduino. I followed rosserial subscribing, publishing tutorials but it seems received message looking at serial monitor is only 0s.

Below is my code used to subscribe in Arduino

ros::NodeHandle nh;

void receiveANGLE( const angle::FSS& msg) { angle2 = msg.Data; }

ros::Subscriber<angle::fss> sub("FSS", &receiveANGLE);

FSS is the topic I am sending from ROS publisher and it is perfectly sending datas properly. Also, angle is my package name and FSS is also name for my message which is int32. if i look at angle2 in serial monitor, only 0 0 0 0 0 0 values are seen.

what could be the problem??

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-08-24 01:37:28 -0500

jang22 gravatar image

updated 2021-08-27 01:05:28 -0500

i figured it out...

It was really embarrasing, the thing was i didn't fully understand how the entire communication system is formed and ran.

I first thought just by publishing using ROS and uploading in Arduino, I will be able to get published data in Arduino. However, I had to run " rosrun rosserial_python serial_node.py _port:=ttyACM0 _baud:=57600" command for topic from ROS to be connected and subscribed from Arduino. In short, I thought serial connection from ROS and arduino will just be formed by uploading Arduino codes but I had to set up the connection for them.

srry for late upload...

edit flag offensive delete link more

Comments

2

Can you please! provide the solution, and make your answer tick so that can be helpful to others.

You can click on the edit button over here to update your answer.

Ranjit Kathiriya gravatar image Ranjit Kathiriya  ( 2021-08-24 02:17:05 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2021-08-20 03:50:39 -0500

Seen: 377 times

Last updated: Aug 27 '21