Closed ThomasCarstens closed 3 years ago
The current 3D simulator is not ROS time-related. A ROS compatible simulator would be quite useful for myself and many others in the future. Perhaps I could get some precisions on how to change crazyflieSim.py to work on ROS data?
The Crazyflie server already initializes a node, see https://github.com/USC-ACTLab/crazyswarm/blob/master/ros_ws/src/crazyswarm/scripts/pycrazyswarm/crazyflie.py#L527. Spin is not required in ROS-Python (unlike in the C++ version). Thus, you should be able to first create the swarm object and then call rospy.Subscriber
to add additional callbacks.
The simulator does not rely on ROS, to reduce dependencies and allow faster simulation times. If you need ROS in this case, you'll need to call rospy.init_node
in your script yourself (to be only active when using simulation though.) What is your use-case here? If you need more fully fledged simulation support, an integration with RotorS/CrazyS could be interesting.
I wish to create a ROS subscriber node for cf2 position callbacks. This is integrated in my code below, where I attempt to hover cf3 above cf2.
When doing real drone tests: I cannot
init_node
(unable to register with CrazyflieAPI) nor userospy.spin()
(needs a node). A previous issue #54 says to remove both - but then only one callback occurs... Unless there is some method I am not aware of. I do however want the subscriber to continue running. How do I do so?When testing with the simulator: The matplotlib sim currently bugs when I register a node, stops updating right after takeoff. Currently it bugs at 2.4s. I have been able to trace a multithread problem between
rospy.spin()
and matplotlib's running thread. How do I use ROS in simulation? Is there some other method I am not aware of?Worth noting that I am using
cmdPosition()
without problems.The cf2 drone's position is captured correctly in the callback (verified).