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

Unable to Update a Specific Mission Item in DroneKit: Seeking Guidance on a Workaround #1217

Open
furkan-hub opened this issue Feb 5, 2024 · 0 comments

Comments

@furkan-hub
Copy link

furkan-hub commented Feb 5, 2024

Hello friends, the other day while working with DroneKit, I noticed that I couldn't update a specific mission item. For example:

drone = connect("tcp:127.0.0.1:5772", wait_ready=True, rate=100)

command_drone = drone.commands

command_drone.download()
command_drone.wait_ready()

print(command_drone[2])
print(command_drone[2].x)
command_drone[2].x = -35.3611350
command_drone[2].y = 149.1648817

print(command_drone[2])
command_drone.upload()

I found that when I did this, the specific mission item wasn't being updated. It wasn't even sending the mission item at all. In any case, I had to call a function like .add(command_drone[2]) and then upload to update the mission item properly. However, this approach was adding an extra mission item to the end of the mission.

To address this issue, I started looking into the library's code and realized that there isn't a direct function to update a mission item. As a temporary solution, I added the following function:

    '''
    When you want to change the mission command only, use this function before upload.
    '''
    self.wait_ready()
    self._vehicle._wpts_dirty = True

This function sets the self._vehicle._wpts_dirty variable to True, even if you don't add any commands, allowing you to execute the .upload() function without using the .add() function. I'm not sure if this is a correct solution. Can you confirm if this is a valid approach, or suggest an alternative solution?

@furkan-hub furkan-hub changed the title Chancing a specific mission Unable to Update a Specific Mission Item in DroneKit: Seeking Guidance on a Workaround Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant