Closed fwalch closed 9 years ago
great job!
2015-04-07 19:47 GMT+03:00 Florian Walch notifications@github.com:
This is an idea how to structure the code as Ro'ee, Vasily and myself discussed yesterday.
Most code goes into one of the subdirectories of the qcopter package. We can also add tests in this package (test directory; run with catkin_make run_tests). For simulation, we could add some launchfiles into the same package, but it's probably cleaner to do simulation stuff in a separate qcopter_sim package (because it requires additional dependencies). High-level overview
So for the competition, it would work like this:
- Preparation:
- Get some measurements from the competition area.
- Enter these as initial hints for the drone into the qcopter/launch/
.launch file. - Competition:
- Run roslaunch qcopter
.launch, and that's it. Drone will take off, fly according to these hints, find the exact mission site, perform the mission, fly back and land. More details
We identified the following steps, for each of which a class has been created for now:
- Take off movement/TakeOff
- Approach mission site ("dumb", using hints hardcoded into the launch file from our measurements at the competition site) navigation/ApproachMissionSite
- Mission-specific:
- Try to locate exact point where to start mission (e.g. for ball drop, go into spiral flight, trying to find target on the ground). This needs to be fast and will give some candiate locations. missions//IdentifyMissionSite with navigation/exploration/
- If a possible location is found, stop the flight and verify that we are indeed in the correct location (this can be slower). If we are not in the right location, resume step 3.1 Otherwise, position in an ideal starting point for the mission (e.g. ball drop: center drone above target on ground). missions/*/VerifyPosition
- Approach and continuously verify we are at the correct location/position. Once in a good position (ball drop: landed in center of target, QR scanner: in front of QR code), perform the mission task (drop ball, scan code, ..) missions/*/PerformMission
- Fly back to base movement/ApproachBase
- Land movement/Land
Each of these classes can, additionally to being used as a "normal" class, be implemented as a ROS node (only requires adding code to subscribe to topics in if name == 'main'). If executed as a standalone node (i.e. for example python2 ./missions/balldrop/PerformMission.py), we can test functionality of parts of the system individually. We can manually satisfy preconditions (e.g. manually fly to mission site and position above the target), then start automated part (land on target and drop ball).
Bringing these steps together would be implemented in nodes/
by calling into the library classes outlined above, switching from one stage to the next using some state machine. Thoughts?
You can view, comment on, or merge this pull request online at:
https://github.com/fselius/qcopter/pull/1 Commit Summary
- Set up ROS workspace.
- Set up initial structure, dummy unit/integration tests.
File Changes
- A .catkin_workspace https://github.com/fselius/qcopter/pull/1/files#diff-0 (1)
- M .gitignore https://github.com/fselius/qcopter/pull/1/files#diff-1 (7)
- M README.md https://github.com/fselius/qcopter/pull/1/files#diff-2 (41)
- A src/CMakeLists.txt https://github.com/fselius/qcopter/pull/1/files#diff-3 (1)
- A src/qcopter/CMakeLists.txt https://github.com/fselius/qcopter/pull/1/files#diff-4 (165)
- A src/qcopter/launch/balldrop.launch https://github.com/fselius/qcopter/pull/1/files#diff-5 (0)
- A src/qcopter/launch/balloon.launch https://github.com/fselius/qcopter/pull/1/files#diff-6 (0)
- A src/qcopter/launch/limbo.launch https://github.com/fselius/qcopter/pull/1/files#diff-7 (0)
- A src/qcopter/launch/qr.launch https://github.com/fselius/qcopter/pull/1/files#diff-8 (0)
- A src/qcopter/nodes/balldrop https://github.com/fselius/qcopter/pull/1/files#diff-9 (8)
- A src/qcopter/nodes/balloon https://github.com/fselius/qcopter/pull/1/files#diff-10 (8)
- A src/qcopter/nodes/limbo https://github.com/fselius/qcopter/pull/1/files#diff-11 (8)
- A src/qcopter/nodes/qr https://github.com/fselius/qcopter/pull/1/files#diff-12 (8)
- A src/qcopter/package.xml https://github.com/fselius/qcopter/pull/1/files#diff-13 (55)
- R src/qcopter/scripts/calibrate_camera.py https://github.com/fselius/qcopter/pull/1/files#diff-14 (0)
- A src/qcopter/setup.py https://github.com/fselius/qcopter/pull/1/files#diff-15 (11)
- A src/qcopter/src/qcopter/init.py https://github.com/fselius/qcopter/pull/1/files#diff-16 (0)
- A src/qcopter/src/qcopter/missions/init.py https://github.com/fselius/qcopter/pull/1/files#diff-17 (0)
- A src/qcopter/src/qcopter/missions/balldrop/IdentifyMissionSite.py https://github.com/fselius/qcopter/pull/1/files#diff-18 (0)
- A src/qcopter/src/qcopter/missions/balldrop/PerformMission.py https://github.com/fselius/qcopter/pull/1/files#diff-19 (0)
- A src/qcopter/src/qcopter/missions/balldrop/VerifyPosition.py https://github.com/fselius/qcopter/pull/1/files#diff-20 (0)
- A src/qcopter/src/qcopter/missions/balldrop/init.py https://github.com/fselius/qcopter/pull/1/files#diff-21 (0)
- A src/qcopter/src/qcopter/missions/balloon/IdentifyMissionSite.py https://github.com/fselius/qcopter/pull/1/files#diff-22 (0)
- A src/qcopter/src/qcopter/missions/balloon/PerformMission.py https://github.com/fselius/qcopter/pull/1/files#diff-23 (0)
- A src/qcopter/src/qcopter/missions/balloon/VerifyPosition.py https://github.com/fselius/qcopter/pull/1/files#diff-24 (0)
- A src/qcopter/src/qcopter/missions/balloon/init.py https://github.com/fselius/qcopter/pull/1/files#diff-25 (0)
- A src/qcopter/src/qcopter/missions/limbo/IdentifyMissionSite.py https://github.com/fselius/qcopter/pull/1/files#diff-26 (0)
- A src/qcopter/src/qcopter/missions/limbo/PerformMission.py https://github.com/fselius/qcopter/pull/1/files#diff-27 (0)
- A src/qcopter/src/qcopter/missions/limbo/VerifyPosition.py https://github.com/fselius/qcopter/pull/1/files#diff-28 (0)
- A src/qcopter/src/qcopter/missions/limbo/init.py https://github.com/fselius/qcopter/pull/1/files#diff-29 (0)
- A src/qcopter/src/qcopter/missions/qr/IdentifyMissionSite.py https://github.com/fselius/qcopter/pull/1/files#diff-30 (0)
- A src/qcopter/src/qcopter/missions/qr/PerformMission.py https://github.com/fselius/qcopter/pull/1/files#diff-31 (0)
- A src/qcopter/src/qcopter/missions/qr/VerifyPosition.py https://github.com/fselius/qcopter/pull/1/files#diff-32 (0)
- A src/qcopter/src/qcopter/missions/qr/init.py https://github.com/fselius/qcopter/pull/1/files#diff-33 (0)
- A src/qcopter/src/qcopter/movement/ApproachBase.py https://github.com/fselius/qcopter/pull/1/files#diff-34 (0)
- A src/qcopter/src/qcopter/movement/ApproachMissionSite.py https://github.com/fselius/qcopter/pull/1/files#diff-35 (0)
- A src/qcopter/src/qcopter/movement/EmergencyLand.py https://github.com/fselius/qcopter/pull/1/files#diff-36 (0)
- A src/qcopter/src/qcopter/movement/Land.py https://github.com/fselius/qcopter/pull/1/files#diff-37 (0)
- A src/qcopter/src/qcopter/movement/TakeOff.py https://github.com/fselius/qcopter/pull/1/files#diff-38 (0)
- A src/qcopter/src/qcopter/movement/init.py https://github.com/fselius/qcopter/pull/1/files#diff-39 (0)
- A src/qcopter/src/qcopter/movement/exploration/SpiralFlight.py https://github.com/fselius/qcopter/pull/1/files#diff-40 (0)
- A src/qcopter/src/qcopter/movement/exploration/init.py https://github.com/fselius/qcopter/pull/1/files#diff-41 (0)
- A src/qcopter/test/integration/dummy_integration_test.launch https://github.com/fselius/qcopter/pull/1/files#diff-42 (3)
- A src/qcopter/test/integration/dummy_integration_test.py https://github.com/fselius/qcopter/pull/1/files#diff-43 (24)
- A src/qcopter/test/unit/dummy_unit_test.py https://github.com/fselius/qcopter/pull/1/files#diff-44 (9)
- A src/qcopter_sim/launch/balldrop.launch https://github.com/fselius/qcopter/pull/1/files#diff-45 (0)
- A src/qcopter_sim/launch/balloon.launch https://github.com/fselius/qcopter/pull/1/files#diff-46 (0)
- A src/qcopter_sim/launch/limbo.launch https://github.com/fselius/qcopter/pull/1/files#diff-47 (0)
- A src/qcopter_sim/launch/qr.launch https://github.com/fselius/qcopter/pull/1/files#diff-48 (0)
- D target_finder/README.md https://github.com/fselius/qcopter/pull/1/files#diff-49 (15)
- D target_finder/target_finder.py https://github.com/fselius/qcopter/pull/1/files#diff-50 (60)
Patch Links:
— Reply to this email directly or view it on GitHub https://github.com/fselius/qcopter/pull/1.
Looks great!
We should also think about how to handle exceptions and failsafe. If battery < 30% abort current mission and run movement/land
.
For exceptions and failsafe, we could probably run a dedicated node that takes over once it detects a failure (e.g. if another node crashes). A quick search turned up the node_monitoring project (which is apparently not maintained anymore) and arni, which acts on statistics of topics.. maybe we can use that to detect if a node doesn't publish anything anymore (thus has likely crashed).
It would be cool to have something that monitor unexpected behavior and acts upon it. Unexpected behavior could be:
But that's still far ahead of us..
This is an idea how to structure the code as Ro'ee, Vasily and myself discussed yesterday.
Most code goes into one of the subdirectories of the qcopter package. We can also add tests in this package (
test
directory; run withcatkin_make run_tests
). For simulation, we could add some launchfiles into the same package, but it's probably cleaner to do simulation stuff in a separateqcopter_sim
package (because it requires additional dependencies).High-level overview
So for the competition, it would work like this:
qcopter/launch/<mission>.launch
file.roslaunch qcopter <mission>.launch
, and that's it. Drone will take off, fly according to these hints, find the exact mission site, perform the mission, fly back and land.More details
We identified the following steps, for each of which a class has been created for now:
movement/TakeOff
navigation/ApproachMissionSite
missions/*/IdentifyMissionSite
withnavigation/exploration/*
missions/*/VerifyPosition
missions/*/PerformMission
movement/ApproachBase
movement/Land
Each of these classes can, additionally to being used as a "normal" class, be implemented as a ROS node (only requires adding code to subscribe to topics in
if __name__ == '__main__'
). If executed as a standalone node (i.e. for examplepython2 ./missions/balldrop/PerformMission.py
), we can test functionality of parts of the system individually. We can manually satisfy preconditions (e.g. manually fly to mission site and position above the target), then start automated part (land on target and drop ball).Bringing these steps together would be implemented in
nodes/<mission>
by calling into the library classes outlined above, switching from one stage to the next using some state machine.Any thoughts, questions, suggestions, ...?