mavlink / MAVSDK-Java

MAVSDK client for Java.
73 stars 42 forks source link

Using MavLink-Java for FTP File upload prompts a timeout #142

Closed QZH-Caesar closed 10 months ago

QZH-Caesar commented 10 months ago

The following is my code and logs for reference:

String fileName = "file.text"; File file = new File(getFilesDir(),fileName); try { FileOutputStream outputStream = new FileOutputStream(file);; String content = "Hello,World!"; if (file.canRead() && file.canWrite()){ byte[] bytes = content.getBytes(); outputStream.write(bytes); } FileReader fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); String redStr = bufferedReader.readLine(); logger.debug("File Message" + redStr); } catch (IOException e) { e.printStackTrace(); } MavsdkEventQueue.executor().execute(() ->{ disposables.add( drone.getFtp().setTargetCompid(1) .subscribe());}); disposables.add( drone.getFtp().upload(file.getPath(),"/fs/microsd/").subscribe( onNext -> { logger.debug("FTP upload" + onNext.getTotalBytes()); }, throwable ->{ logger.debug("FTP error" + throwable.getMessage()); } ) ); D/Mavsdk: MAVLink: info: System id: 1 D/MapsActivity: [grpc-default-executor-0] - FTP upload12 W/Mavsdk: Response timeout. Retry: 1 W/Mavsdk: Response timeout. Retry: 1 W/Mavsdk: Response timeout. Retry: 1 W/Mavsdk: Response timeout. Retry: 1

julianoes commented 10 months ago

FTP has been rewritten and will be part of MAVSDK v2.

Until then, I probably won't be able to debug issues in v1.

QZH-Caesar commented 10 months ago

@julianoes I'm glad to receive your response. I'm curious about the timing of FTP updates in MAV SDK v2 because I want to perform file transfer between a mobile device and a drone. This functionality has already been implemented in iOS and Python. Also, I'd like to ask a question: How can MAVSDK retrieve heartbeat data from the device?

Thank you in advance.

julianoes commented 10 months ago

If you have another question, please open a new thread.