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

Document follow_me example #94

Merged
merged 3 commits into from
Feb 14, 2018
Merged

Document follow_me example #94

merged 3 commits into from
Feb 14, 2018

Conversation

hamishwillee
Copy link
Collaborator

This adds the follow me example. It still requires a screenshot.

@hamishwillee
Copy link
Collaborator Author

@shakthi-prashanth-m I tried to run follow_me example on Ubuntu but got some warnings - what dependencies need to be added?

sudo apt-get install libboost*

@shakthi-prashanth-m
Copy link

shakthi-prashanth-m commented Feb 8, 2018

In latest Follow Me example's CMakeLists.txt, linking telemetry plugin is missed. So fix is part of QGC Mission import PR. You can temporarily fix it as in here.
Regarding Dependencies, Boost version 1.66 is required.

@hamishwillee
Copy link
Collaborator Author

hamishwillee commented Feb 8, 2018

@shakthi-prashanth-m Thanks

Regarding Dependencies, Boost version 1.66 is required.

That is an inconvenient version as Ubuntu 16.04 comes with 1.58. Can the requirement be reduced?

And if not, what is the best way to install the boost libraries on Ubuntu?

I might just wait until that QGC import goes in (mavlink/MAVSDK#235) because realistically people can't use this example now without a lot of hassle.

@shakthi-prashanth-m
Copy link

That is an inconvenient version as Ubuntu 16.04 comes with 1.58. Can the requirement be reduced?

I had this thought initially, but I chose it to prefer latest Boost version. However, like you said, we can lower the version to match that on Ubuntu 16 for ease of usage. In that case, we have to replace boost::asio::io_context by boost::asio::io_service.

@hamishwillee
Copy link
Collaborator Author

That is an inconvenient version as Ubuntu 16.04 comes with 1.58. Can the requirement be reduced?

I had this thought initially, but I chose it to prefer latest Boost version. However, like you said, we can lower the version to match that on Ubuntu 16 for ease of usage. In that case, we have to replace boost::asio::io_context by boost::asio::io_service.

Please do that. Given this is example code it makes sense to make the installation as straightforward as possible (if this were library code then we'd have an argument for most efficient and recent version).

@shakthi-prashanth-m
Copy link

OK. Sure.

@shakthi-prashanth-m
Copy link

shakthi-prashanth-m commented Feb 8, 2018

@julianoes I think we can include fix for Follow Me linker error in this PR which I submit to with Boost version 1.58, so that @hamishwillee doesn't need to wait for (dronecore/DroneCore#235) to merge. I will revert those changes in the other PR.

This example demonstrates how to use the [Follow Me](../api_reference/classdronecore_1_1_follow_me.md) plugin.
It shows how to send the drone both the current position of the target (`FollowMe::TargetLocation`) and the relative position at which it should follow (`FollowMe::Config`).

![Follow Me QGC Screenshot](../../assets/examples/follow_me/follow_me_example_qgc.jpg)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shakthi-prashanth-m I need a screenshot here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

followme

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hamishwillee I built QGC source code by disabling it sending Follow positions. This made PX4 to receive Follow position only from DroneCore Follow Me example. But Follow Me trajectory is not in a regular shape (I expected this because as I mentioned it as a rudimentary location provider :-) ). So is this fine ?

> **Note** This is from a debug build of DroneCore. A release build will omit the "Debug" messages.

```
$ ./follow_me
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shakthi-prashanth-m I need a dronecore console output here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait for device to connect via heartbeat
[11:40:49|Info ] New device on: 127.0.0.1:14557 (udp_connection.cpp:211)
[11:40:49|Debug] MAVLink: info: DISARMED by auto disarm on land (device.cpp:247)
[11:40:50|Debug] Discovered 4294967298 (dronecore_impl.cpp:219)
[11:40:50|Info ] FollowMe: Applying default FollowMe configuration FollowMe to the device... (follow_me_impl.cpp:186)
Device is ready
Armed
[11:40:51|Debug] MAVLink: info: ARMED by arm/disarm component command (device.cpp:247)
[11:40:51|Debug] MAVLink: info: [logger] file: rootfs/fs/microsd/log/2018-02-14/0 (device.cpp:247)
In Air...
[11:40:51|Debug] MAVLink: info: Using minimum takeoff altitude: 2.50 m (device.cpp:247)
[11:40:51|Debug] MAVLink: info: Takeoff detected (device.cpp:247)
[11:40:51|Debug] MAVLink: critical: Using minimum takeoff altitude: 2.50 m (device.cpp:247)
[11:40:51|Debug] MAVLink: info: data link #1 lost (device.cpp:247)
[FlightMode: Takeoff] Vehicle is at: nan, nan degrees.
[FlightMode: Hold] Vehicle is at: nan, nan degrees.
[FlightMode: Hold] Vehicle is at: nan, nan degrees.
[FlightMode: Hold] Vehicle is at: nan, nan degrees.
[FlightMode: Hold] Vehicle is at: nan, nan degrees.
[11:40:56|Debug] FollowMe: Waiting for the device confirmation of the new configuration.. (follow_me_impl.cpp:98)
[11:40:56|Debug] FollowMe: Waiting for the device confirmation of the new configuration.. (follow_me_impl.cpp:98)
[11:40:56|Info ] FollowMe: Configured: Min height: 20 meters, Follow distance: 8 meters, Follow direction: Front right, Responsiveness: 0.5 (follow_me_impl.cpp:101)
[FlightMode: FollowMe] Vehicle is at: nan, nan degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54559 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54559 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54563 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54563 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54559 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54559 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54562 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54562 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54566 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54566 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54562 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54562 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54565 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54568 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54568 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54565 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54565 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54567 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54571 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54571 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54567 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54567 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.5457 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.5457 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54567 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54567 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54569 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54566 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54566 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54568 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54565 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54565 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3977, 8.54567 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3976, 8.54567 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3976, 8.5457 degrees.
[FlightMode: FollowMe] Vehicle is at: 47.3976, 8.54573 degrees.
waiting until landed
[11:41:33|Debug] MAVLink: info: Landing at current position (device.cpp:247)
waiting until landed
waiting until landed
waiting until landed
waiting until landed
waiting until landed
waiting until landed
waiting until landed
[11:41:53|Debug] MAVLink: info: data link #1 regained (device.cpp:247)
waiting until landed
waiting until landed
waiting until landed
waiting until landed
waiting until landed
[11:42:04|Debug] MAVLink: info: Landing detected (device.cpp:247)
Landed...

@hamishwillee
Copy link
Collaborator Author

@shakthi-prashanth-m Thanks for your fix mavlink/MAVSDK#256. This allowed me to verify the build instructions and run this code.

Unfortunately I'm having trouble getting SITL to run reliably in a VM (lots of failsafe warnings) so I can't get a decent full run of the example. I was wondering if you could do that for me. Basically I need the end to end console output and a screenshot of QGroundControl showing the track that the vehicle took (check out the other examples to see what I mean). Would it be possible for you to generate those for me? The track is also a good example/proof that your location generator is doing what you want.

You can attach the files or email them to me.

@shakthi-prashanth-m
Copy link

@hamishwillee
If QGroundControl is running when I run Follow Me example, then even it starts sending (Lat, Lan) = (0, 0) too to the vechicle! This makes vehicle move in indeterministic way. So, I thought of running Follow Me example first and then launch QGC to view traveled path; but QGC doesn't show it.

Right now, I can think of disabling sending those position in QGroundControl source code and run by building it. If you've better suggestion, please let me know.

@hamishwillee
Copy link
Collaborator Author

@hamishwillee If QGroundControl is running when I run Follow Me example, then even it starts sending (Lat, Lan) = (0, 0) too to the vechicle! This makes vehicle move in indeterministic way. So, I thought of running Follow Me example first and then launch QGC to view traveled path; but QGC doesn't show it.

Right now, I can think of disabling sending those position in QGroundControl source code and run by building it. If you've better suggestion, please let me know.

OK, so I haven't seen odd behaviour in the other examples - is this a recent build of QGC? That sounds like a bug - QGC shouldn't be sending lat/lon position unless you ask it to. @julianoes Any ideas?

@shakthi-prashanth-m
Copy link

No, It happens in FollowMe Mode! Because we enable vehicle to Follo Me Mode, QGroundControl being a client detects it and starts sending Follow positions to vehicle just like DroneCore Follow Me example (in competition :) ) does. So, I think this behavior is normal considering QGC as a client. So, for the time being, just to run Follow Me example we need to disable it in QGC.

dronecore
dronecore_action
dronecore_follow_me
pthread
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need pthread here? Doesn't dronecore link against that?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, its not necessary anymore. Fixed here mavlink/MAVSDK@91e0a2d. Thanks @hamishwillee

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Corresponding change in docs here: a658b68

@hamishwillee hamishwillee changed the title [WIP] Document follow_me example Document follow_me example Feb 14, 2018
@hamishwillee hamishwillee merged commit 5d289b3 into mavlink:develop Feb 14, 2018
@hamishwillee hamishwillee deleted the follow_me_example branch February 14, 2018 23:45
@hamishwillee
Copy link
Collaborator Author

@shakthi-prashanth-m Thanks for your help on this!

  1. I have created QGC doesn't play well with other Follow Me sources (DroneCore) qgroundcontrol#6141 to track the QGC conflict. I've also added a warning in the docs linking to this on Follow Me guide page and in the example.
  2. I added your image and log - thanks for those.

I've merged this now as it is complete.

@shakthi-prashanth-m
Copy link

@hamishwillee I think this code needs to be update to use follow_distance_m instead of follow_dist_m when you demonstrate set configuration.

@hamishwillee
Copy link
Collaborator Author

Thanks @shakthi-prashanth-m - done in 26c05b2

Hard to keep track of every single API modifications like that - appreciate your help.

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

Successfully merging this pull request may close these issues.

2 participants