Ask Your Question

how to split the code so that it runs on two computers

asked 2019-11-17 19:50:58 -0500

Redhwan gravatar image

updated 2019-11-17 21:03:29 -0500

I 'd like to split the code into two parts so that part of it runs on my PC and another part run on the Intel board (computer of the robot) at the same time and connects between them using WiFi. my issue: I am running the code for vision-based tracking and map using lidar data. As a result, the frame per second is low and the robot's movement is not smooth. So, I'd like to run the code vision-based tracking on my PC and another part based on lidar data on the computer of the robot.

if it is possible. Please help me or any suggestions and what are its disadvantages?.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-11-18 03:16:06 -0500

Choco93 gravatar image

Yes it is possible, the pc on your robot will master and your pc will be slave. You can follow this tutorial to accomplish that. Once the communication is established you can run your lidar node on intel board and camera node on your own pc. But you have to keep bandwidth limitations in your mind.

edit flag offensive delete link more


Thanks a lot, you saved my day.

Redhwan gravatar image Redhwan  ( 2019-11-18 20:59:24 -0500 )edit

Happy to help :)

Choco93 gravatar image Choco93  ( 2019-11-19 01:55:57 -0500 )edit

I understood that I need to use the same topic and it is a Publisher on master and Subscriber in slave, it is easy with from std_msgs.msg import String. how to do it if I'd like to send numbers as float?

Redhwan gravatar image Redhwan  ( 2019-11-19 05:23:47 -0500 )edit

Slave is only physically apart from master, otherwise have access to all the topics/nodes/services and master has same for slave. Just think of it as you are using the same machine, nothing is different except your access to larger messages like image and pointcloud might be slower. Can you explain last part of your question, I didn't quite get what you are trying to do.

Choco93 gravatar image Choco93  ( 2019-11-19 05:36:57 -0500 )edit

I am changing in these codes in order to understand it , ( it works with me because of the topic works as a Publisher and as a Subscriber at the same time but if I need to use the topic of velocity. how to implement it? because it is always working as a Publisher, it is not working with me. another thing, this ex. hello world works with String as type (string data). if I need to use type (float data) which one should I use instead of String?

Redhwan gravatar image Redhwan  ( 2019-11-19 06:30:54 -0500 )edit

I got a float( but the topic of velocity still not clear with me how to implement it?

Redhwan gravatar image Redhwan  ( 2019-11-19 06:47:32 -0500 )edit

I would suggest you go over ROS beginner tutorials and get a grasp of how ROS ecosystem works. From this you will get at least basic understanding of what you can do and how to do it and you will be better able to navigate your way instead of asking every small detail. To answer your question ROS distro comes with a lot of messages and you can also make your own messages if needed. Float is part of std_msgs/Float32 and so is string. You can also use command line to publish a message like rostopic pub /topic_name message_type message. Where you can tab autocomplete message_type and message.

Choco93 gravatar image Choco93  ( 2019-11-19 06:47:42 -0500 )edit

For velocity you can use Twist or any variant of it like TwistStamped. You can use rosmsg show geometry_msgs/Twist to see what message contains. Like everything ROS related tab autocomplete works here as well and you can see all variants of Twist or all the messages avaiable to you.

Choco93 gravatar image Choco93  ( 2019-11-19 06:52:03 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-11-17 19:50:58 -0500

Seen: 67 times

Last updated: Nov 18 '19