remove simple module logging

This commit is contained in:
2026-09-16 06:58:52 +03:00
parent 68dde2cfaf
commit f754961a86
2 changed files with 5 additions and 14 deletions
+4 -12
View File
@@ -26,10 +26,9 @@ class Demo(Node):
self.gripper = self.create_publisher(JointTrajectory, GRIPPER, 10)
self.create_subscription(Image, CAMERA, self.on_image, qos_profile_sensor_data)
self.started = None
self.last_log = -1
self.step = 0
def move_gripper(self, position, state):
def move_gripper(self, position):
message = JointTrajectory()
message.joint_names = ["left_joint", "right_joint"]
point = JointTrajectoryPoint()
@@ -37,7 +36,6 @@ class Demo(Node):
point.time_from_start = Duration(sec=1)
message.points = [point]
self.gripper.publish(message)
print(f"[GRIPPER] {state}: {position}", flush=True)
def on_image(self, message):
frame = self.bridge.imgmsg_to_cv2(message, "bgr8")
@@ -45,18 +43,13 @@ class Demo(Node):
if self.started is None:
self.started = time.monotonic()
print(f"[CAMERA] {CAMERA}", flush=True)
seconds = int(time.monotonic() - self.started)
if seconds != self.last_log:
print(f"[YOLO] {result.verbose().strip()}", flush=True)
self.last_log = seconds
if seconds >= 5 and self.step == 0:
self.move_gripper(0.04, "OPEN")
self.move_gripper(0.04)
self.step = 1
elif seconds >= 7 and self.step == 1:
self.move_gripper(0.02, "TAKE_CUBE")
self.move_gripper(0.02)
self.step = 2
cv2.imshow("YOLO", result.plot())
@@ -65,8 +58,7 @@ class Demo(Node):
def main():
target = input("Предмет (Кисть, Нож или Резаки): ")
print(f"[START] {target}", flush=True)
input("Предмет (Кисть, Нож или Резаки): ")
rclpy.init()
node = Demo()
try: