Git Product home page Git Product logo

Comments (19)

 avatar commented on August 18, 2024 4

I had the same issues but I used some other work around by setting the takeoff height parameter, MIS_TAKEOFF_ALT

await drone.param.set_float_param("MIS_TAKEOFF_ALT", 20.0)

20.0 metres was the height in my case.
That should suffice for now.

from mavsdk-python.

JonasVautherin avatar JonasVautherin commented on August 18, 2024

Sorry for the delay @aydal, I've been a bit overwhelmed.

I'm thinking that you may actually contribute to that issue, as now you are familiar with gRPC from the PositionNED PR :-).

If you look at SetTakeoffAltitude:

    grpc::Status SetTakeoffAltitude(
        grpc::ServerContext* /* context */,
        const rpc::action::SetTakeoffAltitudeRequest* request,
        rpc::action::SetTakeoffAltitudeResponse* /* response */) override
    {
        if (request != nullptr) {
            const auto requested_altitude = request->altitude();
            _action.set_takeoff_altitude(requested_altitude);
        }

        return grpc::Status::OK;
}

You can see that response is ignored. Which is wrong: we need to respond with an ActionResult, as defined by the proto file.

SetMaximumSpeed, in the same file, does it the right way:

    grpc::Status SetMaximumSpeed(
        grpc::ServerContext* /* context */,
        const rpc::action::SetMaximumSpeedRequest* request,
        rpc::action::SetMaximumSpeedResponse* response) override
    {
        if (request != nullptr) {
            const auto requested_speed = request->speed();
            mavsdk::Action::Result action_result = _action.set_max_speed(requested_speed);

            if (response != nullptr) {
                auto* rpc_action_result = new rpc::action::ActionResult();
                rpc_action_result->set_result(
                    static_cast<rpc::action::ActionResult::Result>(action_result));
                rpc_action_result->set_result_str(mavsdk::Action::result_str(action_result));
                response->set_allocated_action_result(rpc_action_result);
            }
        }

        return grpc::Status::OK;
}

i.e. SetMaximumSpeed does put the ActionResult into the response.

Would you mind fixing SetTakeoffAltitude such that it behaves correctly? That would be awesome 😎.

from mavsdk-python.

aydal avatar aydal commented on August 18, 2024

Hello Jonas,
Apologies for the late reply. Have built and checked the changes. Changes visible on PR

from mavsdk-python.

JonasVautherin avatar JonasVautherin commented on August 18, 2024

Which PR?

from mavsdk-python.

JonasVautherin avatar JonasVautherin commented on August 18, 2024

@aydal: Any news on that? I remember you worked on that but I lost track eventually 😕.

from mavsdk-python.

JonasVautherin avatar JonasVautherin commented on August 18, 2024

That works, of course, but the fix suggested above would be cleaner. It should not be difficult to fix, and I believe @aydal had it but just did not open a PR with it 😕.

from mavsdk-python.

 avatar commented on August 18, 2024

Alright then, let me give it a shot.

from mavsdk-python.

JonasVautherin avatar JonasVautherin commented on August 18, 2024

@vizzbee: sure, it would be awesome!

I don't remember that PR or why it did not get merged. The easiest would probably be to open a PR specific to that bugfix, so that it is easier to merge it. If you do it along with a new feature, it will take more time to get merged 🙂.

from mavsdk-python.

siddux avatar siddux commented on August 18, 2024

Hi, has the bug been resolved? I tried to modify the takeoff altitude on takeoff example file and still get an error.

from mavsdk-python.

julianoes avatar julianoes commented on August 18, 2024

@siddux let me check. I see the last status here: mavlink/MAVSDK#958

from mavsdk-python.

julianoes avatar julianoes commented on August 18, 2024

I have updated the pull request. I hope that we can merge it soon now.

from mavsdk-python.

julianoes avatar julianoes commented on August 18, 2024

The PR has been merged, this should be fixed in the next release.

from mavsdk-python.

cryptik avatar cryptik commented on August 18, 2024

This issue is marked as closed, but it seems to still be an issue. I ran similar code as shown above, calling the set_takeoff_altitude() command as follows:

await drone.action.set_takeoff_altitude(5.0)

The code throws and invalid parameter exception but still sets the altitude value. I can confirm this by calling the get method and verify that it was in fact changed. I am running version 0.12.0 of mavsdk on a raspberry pi.

from mavsdk-python.

julianoes avatar julianoes commented on August 18, 2024

I am running version 0.12.0 of mavsdk on a raspberry pi.

@cryptik Can you try the latest version 1.4.0?

from mavsdk-python.

cryptik avatar cryptik commented on August 18, 2024

Sorry... I gave you the version I am running on locally on MacOS. I deploy remotely to RPi.. will check the version when I am back at the drone. Another question... for the Mac, it appears the latest version is 0.12.0? I have an M1... is that the latest version?

from mavsdk-python.

julianoes avatar julianoes commented on August 18, 2024

M1 is tricky as we don't have mavsdk_server built in CI for it yet. See #319.

You can get try to get the latest with python -m pip --upgrade install mavsdk

from mavsdk-python.

cryptik avatar cryptik commented on August 18, 2024

Thanks, but worries.. there are other issues I have with the M1 and related libraries... so the remote build on RPi works fine. Will check the version and report back.

When I do the upgrade on the M1, it tells me the requirement is already met... for version 0.12.0. Seems consistent with what is discussed in #319.

from mavsdk-python.

cryptik avatar cryptik commented on August 18, 2024

Ok, I checked... on the RPi, I am using mavsdk 1.4.0 which I assumed had this problem corrected... but maybe not for the Pi. I currently catch the exception and then call the get function to confirm that it was actually changed.

from mavsdk-python.

julianoes avatar julianoes commented on August 18, 2024

That's odd. It definitely should have been fixed in 1.4.0. I will try to reproduce this.

from mavsdk-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.