sudo apt install ros-*insert distro name*-*insert package name*
Here is what the above code is Doing:
1. We’re importing the rospy package.
2. We’re importing the String message type from the std_msgs package.
3. We’re defining a callback function that will be called every time a message is received.
4. We’re initializing the node.
5. We’re creating a subscriber that will listen to the chatter topic and call the callback function every time a message is received.
6. We’re spinning the node to keep it from exiting.