Communication(msgs) inside slave robot

asked 2021-08-08 01:20:25 -0500

Hi,

I am trying to control multiple Jetbots and testing a single Jetbot(with Jetson NANO) first.

I can control(move motor) of a single Jetbot. So, I make my laptop as master(192.168.0.9) and make Jetbot as slave(192.168.0.201). Then I set all the parameters properly, ROS_MASTER_URI and ROS_HOST_NAME and ROS_IP.(I did the smething with other robots a lot)

I just run roscore on my laptop then run the codes on Jetbot. Actually, the master(laptop) does nothing but will be control traffic later. So, everything is same with single robot. (I check ping is working)

However, the python scrypt to control motor(i2c) does not work. It need to subscribe msg and send PWM command to motor. But this python scrypt does not subscribe any msgs. So, I remove all the code with motors(i2c) and run only with subscribing msgs but it keeps failing to get msgs.

I tried to wait for msgs before ros spin(). It pass it and then stop working(not subscribing msgs at all). I add rospy.loginfo() for debugging. And the callback() function is not called.

All other codes are in C++(I prefer c++) and these nodes are working good.(I checked all the output msgs by rostopic) And these c++ codes are working with other robots.

Running rosrun rqt_graph rqt_graph, I can see the right figure of nodes and msgs on slave but on master, I cannot see any msgs and the nodes are in red. I think it is because the master does nothing and there is any node on master subscribing msgs.

So, I wonder if there is anything I should do with python scrypt to sub msgs on slave. (As I prefer C++, I did not use python alot. It is my first time to use python to control robots.)

If you need more information, let me know.

Thanks.

edit retag flag offensive close merge delete