![]() | 1 | initial version |
Thanks... It work.! I finalize my motor node as follwoing.
#!/usr/bin/env python
import ........
class main():
def __init__(self):
rospy.init_node("robot", anonymous=False)
rospy.Subscriber(..........)
self.pub=rospy.Publisher(..........)
rospy.Timer(rospy.Duration(0.2), self.main_callback)
while not rospy.is_shutdown():
rospy.sleep(0.2)
print("-----------------")
rospy.on_shutdown(self.shutdown)
def shutdown(self):
motor_1=0
def main_callback(self, event):
......................
motor_1 = 50
....end.....
if __name__="__main__":
try: main()
except rospy.ROSInterruptException: pass