JuliaPy / JuliaPy/PythonCall.jl

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

未关闭
#484 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Julia
星标
1.1k
派生
86
平均合并
1 天 22 小时
30 天内合并 PR
3

描述

**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.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。