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

Examples of reading responses #3

Closed
vvo opened this issue Feb 7, 2018 · 3 comments
Closed

Examples of reading responses #3

vvo opened this issue Feb 7, 2018 · 3 comments
Labels
question Further information is requested

Comments

@vvo
Copy link

vvo commented Feb 7, 2018

Hi again, the library says "It supports receiving sensor updates", can you give an example of that?

Does it also support taking pictures?

@Mechazawa
Copy link
Owner

It does support taking pictures but it does not support the FTP protocol it uses at the moment. So you can take a picture using the PictureV2 command but you'll have to download it from the drone manually using the USB cable or something. This is a planned feature. #5

const takePicture = parser.getCommand('minidrone', 'MediaRecord', 'PictureV2');

@Mechazawa
Copy link
Owner

Mechazawa commented Feb 8, 2018

The drone does not use a classical command response approach but instead it sends "commands" to the client that can be interpreted as events. It will fire an event every time a command state (sensor reading) has been updated.

See: https://github.com/Mechazawa/minidrone-js/blob/master/src/DroneConnection.js#L300

connection.on('sensor:minidrone-UsbAccessoryState-GunState', sensor => {
 if (sensor.state.value === sensor.state.enum.READY) {
   console.log('The gun is ready to fire!');
 }
});

@Mechazawa Mechazawa added the question Further information is requested label Feb 8, 2018
@vvo
Copy link
Author

vvo commented Feb 8, 2018

Very smart, thanks will be very useful!

@vvo vvo closed this as completed Feb 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants