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

Bug at flight_control_sample.cpp #191

Closed
chocksmith opened this issue Oct 17, 2017 · 2 comments
Closed

Bug at flight_control_sample.cpp #191

chocksmith opened this issue Oct 17, 2017 · 2 comments

Comments

@chocksmith
Copy link

Hello,

This is the code that checks if the motor has started:

            while ((vehicle->broadcast->getStatus().flight
			!= DJI::OSDK::VehicleStatus::M100FlightStatus::TAKEOFF)
			&& motorsNotStarted < timeoutCycles) {
		motorsNotStarted++;
		usleep(100000);
	}

	if (motorsNotStarted == timeoutCycles) {
		std::cout << "Successful TakeOff!" << std::endl;
	}

The code above works, but it is not correct. The correct would be something like:

           while ((vehicle->broadcast->getStatus().flight
			< DJI::OSDK::VehicleStatus::M100FlightStatus::TAKEOFF)
			&& motorsNotStarted < timeoutCycles) {
		motorsNotStarted++;
		usleep(100000);
	}

	if (motorsNotStarted < timeoutCycles) {
		std::cout << "Successful TakeOff!" << std::endl;
	}

Same mistake happens on others subsequent checks.

@rohitsantdji
Copy link

Good catch! Can you submit a PR?

@chocksmith
Copy link
Author

chocksmith commented Oct 18, 2017 via email

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

2 participants