zauberzeug / field_friend

A Development Platform for Mechanical Weeding.
https://feldfreund.de
MIT License
9 stars 3 forks source link

[RB26] Linear Axes not referenced #56

Open BenGeissler opened 1 month ago

BenGeissler commented 1 month ago

Hello,

I am having trouble with the linear axes of the tool guide.

When pressing the Reference Button on either the Y-Axis or the X-Axis, the logging output is: For the Y-Axis:

rosys_1         | 2024-05-15 15:17:35.933 [INFO] rosys/rosys.py:69: automation started
rosys_1         | 2024-05-15 15:17:35.953 [INFO] field_friend/hardware/y_axis_stepper_hardware.py:100: moving to end_r stop

For the Z-Axis:

rosys_1         | 2024-05-15 11:18:41.782 [INFO] rosys/rosys.py:69: automation started
rosys_1         | 2024-05-15 11:18:41.800 [INFO] field_friend/hardware/z_axis_stepper_hardware.py:92: zaxis referencing...
rosys_1         | 2024-05-15 11:18:41.801 [INFO] field_friend/hardware/z_axis_stepper_hardware.py:113: moving out of end t stop

After this, however, pressing any of the other buttons, e.g. Move to Middle for the Y-Axis nothing moves and the logger has the following output:

rosys_1         | 2024-05-15 11:11:11.230 [INFO] rosys/rosys.py:69: automation started
rosys_1         | 2024-05-15 11:11:11.234 [INFO] field_friend/hardware/y_axis_stepper_hardware.py:68: could not move yaxis to 0 because of yaxis is not referenced, reference first
rosys_1         | 2024-05-15 11:11:11.239 [ERROR] rosys/automation/automation.py:68: automation failed
rosys_1         | Traceback (most recent call last):
rosys_1         |   File "/app/field_friend/hardware/y_axis_stepper_hardware.py", line 66, in move_to
rosys_1         |     await super().move_to(position, speed)
rosys_1         |   File "/app/field_friend/hardware/y_axis.py", line 41, in move_to
rosys_1         |     raise RuntimeError('yaxis is not referenced, reference first')
rosys_1         | RuntimeError: yaxis is not referenced, reference first
rosys_1         | 
rosys_1         | During handling of the above exception, another exception occurred:
rosys_1         | 
rosys_1         | Traceback (most recent call last):
rosys_1         |   File "/app/rosys/automation/automation.py", line 56, in __await__
rosys_1         |     signal = send(message)
rosys_1         |              ^^^^^^^^^^^^^
rosys_1         |   File "/app/field_friend/hardware/y_axis_stepper_hardware.py", line 69, in move_to
rosys_1         |     raise Exception(f'could not move yaxis to {position} because of {error}')
rosys_1         | Exception: could not move yaxis to 0 because of yaxis is not referenced, reference first
rosys_1         | 2024-05-15 11:11:11.276 [INFO] rosys/rosys.py:69: automation stopped because an exception occurred in an automation
rosys_1         | 2024-05-15 11:11:11.277 [INFO] rosys/rosys.py:69: automation failed
rosys_1         | 2024-05-15 11:11:11.291 [ERROR] nicegui/app/app.py:118: could not move yaxis to 0 because of yaxis is not referenced, reference first
rosys_1         | Traceback (most recent call last):
rosys_1         |   File "/app/field_friend/hardware/y_axis_stepper_hardware.py", line 66, in move_to
rosys_1         |     await super().move_to(position, speed)
rosys_1         |   File "/app/field_friend/hardware/y_axis.py", line 41, in move_to
rosys_1         |     raise RuntimeError('yaxis is not referenced, reference first')
rosys_1         | RuntimeError: yaxis is not referenced, reference first
rosys_1         | 
rosys_1         | During handling of the above exception, another exception occurred:
rosys_1         | 
rosys_1         | Traceback (most recent call last):
rosys_1         |   File "/app/nicegui/background_tasks.py", line 52, in _handle_task_result
rosys_1         |     task.result()
rosys_1         |   File "/app/rosys/automation/automation.py", line 56, in __await__
rosys_1         |     signal = send(message)
rosys_1         |              ^^^^^^^^^^^^^
rosys_1         |   File "/app/field_friend/hardware/y_axis_stepper_hardware.py", line 69, in move_to
rosys_1         |     raise Exception(f'could not move yaxis to {position} because of {error}')
rosys_1         | Exception: could not move yaxis to 0 because of yaxis is not referenced, reference first

It is the same with the Z-Axis, e.g. Move to Min:

rosys_1         | 2024-05-15 11:17:35.351 [INFO] rosys/rosys.py:69: automation started
rosys_1         | 2024-05-15 11:17:35.355 [ERROR] field_friend/hardware/z_axis_stepper_hardware.py:70: could not move zaxis to -0.197 because of zaxis is not referenced, reference first
rosys_1         | 2024-05-15 11:17:35.361 [ERROR] rosys/automation/automation.py:68: automation failed
rosys_1         | Traceback (most recent call last):
rosys_1         |   File "/app/field_friend/hardware/z_axis_stepper_hardware.py", line 68, in move_to
rosys_1         |     await super().move_to(position, speed)
rosys_1         |   File "/app/field_friend/hardware/z_axis.py", line 46, in move_to
rosys_1         |     raise RuntimeError('zaxis is not referenced, reference first')
rosys_1         | RuntimeError: zaxis is not referenced, reference first
rosys_1         | 
rosys_1         | The above exception was the direct cause of the following exception:
rosys_1         | 
rosys_1         | Traceback (most recent call last):
rosys_1         |   File "/app/rosys/automation/automation.py", line 56, in __await__
rosys_1         |     signal = send(message)
rosys_1         |              ^^^^^^^^^^^^^
rosys_1         |   File "/app/field_friend/hardware/z_axis_stepper_hardware.py", line 71, in move_to
rosys_1         |     raise Exception(f'could not move zaxis to {position} because of {error}') from error
rosys_1         | Exception: could not move zaxis to -0.197 because of zaxis is not referenced, reference first
rosys_1         | 2024-05-15 11:17:35.374 [INFO] rosys/rosys.py:69: automation stopped because an exception occurred in an automation
rosys_1         | 2024-05-15 11:17:35.377 [INFO] rosys/rosys.py:69: automation failed
rosys_1         | 2024-05-15 11:17:35.417 [ERROR] nicegui/app/app.py:118: could not move zaxis to -0.197 because of zaxis is not referenced, reference first
rosys_1         | Traceback (most recent call last):
rosys_1         |   File "/app/field_friend/hardware/z_axis_stepper_hardware.py", line 68, in move_to
rosys_1         |     await super().move_to(position, speed)
rosys_1         |   File "/app/field_friend/hardware/z_axis.py", line 46, in move_to
rosys_1         |     raise RuntimeError('zaxis is not referenced, reference first')
rosys_1         | RuntimeError: zaxis is not referenced, reference first
rosys_1         | 
rosys_1         | The above exception was the direct cause of the following exception:
rosys_1         | 
rosys_1         | Traceback (most recent call last):
rosys_1         |   File "/app/nicegui/background_tasks.py", line 52, in _handle_task_result
rosys_1         |     task.result()
rosys_1         |   File "/app/rosys/automation/automation.py", line 56, in __await__
rosys_1         |     signal = send(message)
rosys_1         |              ^^^^^^^^^^^^^
rosys_1         |   File "/app/field_friend/hardware/z_axis_stepper_hardware.py", line 71, in move_to
rosys_1         |     raise Exception(f'could not move zaxis to {position} because of {error}') from error
rosys_1         | Exception: could not move zaxis to -0.197 because of zaxis is not referenced, reference first

Is this a bug, or am I missing something to set these functions up correctly?

angelom93 commented 1 month ago

Hello @BenGeissler,

It seems the axes are not responding to the lizard commands. Could you provide us with insights into the lizard communication logs when starting the reference? You can do this by activating the serial logging on the development page. Please deactivate the logging a few moments after pressing the reference button, as it logs at a high frequency. The logs will then be saved to the file ~/.rosys/communication.log.

BenGeissler commented 1 month ago

Looking through the communication.log I found the relevant output for e.g. pressing Reference for Y-Axis seems to be:

2024-05-16 10:34:50.048 [DEBUG] rosys/hardware/communication/serial_communication.py:75: read: core 3202531 0.000 0.000 0 1 true -15909061 0 0 1 true 0 1 1 1 1@01
2024-05-16 10:34:50.050 [DEBUG] rosys/hardware/communication/serial_communication.py:75: read: core 3202562 0.000 0.000 0 1 true -15909061 0 0 1 true 0 1 1 1 1@07
2024-05-16 10:34:50.059 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: y_axis.speed(-15000);@4f
2024-05-16 10:34:50.060 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("POST /notification automation started")@21
2024-05-16 10:34:50.079 [DEBUG] rosys/hardware/communication/serial_communication.py:75: read: core 3202593 0.000 0.000 0 1 true -15909061 0 0 1 true 0 1 1 1 1@09
2024-05-16 10:34:50.108 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("PUT /button/main/play/icon play_arrow")@24
2024-05-16 10:34:50.110 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("PUT /button/main/play/state enabled")@1f
2024-05-16 10:34:50.111 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("PUT /button/main/play/visible false")@1e
2024-05-16 10:34:50.121 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("PUT /button/main/pause/icon pause")@02
2024-05-16 10:34:50.125 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("PUT /button/main/pause/state enabled")@69
2024-05-16 10:34:50.126 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("PUT /button/main/pause/visible true")@03
2024-05-16 10:34:50.127 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("PUT /button/main/resume/icon play_arrow")@39
2024-05-16 10:34:50.127 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("PUT /button/main/resume/state enabled")@02
2024-05-16 10:34:50.150 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("PUT /button/main/resume/visible false")@03
2024-05-16 10:34:50.151 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("PUT /button/main/stop/icon stop")@02
2024-05-16 10:34:50.152 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("PUT /button/main/stop/state enabled")@03
2024-05-16 10:34:50.153 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("PUT /button/main/stop/visible true")@69
2024-05-16 10:34:50.183 [DEBUG] rosys/hardware/communication/serial_communication.py:75: read: core 3202631 0.000 0.000 0 1 false -15909426 0 0 1 true 0 1 1 1 1@6e
2024-05-16 10:34:50.184 [DEBUG] rosys/hardware/communication/serial_communication.py:75: read: core 3202669 0.000 0.000 0 1 false -15909987 0 0 1 true 0 1 1 1 1@65
2024-05-16 10:34:50.190 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bms.send(0xdd, 0xa5, 0x03, 0x00, 0xff, 0xfd, 0x77)@52
2024-05-16 10:34:50.226 [DEBUG] rosys/hardware/communication/serial_communication.py:75: read: core 3202741 0.000 0.000 0 1 false -15911065 0 0 1 true 0 1 1 1 1@62

Pressing Reference for Z-Axis:

2024-05-16 10:41:54.387 [DEBUG] rosys/hardware/communication/serial_communication.py:75: read: core 3626886 0.000 0.000 0 1 false -22273683 0 0 1 true 0 1 1 1 1@61
2024-05-16 10:41:54.388 [DEBUG] rosys/hardware/communication/serial_communication.py:75: read: core 3626903 0.000 0.000 0 1 false -22273939 0 0 1 true 0 1 1 1 1@63
2024-05-16 10:41:54.408 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("POST /notification automation stopped because new automation starts")@3f
2024-05-16 10:41:54.412 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: z_axis.speed(20000);@67
2024-05-16 10:41:54.413 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: bluetooth.send("POST /notification automation started")@21
2024-05-16 10:41:54.443 [DEBUG] rosys/hardware/communication/serial_communication.py:75: read: core 3626928 0.000 0.000 0 1 false -22274303 0 0 1 true 0 1 1 1 1@6e
2024-05-16 10:41:54.445 [DEBUG] rosys/hardware/communication/serial_communication.py:75: read: core 3626947 0.000 0.000 0 1 false -22274596 0 0 1 true 0 1 1 1 1@6d
2024-05-16 10:41:54.447 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: wheels.speed(0.0, 0.0)@44
2024-05-16 10:41:54.448 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: y_axis.stop()@12
2024-05-16 10:41:54.448 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: z_axis.stop()@11
2024-05-16 10:41:54.471 [DEBUG] rosys/hardware/communication/serial_communication.py:75: read: core 3626982 0.000 0.000 0 1 false -22275113 0 0 1 true 0 1 1 1 1@6c
2024-05-16 10:41:54.508 [DEBUG] rosys/hardware/communication/serial_communication.py:85: send: y_axis.stop()@12
2024-05-16 10:41:54.518 [DEBUG] rosys/hardware/communication/serial_communication.py:75: read: core 3627028 0.000 0.000 0 1 true -22275395 0 0 1 true 0 1 1 1 1@03
2024-05-16 10:41:54.528 [DEBUG] rosys/hardware/communication/serial_communication.py:75: read: core 3627044 0.000 0.000 0 1 true -22275395 0 0 1 false -18 1 1 1 1@76
2024-05-16 10:41:54.559 [DEBUG] rosys/hardware/communication/serial_communication.py:75: read: core 3627078 0.000 0.000 0 1 true -22275395 0 0 1 true 202 1 1 1 1@06

There is a mention of y_axis when having started the automation for Y-Axis before. This automation does not seem to stop on its own? Restarting the docker and referencing Z-Axis looks just like the one for Y-Axis.

When referencing Y-Axis after Z-Axis it has the same pattern.