Structure of ROS python program
Hi! I want to write some ros scripts in python language. My question is about structure of program.
Where is place to initiate variables, where is place for topics or other rospy objects and how to write an infinite loop with access to all variables and objets. For example like in Arduino program, where are setup() and loop() functions. Whats the difference between if __name__=='__manin__'
and while not rospy.is_shutdown()
Can u give me something like a template? Im making a lot of mess in my programs and cant understand exact way of program working without this knowledge
Asked by Marseiliais on 2019-09-07 12:50:44 UTC
Answers
Here is the main python driver for a Dexter Industries GoPiGo3 ROS node: https://github.com/ros-gopigo/gopigo3_node/blob/master/src/gopigo3_driver.py
Asked by RobotDreams on 2019-09-08 23:21:19 UTC
Comments
How would you write a non-ROS Python program? It probably won't be much different than that
Asked by jayess on 2019-09-07 23:31:27 UTC
We would really recommend working through some python programming tutorials and becoming familiar with that language before attempting to work with ROS. It is not an easy place to start and we discourage people from using it as a way to learn programming.
Once you're comfortable with python you can then work through the first ROS tutorials which should all make sense to you by then.
Asked by PeteBlackerThe3rd on 2019-09-09 07:07:38 UTC