ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
0

Structure of ROS python program

asked 2019-09-07 12:50:44 -0500

Marseiliais gravatar image

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

edit retag flag offensive close merge delete

Comments

1

How would you write a non-ROS Python program? It probably won't be much different than that

jayess gravatar image jayess  ( 2019-09-07 23:31:27 -0500 )edit

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.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-09-09 07:07:38 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-09-08 23:21:19 -0500

RobotDreams gravatar image

Here is the main python driver for a Dexter Industries GoPiGo3 ROS node: https://github.com/ros-gopigo/gopigo3...

edit flag offensive delete link more

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

Stats

Asked: 2019-09-07 12:50:44 -0500

Seen: 178 times

Last updated: Sep 08 '19