Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I use rospy through PyCall directly? #1076

Open
wly2014 opened this issue Jan 28, 2024 · 1 comment
Open

How can I use rospy through PyCall directly? #1076

wly2014 opened this issue Jan 28, 2024 · 1 comment

Comments

@wly2014
Copy link

wly2014 commented Jan 28, 2024

The code I have can only be able to run the callback once.

using PyCall

function solve_callback(data)
    println("solve_callback.")
end

rospy = pyimport("rospy")
msg = pyimport("geometry_msgs.msg")
WrenchStamped = msg.WrenchStamped

rospy.init_node("solver_interface_sub", disable_signals = false)
println("init_node solver_interface_sub.")

solver_sub = rospy.Subscriber("/solver_input", WrenchStamped, solve_callback, queue_size=1)

if rospy.is_shutdown()
    @warn "rospy.is_shutdown()"
end

rospy.spin()

println("stop.")

I am aware that RobotOS.jl is one method to accomplish this, but I want to know how can I call rospy directly using PyCall.

Thank you very much.

@ngharrison
Copy link

I've tried to get rospy callbacks to work too. It doesn't even run the callback once. It seems to run up until the first function call (such as a print statement) within the callback and then hangs. The rest of the code in the function gets ignored. No luck finding a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants