Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters - setParamFloat works but setParamInt does not #215

Open
mmanionRIIS opened this issue Aug 28, 2022 · 13 comments
Open

Parameters - setParamFloat works but setParamInt does not #215

mmanionRIIS opened this issue Aug 28, 2022 · 13 comments
Labels
bug Something isn't working

Comments

@mmanionRIIS
Copy link

I am able to change the parameters with setParamFloat, but not with setParamInt. I'm thinking it might have to do with using Int32, but thats just speculation. The weird thing is that setParamInt will return "onCompleted" so it will appear that it successfully changes the param, but it does not. Anyone else come across this?

// return Completed and changes the value
    func setParameterFloat(_ parameter: String, _ value: String) {
        if let newValue = Float(value){
            mavsdkDrone.drone?.param.setParamFloat(name: parameter, value: newValue)
                .subscribe(onCompleted: {
                    print("Changed \(parameter) to \(value)")
                }, onError: { (error) in
                    print(error)
                })
                .disposed(by: disposeBag)
            }
    }
    // return Completed but does not change the value
    func setParameterInt(_ parameter: String, _ value: String) {
        if let newValue = Int32(value){
            mavsdkDrone.drone?.param.setParamInt(name: parameter, value: newValue)
                .subscribe(onCompleted: {
                    print("Changed \(parameter) to \(value)")
                }, onError: { (error) in
                    print(error)
                })
                .disposed(by: disposeBag)
            }
    }
    ```
@JonasVautherin
Copy link
Collaborator

What param are you setting? What autopilot (I assume PX4?), and what version of it?

@mmanionRIIS
Copy link
Author

mmanionRIIS commented Aug 28, 2022

I'm using ArduPilot. I'm unable to change the RTL_LOIT_TIME or RTL_ALT.

I also tried the PILOT_ACCEL_Z, TERRAIN_SPACING, and STAT_RUNTIME as well, all unsuccessfully.

Edit: I also accounted for "increments", example. RTL_LOIT_TIME has increments of "1000".

@julianoes
Copy link
Contributor

What version of mavsdk_server or MAVSDK-Swift is it using? There have been some fixes, and for ArduPilot there might be some more coming up with MAVSDK v2.0.

@julianoes julianoes added the bug Something isn't working label Aug 29, 2022
@mmanionRIIS
Copy link
Author

I've updated to the latest version of the MAVSDK-Swift on the Main Branch, so 1.1, looks like it was updated 2 months ago.

Drone Specs:
Screen Shot 2022-08-29 at 8 54 08 AM

@JonasVautherin
Copy link
Collaborator

MAVSDK-Swift is on mavsdk-server 1.4.2: https://github.com/mavlink/MAVSDK-Swift/blob/main/Package.swift#L50. Let me try to update that to 1.4.4 tomorrow 👍

@julianoes
Copy link
Contributor

Right, so there have been a couple of fixes since:
mavlink/MAVSDK#1703
mavlink/MAVSDK#1788

You can see the changes here: https://github.com/mavlink/MAVSDK/releases

@JonasVautherin
Copy link
Collaborator

Could you try with the newly-published MAVSDK-Swift v1.1.1?

@mmanionRIIS
Copy link
Author

mmanionRIIS commented Sep 1, 2022

I updated to 1.1.1. Unfortunately, had the same result.

@JonasVautherin
Copy link
Collaborator

Any chance you could try to debug what's happening in C++? Two ways:

  1. Build MAVSDK-C++ and try it there from your laptop (I guess it's a problem related to Ardupilot, not iOS).
  2. Build MAVSDK-C++ with mavsdk_server, run mavsdk_server on your laptop, and connect your iOS app to it using this interface.

I would personally go for 1, build a small example (e.g. this one) and try to reproduce there 👍.

Also maybe @ykhedar has an opinion 😇.

@mmanionRIIS
Copy link
Author

Thank you, will try this tomorrow and let you know how it goes!

@mmanionRIIS
Copy link
Author

Still working on resolving some errors I'm getting when building the C++. I'd bet this is on my end and will let you know when I get the C++ app up and running.

I'm pretty sure my error is related to mavlink/MAVSDK#1875

Screen Shot 2022-09-02 at 12 11 51 PM

@JonasVautherin
Copy link
Collaborator

Seems like you are trying to build an example from main with a MAVSDK from 1.4.x. How did you install MAVSDK? You should build it from main 👍

@mmanionRIIS
Copy link
Author

mmanionRIIS commented Sep 6, 2022

I installed MAVSDK on MacOS using Homebrew, following this: https://mavsdk.mavlink.io/main/en/cpp/quickstart.html

Will give building form main a shot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants