Skip to content

Commit

Permalink
Fix some sample code.
Browse files Browse the repository at this point in the history
  • Loading branch information
clovett committed Feb 18, 2017
1 parent b50510a commit ba77450
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions docs/apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ int main()
cout << "Press Enter to use offboard control" << endl; cin.get();
client.requestControl();
cout << "Press Enter to move 5 meters with 1 m/s velocity" << endl; cin.get();
client.moveToPosition(5, 0, 2.5f, 1);
cout << "Press Enter to move 5 meters in x direction with 1 m/s velocity" << endl; cin.get();
auto position = client.getPosition(); // from current location
client.moveToPosition(position.x() + 5, position.y(), position.z(), 1);
cout << "Press Enter to land" << endl; cin.get();
client.land();
Expand All @@ -36,7 +37,11 @@ int main()
You can find a ready to run project in HelloDrone folder in the repository.

## How does Hello Drone work?
Hello Drone uses the RPC client to connect to the RPC server that is automatically started by the AirSim. The RPC server routes all the commands to a class that implements [DroneControlBase](../AirLib/include/control/DroneControlBase.hpp). In essence, DroneControlBase defines our abstract interface for getting data from the quadrotor and sending back commands. We currently have concrete implementation for DroneControlBase for MavLink based vehicles. The implementation for DJI drone platforms, specifically Matrice, is in works.
Hello Drone uses the RPC client to connect to the RPC server that is automatically started by the AirSim.
The RPC server routes all the commands to a class that implements [DroneControlBase](../AirLib/include/control/DroneControlBase.hpp).
In essence, DroneControlBase defines our abstract interface for getting data from the quadrotor and sending back commands.
We currently have concrete implementation for DroneControlBase for MavLink based vehicles. The implementation for DJI drone
platforms, specifically Matrice, is in works.

## How to get images from drone?
Here's a sample code. For more information, please see [DroneControlBase](../AirLib/include/control/DroneControlBase.hpp) class.
Expand All @@ -49,13 +54,17 @@ int playWithImages()
msr::airlib::RpcLibClient client;
client.setImageTypeForCamera(0, DroneControlBase::ImageType::Depth);
vector<uint8_t> image = client.getImageForCamera(0, DroneControlBase::ImageType::Depth);
//do something with images
}
```

## Can I run above code on real quadrotors as well?
Absolutely! The AirLib is self-contained library that you can put on an offboard computing module such as the Gigabyte barebone Mini PC. This module then can talk to the flight controllers such as Pixhawk using exact same code and MavLink protocol (or DJI protocol). The code you write for testing in the simulator remains unchanged! We will post more detailed guide on how to do this soon.
Absolutely! The AirLib is self-contained library that you can put on an offboard computing module such as the Gigabyte barebone Mini PC.
This module then can talk to the flight controllers such as Pixhawk using exact same code and MavLink protocol (or DJI protocol).
The code you write for testing in the simulator remains unchanged! We will post more detailed guide on how to do this soon.

## What else is in works?
We are working on enabling other RPC stack such as ZeroMQ over protobufs so we can enable more languages such as Python. We also hope to release ROS adapters for our APIs with Linux builds.
We are working on enabling other RPC stack such as ZeroMQ over protobufs so we can enable more languages such as Python.
We also hope to release ROS adapters for our APIs with Linux builds.

0 comments on commit ba77450

Please sign in to comment.