2016-06-30 2 views
0

내 헬리콥터가 특정 고도에서 돌아 가기를 원합니다. 지금은 ArduPilot SITL에서 모든 것을 돌리고 있습니다. 우선은 simple_goto를 사용하는 것을 시도했다()DroneKit - RTL 고도 설정

vehicle.commands.download() 
vehicle.commands.wait_ready() 
finish_location = deepcopy(vehicle.home_location) 
finish_location.alt = flight_altitude 
vehicle.simple_goto(finish_location) 

simple_goto()는 다른 위치에 대한 잘 작동하지만 내가 vehicle.home_location를 사용하는 경우,이 헬기는 고도 -7.5m로 내림차순으로 발생합니다. 헬리콥터가 더 내리는 것은 내림차순 일 뿐이며 finish_location으로 이동하지 않습니다.

그래서 내가 RTL 모드 그것은 좋은 일

self.vehicle.mode = VehicleMode("RTL") 

를 사용하려고했지만, 내가 원하는 flight_altitude 매개 변수 RTL 고도를 설정하는 방법을 찾을 수 없습니다, 그것은 기본 15m로 실행됩니다.

답변

0

아래 코드는 정상적으로 작동합니다.

vehicle.commands.download() 
vehicle.commands.wait_ready() 
finish_location = deepcopy(vehicle.home_location) 
finish_location.alt = flight_altitude 
vehicle.simple_goto(finish_location) 

이 작동하지 않는 이유
vehicle.commands.download() 
vehicle.commands.wait_ready() 
target_location = LocationGlobalRelative(0, 0, 0) 
target_location.lat = vehicle.home_location.lat 
target_location.lon = vehicle.home_location.lon 
target_location.alt = target_altitude 

아직도 이해가 안 돼요.