JuliaPy / JuliaPy/PythonCall.jl

juliacall: Can not use `@show` and `println` in the callback function of ros.py

Đang mở
#484 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Julia
Star
1.1k
Fork
86
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
3

Mô tả

**Affects:** JuliaCall

**Describe the bug**
When I use `@show` and `println` in the julia function which is called by the callback function of ros.py, the program becomes unresponsive.

Python `test.py`:
```python
#!/usr/bin/env python3
#coding: utf-8

import rospy
import time
import numpy as np
from std_msgs.msg import Char

from juliacall import Main as jl

def solve(data):
rospy.loginfo("==================== Start ... ======================")

xs = jl.call_ext()

print("len(xs) = ", len(xs))

def Solver_Interface():
rospy.init_node('solver_interface', anonymous = True)

rospy.Subscriber('test', Char, solve, queue_size=1) # can not callback successfully.

jl.include("./test.jl")

time.sleep(1.0)
solve(None) # can call successfully.

rospy.spin()

Solver_Interface()

```

Julia `test.jl`:
```julia
function call_ext()

@show "Hello"
@show "World"
return [1,2,3]
end
```

Run the Python `python test.py` in a terminal.
Run `rostopic pub /test std_msgs/Char "data: 0"` in a new terminal to do ros subscriber's callback.
The text printed in the terminal is:
```
$ python test.py
[INFO] [1711030056.700593]: ==================== Start ... ======================
"Hello" = "Hello"
"World" = "World"
len(xs) = 3
[INFO] [1711030086.854242]: ==================== Start ... ======================
"Hello" =
```
Finally, `Hello` is not printed completely, the this terminal becomes unresponsive.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Reproduce the callback behavior with the provided test.py and test.jl, first comparing the direct solve(None) call with the rospy subscriber callback. Trace how output from the Julia call is handled in the callback, and consider the issue done when @show/println output completes and the callback returns without making the terminal unresponsive.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
julia, python
Lĩnh vực
backend
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.