ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

if __name__ == '__ STATIC main__' in tf2 tutorials

asked 2017-07-05 16:27:52 -0500

jwhendy gravatar image

The tf2 tutorial on static frames abruptly ends without explaining this:

if __name__ == '__ STATIC main__':
    rospy.init_node('my_tf2_broadcaster')

I've never seen __ STATIC main__ and from googling I can't tell if it's a ROS specific thing or general python syntax. I get no hits for it exactly, so I'm wondering if it's a typo. If so and it should be '__main__', I'm still confused as it would appear the second block would never run.

Could someone clarify that section of code?

edit retag flag offensive close merge delete

Comments

1

I'm not quite sure what this means; perhaps it is just supposed to indicate to readers that this is an alternate version for publishing a static transform?

ahendrix gravatar image ahendrix  ( 2017-07-07 01:25:38 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-07-07 10:16:34 -0500

jwhendy gravatar image

After going through the tutorials more, I agree with you @ahendrix. I submitted a suggestion to just ditch the class-based static transform method for consistency/less confusion for beginners.

edit flag offensive delete link more

Comments

ros/geometry2#247 should be in close-able state so this should be marked as an answer.

130s gravatar image 130s  ( 2019-01-19 14:39:12 -0500 )edit

I just closed that, and this is marked as an answer already.

jwhendy gravatar image jwhendy  ( 2019-01-19 17:56:55 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2017-07-05 16:27:52 -0500

Seen: 416 times

Last updated: Jul 05 '17