From 779a91a6443aa58c5d33535dbaf7721facff5238 Mon Sep 17 00:00:00 2001 From: arise Date: Sat, 6 Jan 2024 20:57:15 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B0=D0=BC=D0=BC=D1=83?= =?UTF-8?q?=20=D0=BF=D0=BE=20=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8E=20=D1=81=D0=B2=D0=BE=D0=B5=D0=B9=20=D0=B1=D1=83?= =?UTF-8?q?=D0=BA=D0=B2=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lesson_04/mover.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lesson_04/mover.py b/lesson_04/mover.py index a61bebe..885bd3e 100644 --- a/lesson_04/mover.py +++ b/lesson_04/mover.py @@ -8,12 +8,11 @@ import math class RurMover(Node): def __init__(self): - super().__init__('minimal_publisher') + super().__init__('rur_mover') self.publisher_twist = self.create_publisher(Twist, 'turtle1/cmd_vel', 10) self.main() def publish_twist(self, linear, angular): - self.get_logger().info('Linear: "%d", angular: "%d"' % (linear, angular)) msg = Twist() msg.linear.x = float(linear) msg.angular.z = math.radians(float(angular)) @@ -21,15 +20,26 @@ class RurMover(Node): self.get_clock().sleep_for(Duration(seconds=1.0)) def main(self): - pass + self.publish_twist(2, 0.0) + self.publish_twist(0, 180.0) + self.publish_twist(4, 0.0) + self.publish_twist(0, 60.0) + self.publish_twist(3, 0.0) + self.publish_twist(0, 180.0) + self.publish_twist(6.5, 0.0) + self.publish_twist(0, -115.0) + self.publish_twist(6.5, 0.0) def main(args=None): rclpy.init(args=args) mover = RurMover() + rclpy.spin(mover) + mover.destroy_node() rclpy.shutdown() + if __name__ == '__main__': - main() \ No newline at end of file + main() -- GitLab