PyCall.jl
PyCall.jl copied to clipboard
How can I use rospy through PyCall directly?
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.
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.