Hope everyone is doing well.
I have just started use AirSim for some computer vision simulations. Right now I am trying to implement threading for navigation purposes with Python.
As a starting point, I wanted create 2 threads: One of them is going to print the current location of the quadcopter, whereas the other one is going to send moveOnPathAsync commands.
Here is my code:
import threading from airsim.types import YawMode from msgpackrpc.client import Client import airsim import time client = airsim.MultirotorClient() client.reset() client.confirmConnection() client.enableApiControl(True) def logState(): print(client.simGetGroundTruthKinematics().position) def move(): client.moveOnPath([airsim.Vector3r(125,0,-5), airsim.Vector3r(125,-60,-5), airsim.Vector3r(125,-90,-5), airsim.Vector3r(125,0,-5)], 12, 1000, airsim.DrivetrainType.ForwardOnly, airsim.YawMode(True,0), 20, 1).join() wind = airsim.Vector3r(-10, -10, -10) client.simSetWind(wind) camera_pose = airsim.Pose(airsim.Vector3r(0, 0, 0), airsim.to_quaternion(-1.57, 0, 0)) client.simSetCameraPose(0, camera_pose) client.armDisarm(True) print("Araç kalkışa hazırlanıyor...") client.takeoffAsync().join() time.sleep(0.2) t2 = threading.Thread(target=move, args=[client]) t1 = threading.Thread(target=logState, args=[client]) t2.start() t1.start()
However, when I run this script I get the error "TypeError: move() / logState() takes 0 positional arguments but 1 was given" for both of my threads. What am I missing?