0
votes

I'm trying to write a python code, that controls a drone. I receive the position from a Rigid-body trough a rostopic, and I want to use that data in my code. How can i access it in my python code?

    #!/usr/bin/env python

    import numpy as np
    from pycrazyswarm import *

    Z = 1.0

    if __name__ == "__main__":
    swarm = Crazyswarm()
    timeHelper = swarm.timeHelper
    allcfs = swarm.allcfs

    allcfs.takeoff(targetHeight=Z, duration=1.0+Z)
    timeHelper.sleep(1.5+Z)


    print("press button to continue...")
    swarm.input.waitUntilButtonPressed()
    
    # After the button is pressed, I want, that the drone is aligned by a rigid body.
    # Means if the rigid body moves 1m left the drone should follow

    allcfs.land(targetHeight=0.02, duration=1.0+Z)
    timeHelper.sleep(1.0+Z)

So after the button is pressed, I would like to use the data of the rostopic. On the host i send the data over the VRPN client of ROS http://wiki.ros.org/vrpn_client_ros I want to compute the data of the "tracker name"/pose topic

This question might be put too simple regarding its depth. Or the answer is indeed very easy. Did you go through the ROS Subscriber tutorial for Python already?J.P.S.
I am very new to ROSYes i looked trough this, but if I unterstand it right, this is how you Build Subscriber but i wann to Access the data directly in the python Script and use it there.flrnhbr1
Question needs some code: Please provide enough code so others can better understand or reproduce the problem: stackoverflow.com/help/minimal-reproducible-exampleD.L
Sorry you are right.flrnhbr1