#!/usr/bin/env python3
import rospy
from std_msgs.msg import Int32
import time

rospy.init_node('count')                                # ノード名「count」に設定
pub = rospy.Publisher('count_up', Int32, queue_size=1)  # パブリッシャ「count_up」を作成
rate = rospy.Rate(10)                                   # 10Hzで実行
n = 0

time.sleep(2)

while not rospy.is_shutdown():
        n += 1
        if n % 3 == 0:
            print("これは%d" % n)
            pub.publish(n)
        else:
            pub.publish(n)
        if n == 227:
            print("\nThis is unko\n")
        rate.sleep()

[((80, 104), 'rospy.init_node', 'rospy.init_node', (['"""count"""'], {}), "('count')\n", (95, 104), False, 'import rospy\n'), ((159, 207), 'rospy.Publisher', 'rospy.Publisher', (['"""count_up"""', 'Int32'], {'queue_size': '(1)'}), "('count_up', Int32, queue_size=1)\n", (174, 207), False, 'import rospy\n'), ((238, 252), 'rospy.Rate', 'rospy.Rate', (['(10)'], {}), '(10)\n', (248, 252), False, 'import rospy\n'), ((304, 317), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (314, 317), False, 'import time\n'), ((329, 348), 'rospy.is_shutdown', 'rospy.is_shutdown', ([], {}), '()\n', (346, 348), False, 'import rospy\n')]