microsoft / AirSim-Drone-Racing-Lab

A framework for drone racing research, built on Microsoft AirSim.
MIT License
185 stars 42 forks source link

Is there anyway to get rotor state?? #19

Open Seungjoo-Kim0516 opened 10 months ago

Seungjoo-Kim0516 commented 10 months ago

Hello, I'm trying to implement Reinforcement learning algorithm in this project.

I want to get rotor states. I know there is getRotorStates() in airsim. However, I can't find in this project.

def getRotorStates(self, vehicle_name =""):
    """
    Used to obtain the current state of all a multirotor's rotors. The state includes the speeds,
    thrusts and torques for all rotors.

    Args:
        vehicle_name (str, optional): Vehicle to get the rotor state of

    Returns:
        RotorStates: Containing a timestamp and the speed, thrust and torque of all rotors.
    """
    return RotorStates.from_msgpack(self.client.call('getRotorStates', vehicle_name))
getRotorStates.__annotations__ = {'return': RotorStates}

I copied above code in airsim package's client.py to airsimdroneracing package's client.py. Then, under log comes out. File "C:\Users\KSJ\anaconda3\envs\new_airsim\lib\site-packages\airsimdroneracinglab\client.py", line 1911, in getRotorStates return RotorStates.from_msgpack(self.client.call('getRotorStates', vehicle_name)) File "C:\Users\KSJ\anaconda3\envs\new_airsim\lib\site-packages\msgpackrpc\session.py", line 41, in call return self.send_request(method, args).get() File "C:\Users\KSJ\anaconda3\envs\new_airsim\lib\site-packages\msgpackrpc\future.py", line 45, in get raise error.RPCError(self._error) msgpackrpc.error.RPCError: rpclib: server could not find function 'getRotorStates' with argument count 1.

I read the comment that it is not available to approach to source code. so I wonder that is there any other way to get rotor's states?

Seungjoo-Kim0516 commented 10 months ago

I found that there's api named "simLogMultirotorState". If you run that data will be stored in Documents/AirSim as txt file.