Track 411 files into repository.
- untracked .gitattributes - untracked .gitignore - untracked apps/ios/.gitignore - untracked apps/ios/cleverrc.xcodeproj/project.pbxproj - untracked apps/ios/cleverrc.xcodeproj/project.xcworkspace/contents.xcworkspacedata - untracked apps/ios/cleverrc.xcworkspace/contents.xcworkspacedata - untracked apps/ios/cleverrc/AppDelegate.swift - untracked apps/ios/cleverrc/Assets.xcassets/AppIcon.appiconset/cleverios180-1.png - untracked apps/ios/cleverrc/Assets.xcassets/AppIcon.appiconset/cleverios180.png - untracked apps/ios/cleverrc/Assets.xcassets/AppIcon.appiconset/Contents.json - untracked apps/ios/cleverrc/Assets.xcassets/Contents.json - untracked apps/ios/cleverrc/Assets.xcassets/Image.imageset/Contents.json - untracked apps/ios/cleverrc/Base.lproj/LaunchScreen.storyboard - untracked apps/ios/cleverrc/Base.lproj/Main.storyboard - untracked apps/ios/cleverrc/BinUtils.swift - untracked apps/ios/cleverrc/clever.svg - untracked apps/ios/cleverrc/index.html - untracked apps/ios/cleverrc/Info.plist - untracked apps/ios/cleverrc/main.css - untracked apps/ios/cleverrc/main.js - untracked apps/ios/cleverrc/README.md - untracked apps/ios/cleverrc/roslib.js - untracked apps/ios/cleverrc/telemetry.js - untracked apps/ios/cleverrc/ViewController.swift - untracked apps/ios/Podfile - untracked apps/ios/Podfile.lock - untracked apps/ios/README.md - untracked aruco_pose/CMakeLists.txt - untracked aruco_pose/nodelet_plugins.xml - untracked aruco_pose/package.xml - untracked aruco_pose/src/aruco_pose.cpp - untracked aruco_pose/src/fix.cpp - untracked assets/11_1.png - untracked assets/11_2.png - untracked assets/11_3.png - untracked assets/11_4.png - untracked assets/11_5.png - untracked assets/13_1.png - untracked assets/13_10.png - untracked assets/13_11.png - untracked assets/13_2.png - untracked assets/13_3.jpg - untracked assets/13_4.png - untracked assets/13_5.png - untracked assets/13_6.png - untracked assets/13_7.png - untracked assets/13_8.png - untracked assets/13_9.png - untracked assets/15_1.png - untracked assets/15_2.png - untracked assets/15_3.png - untracked assets/15_4.png - untracked assets/15_5.png - untracked assets/15_6.png - untracked assets/15_7.png - untracked assets/16_1.png - untracked assets/16_2.png - untracked assets/16_3.png - untracked assets/16_4.png - untracked assets/1_1.png - untracked assets/1_10.png - untracked assets/1_11.png - untracked assets/1_12.png - untracked assets/1_13.png - untracked assets/1_2.png - untracked assets/1_3.png - untracked assets/1_4.png - untracked assets/1_5.png - untracked assets/1_6.png - untracked assets/1_7.png - untracked assets/1_8.png - untracked assets/1_9.png - untracked assets/2_1.png - untracked assets/2_2.png - untracked assets/2_3.png - untracked assets/2_4.png - untracked assets/2_5.png - untracked assets/2_6.png - untracked assets/2_7.png - untracked assets/2_8.png - untracked assets/2_9.png - untracked assets/4_1.png - untracked assets/4_2.png - untracked assets/4_3.png - untracked assets/4_4.png - untracked assets/4_5.png - untracked assets/4_6.png - untracked assets/7_1.png - untracked assets/7_2.png - untracked assets/7_3.png - untracked assets/7_4.png - untracked assets/8_1.png - untracked assets/8_2.png - untracked assets/8_3.png - untracked assets/8_4.png - untracked assets/8_5.png - untracked assets/8_6.png - untracked assets/9_1.png - untracked assets/9_2.png - untracked assets/addEqipment.jpg - untracked assets/airframeSetup.jpg - untracked assets/allElements.png - untracked assets/attentionSave.jpg - untracked assets/brrc2205.png - untracked assets/brrc2205on.png - untracked assets/brrc2205ondeck.png - untracked assets/calibrateaxcel.jpg - untracked assets/calibrateaxcelstart.jpg - untracked assets/calibratecompass.jpg - untracked assets/calibrateESC.jpg - untracked assets/calibrategyro.jpg - untracked assets/calibratePIDparams.jpg - untracked assets/calibrateView.jpg - untracked assets/calibrateViewStart.jpg - untracked assets/casebattery.png - untracked assets/chooseSwitch.jpg - untracked assets/Clever main.png - untracked assets/clever.jpg - untracked assets/Clevermain.png - untracked assets/connectBattery.png - untracked assets/connectingRadio.png - untracked assets/connectionESCtoReceiver.png - untracked assets/connectionLost.jpg - untracked assets/connectionOK.jpg - untracked assets/connectionPixhawk.png - untracked assets/consistofTransmitter.jpg - untracked assets/cutwire14AWG.jpg - untracked assets/escDYSzap.png - untracked assets/escWires.png - untracked assets/explosion.png - untracked assets/firmwarePX4.jpg - untracked assets/flightModes.jpg - untracked assets/helphand.jpg - untracked assets/holderLegs.png - untracked assets/isoViewmountHolder.png - untracked assets/jumper.png - untracked assets/keep.png - untracked assets/lockradio.jpg - untracked assets/lockradio.png - untracked assets/lowsafeDeck.png - untracked assets/mainWindow.jpg - untracked assets/motorsTopview.png - untracked assets/mount5vconnector.png - untracked assets/mountAntenna.png - untracked assets/mountBeams.png - untracked assets/mountBottomDeck.png - untracked assets/mountHolder.png - untracked assets/mountPDB.png - untracked assets/mountReceiverDeck.png - untracked assets/mountReceiverStud.png - untracked assets/mountxt60pinsocket.png - untracked assets/notmoveslider.jpg - untracked assets/pixhawk.png - untracked assets/radioTransmitter.png - untracked assets/readyBatteryholder.png - untracked assets/receiver5V.png - untracked assets/receiverPPM.png - untracked assets/resolderingESC.png - untracked assets/safehighRadial.png - untracked assets/safeLegs.png - untracked assets/safelowRadial.png - untracked assets/safetybyassem.png - untracked assets/safetyINflight.png - untracked assets/safetyPower.png - untracked assets/safetyPreflight.png - untracked assets/soldering5VTOpdb.png - untracked assets/solderingBrrc2205ondeckTOescDYSzap.png - untracked assets/solderingPowerwires.png - untracked assets/solderingxt60socketTOpdb.png - untracked assets/stand.jpg - untracked assets/startPDBtest.jpg - untracked assets/testMotors.png - untracked assets/topESCcaseview.png - untracked assets/topPreview.png - untracked assets/topviewmountPDB.png - untracked assets/topviewpixhawk.png - untracked assets/turnoffSafetyswitch.jpg - untracked assets/xt60pinsocket.jpg - untracked assets/zap.jpg - untracked assets/zapPDBtest.jpg - untracked clever/camera_info/fisheye_cam_320.yaml - untracked clever/camera_info/fisheye_cam_640.yaml - untracked clever/CMakeLists.txt - untracked clever/launch/arduino.launch - untracked clever/launch/aruco.launch - untracked clever/launch/clever.launch - untracked clever/launch/copter_visualization.launch - untracked clever/launch/fpv_camera.launch - untracked clever/launch/main_camera.launch - untracked clever/launch/mavros.launch - untracked clever/launch/sitl.launch - untracked clever/launch/web_server.launch - untracked clever/nodelet_plugins.xml - untracked clever/package.xml - untracked clever/requirements.txt - untracked clever/src/aruco_vpe.cpp - untracked clever/src/fcu_horiz.cpp - untracked clever/src/fpv_camera - untracked clever/src/global_local.py - untracked clever/src/rc.cpp - untracked clever/src/simple_offboard.py - untracked clever/src/util.h - untracked clever/src/util.py - untracked clever/src/web_server.py - untracked clever/srv/GetTelemetry.srv - untracked clever/srv/Navigate.srv - untracked clever/srv/SetAttitude.srv - untracked clever/srv/SetAttitudeYawRate.srv - untracked clever/srv/SetPosition.srv - untracked clever/srv/SetPositionGlobal.srv - untracked clever/srv/SetPositionGlobalYawRate.srv - untracked clever/srv/SetPositionYawRate.srv - untracked clever/srv/SetRates.srv - untracked clever/srv/SetRatesYaw.srv - untracked clever/srv/SetVelocity.srv - untracked clever/srv/SetVelocityYawRate.srv - untracked deploy/clever.service - untracked deploy/clever_arudino.tar.gz - untracked deploy/generate_ros_lib - untracked deploy/roscore.env - untracked deploy/roscore.service - modified docs/3g.md - modified docs/assemble.md - untracked docs/deck.md - modified docs/etcher.md - modified docs/frames.md - modified docs/les1.md - modified docs/les11.md - modified docs/les13.md - modified docs/les15.md - modified docs/les16.md - modified docs/les2.md - modified docs/les4.md - modified docs/les7.md - modified docs/les8.md - modified docs/les9.md - modified docs/modes.md - untracked docs/powerConnection.md - modified docs/radioerrors.md - modified docs/radioerrors1.md - modified docs/safety.md - modified docs/setup.md - modified docs/simple_offboard.md - modified docs/tb.md - untracked docs/testConnection.md - modified docs/wifi.md - untracked docs/zap.md - removed gpsmd.md - untracked image/apps.sh - untracked image/git_release.py - untracked image/iface.sh - untracked image/image-config.sh - untracked image/Jenkinsfile - untracked image/ros.sh - untracked image/yadisk.py - removed img/11_1.png - removed img/11_2.png - removed img/11_3.png - removed img/11_4.png - removed img/11_5.png - removed img/13_1.png - removed img/13_10.png - removed img/13_11.png - removed img/13_2.png - removed img/13_3.jpg - removed img/13_4.png - removed img/13_5.png - removed img/13_6.png - removed img/13_7.png - removed img/13_8.png - removed img/13_9.png - removed img/15_1.png - removed img/15_2.png - removed img/15_3.png - removed img/15_4.png - removed img/15_5.png - removed img/15_6.png - removed img/15_7.png - removed img/16_1.png - removed img/16_2.png - removed img/16_3.png - removed img/16_4.png - removed img/1_1.png - removed img/1_10.png - removed img/1_11.png - removed img/1_12.png - removed img/1_13.png - removed img/1_2.png - removed img/1_3.png - removed img/1_4.png - removed img/1_5.png - removed img/1_6.png - removed img/1_7.png - removed img/1_8.png - removed img/1_9.png - removed img/2_1.png - removed img/2_2.png - removed img/2_3.png - removed img/2_4.png - removed img/2_5.png - removed img/2_6.png - removed img/2_7.png - removed img/2_8.png - removed img/2_9.png - removed img/4_1.png - removed img/4_2.png - removed img/4_3.png - removed img/4_4.png - removed img/4_5.png - removed img/4_6.png - removed img/7_1.png - removed img/7_2.png - removed img/7_3.png - removed img/7_4.png - removed img/8_1.png - removed img/8_2.png - removed img/8_3.png - removed img/8_4.png - removed img/8_5.png - removed img/8_6.png - removed img/9_1.png - removed img/9_2.png - removed img/addEqipment.jpg - removed img/airframeSetup.jpg - removed img/allElements.png - removed img/attentionSave.jpg - removed img/brrc2205.png - removed img/brrc2205on.png - removed img/brrc2205ondeck.png - removed img/calibrateaxcel.jpg - removed img/calibrateaxcelstart.jpg - removed img/calibratecompass.jpg - removed img/calibrateESC.jpg - removed img/calibrategyro.jpg - removed img/calibratePIDparams.jpg - removed img/calibrateView.jpg - removed img/calibrateViewStart.jpg - removed img/casebattery.png - removed img/chooseSwitch.jpg - removed img/Clever main.png - removed img/clever.jpg - removed img/Clevermain.png - removed img/connectBattery.png - removed img/connectingRadio.png - removed img/connectionESCtoReceiver.png - removed img/connectionLost.jpg - removed img/connectionOK.jpg - removed img/connectionPixhawk.png - removed img/consistofTransmitter.jpg - removed img/cutwire14AWG.jpg - removed img/escDYSzap.png - removed img/escWires.png - removed img/explosion.png - removed img/firmwarePX4.jpg - removed img/flightModes.jpg - removed img/helphand.jpg - removed img/holderLegs.png - removed img/isoViewmountHolder.png - removed img/jumper.png - removed img/keep.png - removed img/lockradio.jpg - removed img/lockradio.png - removed img/lowsafeDeck.png - removed img/mainWindow.jpg - removed img/motorsTopview.png - removed img/mount5vconnector.png - removed img/mountAntenna.png - removed img/mountBeams.png - removed img/mountBottomDeck.png - removed img/mountHolder.png - removed img/mountPDB.png - removed img/mountReceiverDeck.png - removed img/mountReceiverStud.png - removed img/mountxt60pinsocket.png - removed img/notmoveslider.jpg - removed img/pixhawk.png - removed img/radioTransmitter.png - removed img/readyBatteryholder.png - removed img/receiver5V.png - removed img/receiverPPM.png - removed img/resolderingESC.png - removed img/safehighRadial.png - removed img/safeLegs.png - removed img/safelowRadial.png - removed img/safetybyassem.png - removed img/safetyINflight.png - removed img/safetyPower.png - removed img/safetyPreflight.png - removed img/soldering5VTOpdb.png - removed img/solderingBrrc2205ondeckTOescDYSzap.png - removed img/solderingPowerwires.png - removed img/solderingxt60socketTOpdb.png - removed img/stand.jpg - removed img/startPDBtest.jpg - removed img/testMotors.png - removed img/topESCcaseview.png - removed img/topPreview.png - removed img/topviewmountPDB.png - removed img/topviewpixhawk.png - removed img/turnoffSafetyswitch.jpg - removed img/xt60pinsocket.jpg - removed img/zap.jpg - removed img/zapPDBtest.jpg - removed notes/deck.md - removed notes/powerConnection.md - removed notes/testConnection.md - removed notes/zap.md - removed primeri-programm.md - modified README.md - removed sborka.md - removed sitl.md Auto commit by GitBook Editor
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
apps/ios/cleverrc/roslib.js linguist-vendored
|
||||
apps/ios/cleverrc/BinUtils.swift linguist-vendored
|
||||
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/deploy/ros_lib/
|
||||
*.pyc
|
||||
73
README.md
@@ -1,7 +1,7 @@
|
||||
Клевер
|
||||
======
|
||||
|
||||
<img src="img/clever.jpg" align="right" width="300px" alt="Клевер">
|
||||
<img src="assets/clever.jpg" align="right" width="300px" alt="Клевер">
|
||||
|
||||
«Клевер» — это учебный конструктор программируемого квадрокоптера, состоящего из популярных открытых компонентов, а также набор необходимой документации и библиотек для работы с ним.
|
||||
|
||||
@@ -11,4 +11,73 @@
|
||||
|
||||
Для того, чтобы научиться собирать, настраивать, пилотировать и программировать автономный дрон «Клевер», воспользуйтесь этим учебником.
|
||||
|
||||
Оглавление находится в файле [SUMMARY.md](/SUMMARY.md).
|
||||
Основная документация
|
||||
---------------------
|
||||
|
||||
https://copterexpress.gitbooks.io/clever/content/
|
||||
|
||||
**Образ ОС** для RPi 3 с предустановленным и преднастроенным ПО можно скачать [здесь](https://copterexpress.gitbooks.io/clever/content/docs/microsd_images.html).
|
||||
|
||||
Образ включает в себя:
|
||||
|
||||
* Raspbian Stretch
|
||||
* ROS Kinetic
|
||||
* Настроенную работу с сетью
|
||||
* OpenCV
|
||||
* mavros
|
||||
* Набор ПО для работы с Клевером
|
||||
|
||||
[Описание API](https://copterexpress.gitbooks.io/clever/content/docs/simple_offboard.html) для автономных полетов.
|
||||
|
||||
Ручная установка
|
||||
---------
|
||||
|
||||
Установить ROS Kinetic согласно [инструкциям](http://wiki.ros.org/kinetic/Installation).
|
||||
|
||||
Склонировать репозиторий в папку `/home/pi/catkin_ws/src/clever`:
|
||||
|
||||
```bash
|
||||
cd ~/catkin_ws/src
|
||||
git clone https://github.com/CopterExpress/clever.git clever
|
||||
```
|
||||
|
||||
Пересобрать ROS-пакеты:
|
||||
|
||||
```bash
|
||||
cd ~/catkin_ws
|
||||
catkin_make -j1
|
||||
```
|
||||
|
||||
Включить сервис roscore (если он не включен):
|
||||
|
||||
```bash
|
||||
sudo systemctl enable /home/pi/catkin_ws/src/clever/deploy/roscore.service
|
||||
sudo systemctl start roscore
|
||||
```
|
||||
|
||||
Включить сервис clever:
|
||||
|
||||
```bash
|
||||
sudo systemctl enable /home/pi/catkin_ws/src/clever/deploy/clever.service
|
||||
sudo systemctl start clever
|
||||
```
|
||||
|
||||
Зависимости
|
||||
-----------
|
||||
|
||||
[ROS Kinetic](http://wiki.ros.org/kinetic).
|
||||
|
||||
Необходимые для работы ROS-пакеты:
|
||||
|
||||
* `opencv3`
|
||||
* `mavros`
|
||||
* `rosbridge_suite`
|
||||
* `web_video_server`
|
||||
* `cv_camera`
|
||||
* `nodelet`
|
||||
* `dynamic_reconfigure`
|
||||
* `bondcpp`, ветка `master`
|
||||
* `roslint`
|
||||
* `rosserial`
|
||||
|
||||
TODO: внести в package.xml
|
||||
|
||||
17
apps/ios/.gitignore
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
# Xcode
|
||||
.DS_Store
|
||||
build/
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
!default.xcworkspace
|
||||
xcuserdata
|
||||
profile
|
||||
*.moved-aside
|
||||
DerivedData
|
||||
Pods/
|
||||
14
apps/ios/Podfile
Normal file
@@ -0,0 +1,14 @@
|
||||
project 'cleverrc.xcodeproj/'
|
||||
|
||||
# Uncomment the next line to define a global platform for your project
|
||||
# platform :ios, '9.0'
|
||||
|
||||
target 'cleverrc' do
|
||||
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
|
||||
use_frameworks!
|
||||
|
||||
# Pods for cleverrc
|
||||
pod 'SwiftSocket', '~> 2.0'
|
||||
pod 'NotificationBannerSwift'
|
||||
|
||||
end
|
||||
21
apps/ios/Podfile.lock
Normal file
@@ -0,0 +1,21 @@
|
||||
PODS:
|
||||
- MarqueeLabel/Swift (3.1.4)
|
||||
- NotificationBannerSwift (1.5.4):
|
||||
- MarqueeLabel/Swift
|
||||
- SnapKit (~> 4.0)
|
||||
- SnapKit (4.0.0)
|
||||
- SwiftSocket (2.0.2)
|
||||
|
||||
DEPENDENCIES:
|
||||
- NotificationBannerSwift
|
||||
- SwiftSocket (~> 2.0)
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
MarqueeLabel: bf768455fe88d427f71476ebb23f9092b660f40b
|
||||
NotificationBannerSwift: 4f6666c8421dcf11be0812dd1093d932c15921af
|
||||
SnapKit: a42d492c16e80209130a3379f73596c3454b7694
|
||||
SwiftSocket: 6f4c9c63fbc5c1d61188936bb3c599fd546f40ae
|
||||
|
||||
PODFILE CHECKSUM: fd5199f69c3ee8c1fbc0dd582477d890c8b2a24f
|
||||
|
||||
COCOAPODS: 1.4.0
|
||||
10
apps/ios/README.md
Normal file
@@ -0,0 +1,10 @@
|
||||
iOS-приложение для управления Клевером
|
||||
--------------------------------------
|
||||
|
||||
Для установки зависимостей необходим [CocoaPods](https://cocoapods.org):
|
||||
|
||||
```bash
|
||||
pod install
|
||||
```
|
||||
|
||||
Для разработки и сборки откройте в XCode файл `cleverrc.xcworkspace`.
|
||||
444
apps/ios/cleverrc.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,444 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 48;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
7C0AB7AB202A744400BAED27 /* BinUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C0AB7AA202A744400BAED27 /* BinUtils.swift */; };
|
||||
7C51654120139237004D1F4D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C51654020139237004D1F4D /* AppDelegate.swift */; };
|
||||
7C51654320139237004D1F4D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C51654220139237004D1F4D /* ViewController.swift */; };
|
||||
7C51654620139237004D1F4D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7C51654420139237004D1F4D /* Main.storyboard */; };
|
||||
7C51654820139237004D1F4D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7C51654720139237004D1F4D /* Assets.xcassets */; };
|
||||
7C51654B20139237004D1F4D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7C51654920139237004D1F4D /* LaunchScreen.storyboard */; };
|
||||
7C516553201526BA004D1F4D /* index.html in Resources */ = {isa = PBXBuildFile; fileRef = 7C516552201526BA004D1F4D /* index.html */; };
|
||||
7C51655520153180004D1F4D /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 7C51655420153180004D1F4D /* main.js */; };
|
||||
7CA401E22033CE17009FAA3B /* main.css in Resources */ = {isa = PBXBuildFile; fileRef = 7CA401E12033CE17009FAA3B /* main.css */; };
|
||||
7CA401E42033FA34009FAA3B /* telemetry.js in Resources */ = {isa = PBXBuildFile; fileRef = 7CA401E32033FA34009FAA3B /* telemetry.js */; };
|
||||
7CA401E6203471D9009FAA3B /* clever.svg in Resources */ = {isa = PBXBuildFile; fileRef = 7CA401E5203471D8009FAA3B /* clever.svg */; };
|
||||
C25141CAF1A7125F3CE29DDC /* Pods_cleverrc.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C38C04523251039FF13DDCD /* Pods_cleverrc.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
5C38C04523251039FF13DDCD /* Pods_cleverrc.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_cleverrc.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7C0AB7AA202A744400BAED27 /* BinUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BinUtils.swift; sourceTree = "<group>"; };
|
||||
7C45DCE9203A75A2009C73F5 /* roslib.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = roslib.js; sourceTree = "<group>"; };
|
||||
7C51653D20139237004D1F4D /* cleverrc.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = cleverrc.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7C51654020139237004D1F4D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
7C51654220139237004D1F4D /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
7C51654520139237004D1F4D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
7C51654720139237004D1F4D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
7C51654A20139237004D1F4D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
7C51654C20139237004D1F4D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
7C516552201526BA004D1F4D /* index.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = index.html; sourceTree = "<group>"; };
|
||||
7C51655420153180004D1F4D /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = main.js; sourceTree = "<group>"; };
|
||||
7CA401E12033CE17009FAA3B /* main.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = main.css; sourceTree = "<group>"; };
|
||||
7CA401E32033FA34009FAA3B /* telemetry.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = telemetry.js; sourceTree = "<group>"; };
|
||||
7CA401E5203471D8009FAA3B /* clever.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = clever.svg; sourceTree = "<group>"; };
|
||||
AAC9195BF3A9BF6942EF4D0B /* Pods-cleverrc.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-cleverrc.release.xcconfig"; path = "Pods/Target Support Files/Pods-cleverrc/Pods-cleverrc.release.xcconfig"; sourceTree = "<group>"; };
|
||||
CB200F4B933204EA97E0E2E4 /* Pods-cleverrc.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-cleverrc.debug.xcconfig"; path = "Pods/Target Support Files/Pods-cleverrc/Pods-cleverrc.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
7C51653A20139237004D1F4D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C25141CAF1A7125F3CE29DDC /* Pods_cleverrc.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
4FA3968F2242239E15A656D2 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CB200F4B933204EA97E0E2E4 /* Pods-cleverrc.debug.xcconfig */,
|
||||
AAC9195BF3A9BF6942EF4D0B /* Pods-cleverrc.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
66C638F0021EBE07741B26F3 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5C38C04523251039FF13DDCD /* Pods_cleverrc.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7C51653420139237004D1F4D = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
66C638F0021EBE07741B26F3 /* Frameworks */,
|
||||
4FA3968F2242239E15A656D2 /* Pods */,
|
||||
7C51653E20139237004D1F4D /* Products */,
|
||||
7C51653F20139237004D1F4D /* cleverrc */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7C51653E20139237004D1F4D /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7C51653D20139237004D1F4D /* cleverrc.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7C51653F20139237004D1F4D /* cleverrc */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7C45DCE9203A75A2009C73F5 /* roslib.js */,
|
||||
7C51654020139237004D1F4D /* AppDelegate.swift */,
|
||||
7C51654720139237004D1F4D /* Assets.xcassets */,
|
||||
7C0AB7AA202A744400BAED27 /* BinUtils.swift */,
|
||||
7C51654C20139237004D1F4D /* Info.plist */,
|
||||
7C51654920139237004D1F4D /* LaunchScreen.storyboard */,
|
||||
7C51654420139237004D1F4D /* Main.storyboard */,
|
||||
7C51654220139237004D1F4D /* ViewController.swift */,
|
||||
7CA401E5203471D8009FAA3B /* clever.svg */,
|
||||
7C516552201526BA004D1F4D /* index.html */,
|
||||
7CA401E12033CE17009FAA3B /* main.css */,
|
||||
7C51655420153180004D1F4D /* main.js */,
|
||||
7CA401E32033FA34009FAA3B /* telemetry.js */,
|
||||
);
|
||||
path = cleverrc;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
7C51653C20139237004D1F4D /* cleverrc */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 7C51654F20139237004D1F4D /* Build configuration list for PBXNativeTarget "cleverrc" */;
|
||||
buildPhases = (
|
||||
9F096121C4A02BCE9D4FD1B9 /* [CP] Check Pods Manifest.lock */,
|
||||
7C51653920139237004D1F4D /* Sources */,
|
||||
7C51653A20139237004D1F4D /* Frameworks */,
|
||||
7C51653B20139237004D1F4D /* Resources */,
|
||||
A37DBBAD5E44E632F8A8A204 /* [CP] Embed Pods Frameworks */,
|
||||
9BAB41D26FC0095C7C86B9DE /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = cleverrc;
|
||||
productName = cleverrc;
|
||||
productReference = 7C51653D20139237004D1F4D /* cleverrc.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
7C51653520139237004D1F4D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0920;
|
||||
LastUpgradeCheck = 0920;
|
||||
ORGANIZATIONNAME = "Copter Express";
|
||||
TargetAttributes = {
|
||||
7C51653C20139237004D1F4D = {
|
||||
CreatedOnToolsVersion = 9.2;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 7C51653820139237004D1F4D /* Build configuration list for PBXProject "cleverrc" */;
|
||||
compatibilityVersion = "Xcode 8.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 7C51653420139237004D1F4D;
|
||||
productRefGroup = 7C51653E20139237004D1F4D /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
7C51653C20139237004D1F4D /* cleverrc */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
7C51653B20139237004D1F4D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
7C51654B20139237004D1F4D /* LaunchScreen.storyboard in Resources */,
|
||||
7CA401E6203471D9009FAA3B /* clever.svg in Resources */,
|
||||
7CA401E42033FA34009FAA3B /* telemetry.js in Resources */,
|
||||
7C516553201526BA004D1F4D /* index.html in Resources */,
|
||||
7C51654820139237004D1F4D /* Assets.xcassets in Resources */,
|
||||
7CA401E22033CE17009FAA3B /* main.css in Resources */,
|
||||
7C51654620139237004D1F4D /* Main.storyboard in Resources */,
|
||||
7C51655520153180004D1F4D /* main.js in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
9BAB41D26FC0095C7C86B9DE /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-cleverrc/Pods-cleverrc-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
9F096121C4A02BCE9D4FD1B9 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-cleverrc-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
A37DBBAD5E44E632F8A8A204 /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${SRCROOT}/Pods/Target Support Files/Pods-cleverrc/Pods-cleverrc-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/MarqueeLabel/MarqueeLabel.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/NotificationBannerSwift/NotificationBannerSwift.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/SwiftSocket/SwiftSocket.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MarqueeLabel.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NotificationBannerSwift.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftSocket.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-cleverrc/Pods-cleverrc-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
7C51653920139237004D1F4D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
7C51654320139237004D1F4D /* ViewController.swift in Sources */,
|
||||
7C51654120139237004D1F4D /* AppDelegate.swift in Sources */,
|
||||
7C0AB7AB202A744400BAED27 /* BinUtils.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
7C51654420139237004D1F4D /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
7C51654520139237004D1F4D /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
path = .;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7C51654920139237004D1F4D /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
7C51654A20139237004D1F4D /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
path = .;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
7C51654D20139237004D1F4D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.2;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
7C51654E20139237004D1F4D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.2;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
7C51655020139237004D1F4D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = CB200F4B933204EA97E0E2E4 /* Pods-cleverrc.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = 7QY6KJ2672;
|
||||
INFOPLIST_FILE = cleverrc/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = coex.cleverrc;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
7C51655120139237004D1F4D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = AAC9195BF3A9BF6942EF4D0B /* Pods-cleverrc.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = 7QY6KJ2672;
|
||||
INFOPLIST_FILE = cleverrc/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = coex.cleverrc;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
7C51653820139237004D1F4D /* Build configuration list for PBXProject "cleverrc" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
7C51654D20139237004D1F4D /* Debug */,
|
||||
7C51654E20139237004D1F4D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
7C51654F20139237004D1F4D /* Build configuration list for PBXNativeTarget "cleverrc" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
7C51655020139237004D1F4D /* Debug */,
|
||||
7C51655120139237004D1F4D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 7C51653520139237004D1F4D /* Project object */;
|
||||
}
|
||||
7
apps/ios/cleverrc.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:cleverrc.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
10
apps/ios/cleverrc.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:cleverrc.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
46
apps/ios/cleverrc/AppDelegate.swift
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// AppDelegate.swift
|
||||
// cleverrc
|
||||
//
|
||||
// Created by Oleg Kalachev on 20.01.2018.
|
||||
// Copyright © 2018 Copter Express. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
return true
|
||||
}
|
||||
|
||||
func applicationWillResignActive(_ application: UIApplication) {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
func applicationDidEnterBackground(_ application: UIApplication) {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
func applicationWillEnterForeground(_ application: UIApplication) {
|
||||
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive(_ application: UIApplication) {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_ application: UIApplication) {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "cleverios180.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "cleverios180-1.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "83.5x83.5",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ios-marketing",
|
||||
"size" : "1024x1024",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
6
apps/ios/cleverrc/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
20
apps/ios/cleverrc/Assets.xcassets/Image.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
29
apps/ios/cleverrc/Base.lproj/LaunchScreen.storyboard
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="0.10586584359407425" green="0.10589186102151871" blue="0.10586420446634293" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
46
apps/ios/cleverrc/Base.lproj/Main.storyboard
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<device id="retina4_7" orientation="landscape">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="cleverrc" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="667" height="375"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<wkWebView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dtJ-LN-BYT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="667" height="375"/>
|
||||
<color key="backgroundColor" red="0.12939286231994629" green="0.12942266464233398" blue="0.12939092516899109" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<wkWebViewConfiguration key="configuration">
|
||||
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
|
||||
<wkPreferences key="preferences"/>
|
||||
</wkWebViewConfiguration>
|
||||
</wkWebView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.1097869947552681" green="0.10981365293264389" blue="0.10978532582521439" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="dtJ-LN-BYT" firstAttribute="height" secondItem="8bC-Xf-vdC" secondAttribute="height" id="KRn-ag-67x"/>
|
||||
<constraint firstItem="dtJ-LN-BYT" firstAttribute="width" secondItem="8bC-Xf-vdC" secondAttribute="width" id="qOr-gg-e4M"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="webView" destination="dtJ-LN-BYT" id="bQ3-jy-o6E"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="138.0809595202399" y="124"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
453
apps/ios/cleverrc/BinUtils.swift
vendored
Normal file
@@ -0,0 +1,453 @@
|
||||
//
|
||||
// BinUtils.swift
|
||||
// BinUtils
|
||||
//
|
||||
// Created by Nicolas Seriot on 12/03/16.
|
||||
// Copyright © 2016 Nicolas Seriot. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreFoundation
|
||||
|
||||
// MARK: protocol UnpackedType
|
||||
|
||||
public protocol Unpackable {}
|
||||
|
||||
extension NSString: Unpackable {}
|
||||
extension Bool: Unpackable {}
|
||||
extension Int: Unpackable {}
|
||||
extension Double: Unpackable {}
|
||||
|
||||
// MARK: protocol DataConvertible
|
||||
|
||||
protocol DataConvertible {}
|
||||
|
||||
extension DataConvertible {
|
||||
|
||||
init?(data: Data) {
|
||||
guard data.count == MemoryLayout<Self>.size else { return nil }
|
||||
self = data.withUnsafeBytes { $0.pointee }
|
||||
}
|
||||
|
||||
init?(bytes: [UInt8]) {
|
||||
let data = Data(bytes:bytes)
|
||||
self.init(data:data)
|
||||
}
|
||||
|
||||
var data: Data {
|
||||
var value = self
|
||||
return Data(buffer: UnsafeBufferPointer(start: &value, count: 1))
|
||||
}
|
||||
}
|
||||
|
||||
extension Bool : DataConvertible { }
|
||||
|
||||
extension Int8 : DataConvertible { }
|
||||
extension Int16 : DataConvertible { }
|
||||
extension Int32 : DataConvertible { }
|
||||
extension Int64 : DataConvertible { }
|
||||
|
||||
extension UInt8 : DataConvertible { }
|
||||
extension UInt16 : DataConvertible { }
|
||||
extension UInt32 : DataConvertible { }
|
||||
extension UInt64 : DataConvertible { }
|
||||
|
||||
extension Float32 : DataConvertible { }
|
||||
extension Float64 : DataConvertible { }
|
||||
|
||||
// MARK: String extension
|
||||
|
||||
extension String {
|
||||
subscript (from:Int, to:Int) -> String {
|
||||
return NSString(string: self).substring(with: NSMakeRange(from, to-from))
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Data extension
|
||||
|
||||
extension Data {
|
||||
var bytes : [UInt8] {
|
||||
return self.withUnsafeBytes {
|
||||
[UInt8](UnsafeBufferPointer(start: $0, count: self.count))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: functions
|
||||
|
||||
public func hexlify(_ data:Data) -> String {
|
||||
|
||||
// similar to hexlify() in Python's binascii module
|
||||
// https://docs.python.org/2/library/binascii.html
|
||||
|
||||
var s = String()
|
||||
var byte: UInt8 = 0
|
||||
|
||||
for i in 0 ..< data.count {
|
||||
NSData(data: data).getBytes(&byte, range: NSMakeRange(i, 1))
|
||||
s = s.appendingFormat("%02x", byte)
|
||||
}
|
||||
|
||||
return s as String
|
||||
}
|
||||
|
||||
public func unhexlify(_ string:String) -> Data? {
|
||||
|
||||
// similar to unhexlify() in Python's binascii module
|
||||
// https://docs.python.org/2/library/binascii.html
|
||||
|
||||
let s = string.uppercased().replacingOccurrences(of: " ", with: "")
|
||||
|
||||
let nonHexCharacterSet = CharacterSet(charactersIn: "0123456789ABCDEF").inverted
|
||||
if let range = s.rangeOfCharacter(from: nonHexCharacterSet) {
|
||||
print("-- found non hex character at range \(range)")
|
||||
return nil
|
||||
}
|
||||
|
||||
var data = Data(capacity: s.count / 2)
|
||||
|
||||
for i in stride(from: 0, to:s.count, by:2) {
|
||||
let byteString = s[i, i+2]
|
||||
let byte = UInt8(byteString.withCString { strtoul($0, nil, 16) })
|
||||
data.append([byte] as [UInt8], count: 1)
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
func readIntegerType<T:DataConvertible>(_ type:T.Type, bytes:[UInt8], loc:inout Int) -> T {
|
||||
let size = MemoryLayout<T>.size
|
||||
let sub = Array(bytes[loc..<(loc+size)])
|
||||
loc += size
|
||||
return T(bytes: sub)!
|
||||
}
|
||||
|
||||
func readFloatingPointType<T:DataConvertible>(_ type:T.Type, bytes:[UInt8], loc:inout Int, isBigEndian:Bool) -> T {
|
||||
let size = MemoryLayout<T>.size
|
||||
let sub = Array(bytes[loc..<(loc+size)])
|
||||
loc += size
|
||||
let sub_ = isBigEndian ? sub.reversed() : sub
|
||||
return T(bytes: sub_)!
|
||||
}
|
||||
|
||||
func isBigEndianFromMandatoryByteOrderFirstCharacter(_ format:String) -> Bool {
|
||||
|
||||
guard let firstChar = format.first else { assertionFailure("empty format"); return false }
|
||||
|
||||
let s = NSString(string: String(firstChar))
|
||||
let c = s.substring(to: 1)
|
||||
|
||||
if c == "@" { assertionFailure("native size and alignment is unsupported") }
|
||||
|
||||
if c == "=" || c == "<" { return false }
|
||||
if c == ">" || c == "!" { return true }
|
||||
|
||||
assertionFailure("format '\(format)' first character must be among '=<>!'")
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// akin to struct.calcsize(fmt)
|
||||
func numberOfBytesInFormat(_ format:String) -> Int {
|
||||
|
||||
var numberOfBytes = 0
|
||||
|
||||
var n = 0 // repeat counter
|
||||
|
||||
var mutableFormat = format
|
||||
|
||||
while !mutableFormat.isEmpty {
|
||||
|
||||
let c = mutableFormat.remove(at: mutableFormat.startIndex)
|
||||
|
||||
if let i = Int(String(c)) , 0...9 ~= i {
|
||||
if n > 0 { n *= 10 }
|
||||
n += i
|
||||
continue
|
||||
}
|
||||
|
||||
if c == "s" {
|
||||
numberOfBytes += max(n,1)
|
||||
n = 0
|
||||
continue
|
||||
}
|
||||
|
||||
for _ in 0..<max(n,1) {
|
||||
|
||||
switch(c) {
|
||||
|
||||
case "@", "<", "=", ">", "!", " ":
|
||||
()
|
||||
case "c", "b", "B", "x", "?":
|
||||
numberOfBytes += 1
|
||||
case "h", "H":
|
||||
numberOfBytes += 2
|
||||
case "i", "l", "I", "L", "f":
|
||||
numberOfBytes += 4
|
||||
case "q", "Q", "d":
|
||||
numberOfBytes += 8
|
||||
case "P":
|
||||
numberOfBytes += MemoryLayout<Int>.size
|
||||
default:
|
||||
assertionFailure("-- unsupported format \(c)")
|
||||
}
|
||||
}
|
||||
|
||||
n = 0
|
||||
}
|
||||
|
||||
return numberOfBytes
|
||||
}
|
||||
|
||||
func formatDoesMatchDataLength(_ format:String, data:Data) -> Bool {
|
||||
let sizeAccordingToFormat = numberOfBytesInFormat(format)
|
||||
let dataLength = data.count
|
||||
if sizeAccordingToFormat != dataLength {
|
||||
print("format \"\(format)\" expects \(sizeAccordingToFormat) bytes but data is \(dataLength) bytes")
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/*
|
||||
pack() and unpack() should behave as Python's struct module https://docs.python.org/2/library/struct.html BUT:
|
||||
- native size and alignment '@' is not supported
|
||||
- as a consequence, the byte order specifier character is mandatory and must be among "=<>!"
|
||||
- native byte order '=' assumes a little-endian system (eg. Intel x86)
|
||||
- Pascal strings 'p' and native pointers 'P' are not supported
|
||||
*/
|
||||
|
||||
public enum BinUtilsError: Error {
|
||||
case formatDoesMatchDataLength(format:String, dataSize:Int)
|
||||
case unsupportedFormat(character:Character)
|
||||
}
|
||||
|
||||
public func pack(_ format:String, _ objects:[Any], _ stringEncoding:String.Encoding=String.Encoding.windowsCP1252) -> Data {
|
||||
|
||||
var objectsQueue = objects
|
||||
|
||||
var mutableFormat = format
|
||||
|
||||
var mutableData = Data()
|
||||
|
||||
var isBigEndian = false
|
||||
|
||||
let firstCharacter = mutableFormat.remove(at: mutableFormat.startIndex)
|
||||
|
||||
switch(firstCharacter) {
|
||||
case "<", "=":
|
||||
isBigEndian = false
|
||||
case ">", "!":
|
||||
isBigEndian = true
|
||||
case "@":
|
||||
assertionFailure("native size and alignment '@' is unsupported'")
|
||||
default:
|
||||
assertionFailure("unsupported format chacracter'")
|
||||
}
|
||||
|
||||
var n = 0 // repeat counter
|
||||
|
||||
while !mutableFormat.isEmpty {
|
||||
|
||||
let c = mutableFormat.remove(at: mutableFormat.startIndex)
|
||||
|
||||
if let i = Int(String(c)) , 0...9 ~= i {
|
||||
if n > 0 { n *= 10 }
|
||||
n += i
|
||||
continue
|
||||
}
|
||||
|
||||
var o : Any = 0
|
||||
|
||||
if c == "s" {
|
||||
o = objectsQueue.remove(at: 0)
|
||||
|
||||
guard let stringData = (o as! String).data(using: .utf8) else { assertionFailure(); return Data() }
|
||||
var bytes = stringData.bytes
|
||||
|
||||
let expectedSize = max(1, n)
|
||||
|
||||
// pad ...
|
||||
while bytes.count < expectedSize { bytes.append(0x00) }
|
||||
|
||||
// ... or trunk
|
||||
if bytes.count > expectedSize { bytes = Array(bytes[0..<expectedSize]) }
|
||||
|
||||
assert(bytes.count == expectedSize)
|
||||
|
||||
if isBigEndian { bytes = bytes.reversed() }
|
||||
|
||||
mutableData.append(bytes, count: bytes.count)
|
||||
|
||||
n = 0
|
||||
continue
|
||||
}
|
||||
|
||||
for _ in 0..<max(n,1) {
|
||||
|
||||
var bytes : [UInt8] = []
|
||||
|
||||
if c != "x" {
|
||||
o = objectsQueue.removeFirst()
|
||||
}
|
||||
|
||||
switch(c) {
|
||||
case "?":
|
||||
bytes = (o as! Bool) ? [0x01] : [0x00]
|
||||
case "c":
|
||||
let charAsString = (o as! NSString).substring(to: 1)
|
||||
guard let data = charAsString.data(using: stringEncoding) else {
|
||||
assertionFailure("cannot decode character \(charAsString) using encoding \(stringEncoding)")
|
||||
return Data()
|
||||
}
|
||||
bytes = data.bytes
|
||||
case "b":
|
||||
bytes = Int8(truncatingIfNeeded:o as! Int).data.bytes
|
||||
case "h":
|
||||
bytes = Int16(truncatingIfNeeded:o as! Int).data.bytes
|
||||
case "i", "l":
|
||||
bytes = Int32(truncatingIfNeeded:o as! Int).data.bytes
|
||||
case "q", "Q":
|
||||
bytes = Int64(o as! Int).data.bytes
|
||||
case "B":
|
||||
bytes = UInt8(truncatingIfNeeded:o as! Int).data.bytes
|
||||
case "H":
|
||||
bytes = UInt16(truncatingIfNeeded:o as! Int).data.bytes
|
||||
case "I", "L":
|
||||
bytes = UInt32(truncatingIfNeeded:o as! Int).data.bytes
|
||||
case "f":
|
||||
bytes = Float32(o as! Double).data.bytes
|
||||
case "d":
|
||||
bytes = Float64(o as! Double).data.bytes
|
||||
case "x":
|
||||
bytes = [0x00]
|
||||
default:
|
||||
assertionFailure("Unsupported packing format: \(c)")
|
||||
}
|
||||
|
||||
if isBigEndian { bytes = bytes.reversed() }
|
||||
let data = Data(bytes)
|
||||
mutableData.append(data)
|
||||
}
|
||||
|
||||
n = 0
|
||||
}
|
||||
|
||||
return mutableData
|
||||
}
|
||||
|
||||
public func unpack(_ format:String, _ data:Data, _ stringEncoding:String.Encoding=String.Encoding.windowsCP1252) throws -> [Unpackable] {
|
||||
|
||||
assert(CFByteOrderGetCurrent() == 1 /* CFByteOrderLittleEndian */, "\(#file) assumes little endian, but host is big endian")
|
||||
|
||||
let isBigEndian = isBigEndianFromMandatoryByteOrderFirstCharacter(format)
|
||||
|
||||
if formatDoesMatchDataLength(format, data: data) == false {
|
||||
throw BinUtilsError.formatDoesMatchDataLength(format:format, dataSize:data.count)
|
||||
}
|
||||
|
||||
var a : [Unpackable] = []
|
||||
|
||||
var loc = 0
|
||||
|
||||
let bytes = data.bytes
|
||||
|
||||
var n = 0 // repeat counter
|
||||
|
||||
var mutableFormat = format
|
||||
|
||||
mutableFormat.remove(at: mutableFormat.startIndex) // consume byte-order specifier
|
||||
|
||||
while !mutableFormat.isEmpty {
|
||||
|
||||
let c = mutableFormat.remove(at: mutableFormat.startIndex)
|
||||
|
||||
if let i = Int(String(c)) , 0...9 ~= i {
|
||||
if n > 0 { n *= 10 }
|
||||
n += i
|
||||
continue
|
||||
}
|
||||
|
||||
if c == "s" {
|
||||
let length = max(n,1)
|
||||
let sub = Array(bytes[loc..<loc+length])
|
||||
|
||||
guard let s = NSString(bytes: sub, length: length, encoding: stringEncoding.rawValue) else {
|
||||
assertionFailure("-- not a string: \(sub)")
|
||||
return []
|
||||
}
|
||||
|
||||
a.append(s)
|
||||
|
||||
loc += length
|
||||
|
||||
n = 0
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
for _ in 0..<max(n,1) {
|
||||
|
||||
var o : Unpackable?
|
||||
|
||||
switch(c) {
|
||||
|
||||
case "c":
|
||||
let optionalString = NSString(bytes: [bytes[loc]], length: 1, encoding: String.Encoding.utf8.rawValue)
|
||||
loc += 1
|
||||
guard let s = optionalString else { assertionFailure(); return [] }
|
||||
o = s
|
||||
case "b":
|
||||
let r = readIntegerType(Int8.self, bytes:bytes, loc:&loc)
|
||||
o = Int(r)
|
||||
case "B":
|
||||
let r = readIntegerType(UInt8.self, bytes:bytes, loc:&loc)
|
||||
o = Int(r)
|
||||
case "?":
|
||||
let r = readIntegerType(Bool.self, bytes:bytes, loc:&loc)
|
||||
o = r ? true : false
|
||||
case "h":
|
||||
let r = readIntegerType(Int16.self, bytes:bytes, loc:&loc)
|
||||
o = Int(isBigEndian ? Int16(bigEndian: r) : r)
|
||||
case "H":
|
||||
let r = readIntegerType(UInt16.self, bytes:bytes, loc:&loc)
|
||||
o = Int(isBigEndian ? UInt16(bigEndian: r) : r)
|
||||
case "i":
|
||||
fallthrough
|
||||
case "l":
|
||||
let r = readIntegerType(Int32.self, bytes:bytes, loc:&loc)
|
||||
o = Int(isBigEndian ? Int32(bigEndian: r) : r)
|
||||
case "I":
|
||||
fallthrough
|
||||
case "L":
|
||||
let r = readIntegerType(UInt32.self, bytes:bytes, loc:&loc)
|
||||
o = Int(isBigEndian ? UInt32(bigEndian: r) : r)
|
||||
case "q":
|
||||
let r = readIntegerType(Int64.self, bytes:bytes, loc:&loc)
|
||||
o = Int(isBigEndian ? Int64(bigEndian: r) : r)
|
||||
case "Q":
|
||||
let r = readIntegerType(UInt64.self, bytes:bytes, loc:&loc)
|
||||
o = Int(isBigEndian ? UInt64(bigEndian: r) : r)
|
||||
case "f":
|
||||
let r = readFloatingPointType(Float32.self, bytes:bytes, loc:&loc, isBigEndian:isBigEndian)
|
||||
o = Double(r)
|
||||
case "d":
|
||||
let r = readFloatingPointType(Float64.self, bytes:bytes, loc:&loc, isBigEndian:isBigEndian)
|
||||
o = Double(r)
|
||||
case "x":
|
||||
loc += 1
|
||||
case " ":
|
||||
()
|
||||
default:
|
||||
throw BinUtilsError.unsupportedFormat(character:c)
|
||||
}
|
||||
|
||||
if let o = o { a.append(o) }
|
||||
}
|
||||
|
||||
n = 0
|
||||
}
|
||||
|
||||
return a
|
||||
}
|
||||
46
apps/ios/cleverrc/Info.plist
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Clever RC</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
10
apps/ios/cleverrc/README.md
Normal file
@@ -0,0 +1,10 @@
|
||||
iOS-приложение для управления Клевером
|
||||
--------------------------------------
|
||||
|
||||
Для установки зависимостей необходим [CocoaPods](https://cocoapods.org):
|
||||
|
||||
```bash
|
||||
pod install
|
||||
```
|
||||
|
||||
Для разработки и сборки откройте в XCode файл `cleverrc.xcworkspace`.
|
||||
70
apps/ios/cleverrc/ViewController.swift
Normal file
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// ViewController.swift
|
||||
// cleverrc
|
||||
//
|
||||
// Created by Oleg Kalachev on 20.01.2018.
|
||||
// Copyright © 2018 Copter Express. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import WebKit
|
||||
import SwiftSocket
|
||||
import NotificationBannerSwift
|
||||
|
||||
class ViewController: UIViewController, WKScriptMessageHandler {
|
||||
@IBOutlet weak var webView: WKWebView!
|
||||
let impactGenerator = UIImpactFeedbackGenerator(style: .medium)
|
||||
let notificationGenerator = UINotificationFeedbackGenerator()
|
||||
let udpSocket = UDPClient(address:"255.255.255.255", port: 35602)
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// Don't lock screen
|
||||
UIApplication.shared.isIdleTimerDisabled = true
|
||||
|
||||
// Setup webview event handlers
|
||||
webView.configuration.userContentController.add(self, name: "control")
|
||||
webView.configuration.userContentController.add(self, name: "controlStart")
|
||||
webView.configuration.userContentController.add(self, name: "lowBattery")
|
||||
webView.configuration.userContentController.add(self, name: "notification")
|
||||
|
||||
// Load the main page
|
||||
let url = Bundle.main.url(forResource: "index", withExtension: "html")
|
||||
let requestObj = URLRequest(url: url!)
|
||||
webView.load(requestObj)
|
||||
|
||||
// Setup UDP broadcasting
|
||||
udpSocket.enableBroadcast()
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
super.didReceiveMemoryWarning()
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
|
||||
if (message.name == "control") {
|
||||
// Send UDP control message
|
||||
let m = message.body as! NSDictionary;
|
||||
let d = pack("<hhhh", [m["x"]!, m["y"]!, m["z"]!, m["r"]!])
|
||||
_ = udpSocket.send(data: d)
|
||||
} else if (message.name == "lowBattery") {
|
||||
// Got low battery notification
|
||||
print("Low battery notification")
|
||||
notificationGenerator.notificationOccurred(.warning)
|
||||
} else if (message.name == "notification") {
|
||||
// Got notification message
|
||||
print(message)
|
||||
let m = message.body as! NSDictionary;
|
||||
let level = m["level"] as! Int
|
||||
if level == 4 {
|
||||
let banner = NotificationBanner(title: m["msg"] as! String, style: .warning)
|
||||
banner.show()
|
||||
} else {
|
||||
let banner = NotificationBanner(title: m["msg"] as! String, style: .danger)
|
||||
banner.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
84
apps/ios/cleverrc/clever.svg
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox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">
|
||||
</g>
|
||||
<g id="XMLID_16_">
|
||||
</g>
|
||||
<g id="XMLID_17_">
|
||||
</g>
|
||||
<g id="XMLID_18_">
|
||||
</g>
|
||||
<g id="XMLID_19_">
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.4 KiB |
23
apps/ios/cleverrc/index.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui">
|
||||
<link rel="stylesheet" href="main.css">
|
||||
<script src="roslib.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="telemetry"><span class="mode">DISCONNECTED</span></div>
|
||||
<div class="battery"></div>
|
||||
<div class="logo"></div>
|
||||
<div class="container">
|
||||
<div class="stick stick-left">
|
||||
<div class="stick-pointer"></div>
|
||||
</div>
|
||||
<div class="stick stick-right">
|
||||
<div class="stick-pointer"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="main.js" type="text/javascript"></script>
|
||||
<script src="telemetry.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
91
apps/ios/cleverrc/main.css
Normal file
@@ -0,0 +1,91 @@
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
user-select: none;
|
||||
font-family: sans-serif;
|
||||
background: #212121;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.stick {
|
||||
border-radius: 50%;
|
||||
width: 5cm;
|
||||
height: 5cm;
|
||||
position: relative;
|
||||
transform: translateZ(0);
|
||||
border: 4px solid rgba(255,255,255,.4);
|
||||
box-shadow: 0 0 0 1px rgba(0,0,0,.2), inset 0 0 0 1px rgba(0,0,0,.2);
|
||||
}
|
||||
|
||||
.stick-pointer {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
background-color: rgba(255,255,255,.25);
|
||||
box-shadow: 0 0 10px rgba(0,0,0,.3);
|
||||
width: 3cm;
|
||||
height: 3cm;
|
||||
margin-left: -1.5cm;
|
||||
margin-top: -1.5cm;
|
||||
top: 2.5cm;
|
||||
left: 2.5cm;
|
||||
pointer-events: none;
|
||||
transform: translateZ(0);
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.telemetry {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
top: 30px;
|
||||
font-size: 20px;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
body.armed .telemetry .mode {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@keyframes scale {
|
||||
0% { transform: scale(1.0); }
|
||||
50% { transform: scale(1.2); }
|
||||
100% { transform: scale(1.0); }
|
||||
}
|
||||
|
||||
.battery {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
bottom: 30px;
|
||||
font-size: 20px;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
body.low-battery .battery {
|
||||
color: #ff554b;
|
||||
animation: scale 0.3s 1 ease-in-out}
|
||||
|
||||
.logo {
|
||||
position: absolute;
|
||||
background: url(clever.svg);
|
||||
-webkit-background-size: 50px;
|
||||
background-size: 50px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-top: -25px;
|
||||
margin-left: -25px;
|
||||
font-size: 20px;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
126
apps/ios/cleverrc/main.js
Normal file
@@ -0,0 +1,126 @@
|
||||
function throttle(func, ms) {
|
||||
var isThrottled = false,
|
||||
savedArgs,
|
||||
savedThis;
|
||||
|
||||
function wrapper() {
|
||||
if (isThrottled) {
|
||||
savedArgs = arguments;
|
||||
savedThis = this;
|
||||
return;
|
||||
}
|
||||
func.apply(this, arguments);
|
||||
isThrottled = true;
|
||||
setTimeout(function() {
|
||||
isThrottled = false;
|
||||
if (savedArgs) {
|
||||
wrapper.apply(savedThis, savedArgs);
|
||||
savedArgs = savedThis = null;
|
||||
}
|
||||
}, ms);
|
||||
}
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
function callNativeApp(name, msg) {
|
||||
try {
|
||||
webkit.messageHandlers[name].postMessage(msg);
|
||||
return true;
|
||||
} catch(err) {
|
||||
console.warn('The native context does not exist yet');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var rcLastPublish = null;
|
||||
|
||||
function rcPublish() {
|
||||
callNativeApp('control', controlMessage);
|
||||
rcLastPublish = new Date();
|
||||
}
|
||||
|
||||
rcPublishThrottled = throttle(rcPublish, 30);
|
||||
|
||||
setInterval(function() {
|
||||
if (rcLastPublish !== null && new Date() - rcLastPublish > 800) {
|
||||
rcPublishThrottled();
|
||||
}
|
||||
}, 50);
|
||||
|
||||
var body = document.querySelector('body');
|
||||
var stickLeft = document.querySelector('.stick-left');
|
||||
var stickRight = document.querySelector('.stick-right');
|
||||
|
||||
var controlMessage = { x: 0, y: 0, z: 0, r: 0 };
|
||||
|
||||
function onStickTouchMove(touch) {
|
||||
var target = touch.target;
|
||||
var targetRect = target.getBoundingClientRect();
|
||||
var stickPointer = target.querySelector('.stick-pointer');
|
||||
|
||||
var offsetX = touch.clientX - targetRect.left;
|
||||
var offsetY = touch.clientY - targetRect.top;
|
||||
|
||||
var x = 2 * offsetX / targetRect.width;
|
||||
var y = 2 * offsetY / targetRect.height;
|
||||
|
||||
x = Math.max(0, x);
|
||||
x = Math.min(2, x);
|
||||
y = Math.max(0, y);
|
||||
y = Math.min(2, y);
|
||||
|
||||
stickPointer.style.left = (x * 50) + '%';
|
||||
stickPointer.style.top = (y * 50) + '%';
|
||||
|
||||
x -= 1;
|
||||
y = 1 - y;
|
||||
|
||||
if (target.matches('.stick-left')) {
|
||||
controlMessage.z = Math.round((y + 1) * 500);
|
||||
controlMessage.r = Math.round(x * 1000);
|
||||
} else if (target.matches('.stick-right')) {
|
||||
controlMessage.x = Math.round(y * 1000);
|
||||
controlMessage.y = Math.round(x * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
body.addEventListener('touchmove', function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
function stickTouchStart(e) {
|
||||
setControlMode();
|
||||
callNativeApp('controlStart');
|
||||
onStickTouchMove(e.changedTouches[0]);
|
||||
rcPublishThrottled();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
function stickTouchMove(e) {
|
||||
onStickTouchMove(e.changedTouches[0]);
|
||||
rcPublishThrottled();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
function stickTouchEnd(e) {
|
||||
var pointer = e.target.querySelector('.stick-pointer');
|
||||
if (e.target.matches('.stick-left')) {
|
||||
controlMessage.r = 0;
|
||||
pointer.style.left = '50%';
|
||||
} else if (e.target.matches('.stick-right')) {
|
||||
controlMessage.x = 0;
|
||||
controlMessage.y = 0;
|
||||
pointer.style.left = '50%';
|
||||
pointer.style.top = '50%';
|
||||
}
|
||||
rcPublishThrottled();
|
||||
}
|
||||
|
||||
stickLeft.addEventListener('touchmove', stickTouchMove);
|
||||
stickRight.addEventListener('touchmove', stickTouchMove);
|
||||
stickLeft.addEventListener('touchstart', stickTouchStart);
|
||||
stickRight.addEventListener('touchstart', stickTouchStart);
|
||||
stickLeft.addEventListener('touchend', stickTouchEnd);
|
||||
stickRight.addEventListener('touchend', stickTouchEnd);
|
||||
3693
apps/ios/cleverrc/roslib.js
vendored
Normal file
85
apps/ios/cleverrc/telemetry.js
Normal file
@@ -0,0 +1,85 @@
|
||||
var url = 'ws://192.168.11.1:9090';
|
||||
var modeEl = document.querySelector('.telemetry .mode');
|
||||
var batteryEl = document.querySelector('.battery');
|
||||
|
||||
var ros = new ROSLIB.Ros({ url: url });
|
||||
|
||||
ros.on('connection', function () {
|
||||
body.classList.add('connected');
|
||||
});
|
||||
|
||||
ros.on('close', function () {
|
||||
body.classList.remove('connected');
|
||||
modeEl.classList.remove('armed');
|
||||
modeEl.innerHTML = 'DISCONNECTED';
|
||||
batteryEl.innerHTML = '';
|
||||
setTimeout(function() {
|
||||
modeEl.innerHTML = 'RECONNECTING';
|
||||
ros.connect(url);
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
var fcuState;
|
||||
|
||||
new ROSLIB.Topic({
|
||||
ros: ros,
|
||||
name: '/state_latched',
|
||||
messageType: 'mavros_msgs/State'
|
||||
}).subscribe(function(message) {
|
||||
body.classList.toggle('fcu-disconnected', !message.connected);
|
||||
body.classList.toggle('armed', message.armed);
|
||||
fcuState = message;
|
||||
modeEl.classList.toggle('armed', fcuState.armed);
|
||||
modeEl.innerHTML = message.connected ? fcuState.mode : 'DISCONNECTED FROM FCU';
|
||||
console.log('state', message);
|
||||
});
|
||||
|
||||
function notifyLowBattery() {
|
||||
callNativeApp('lowBattery');
|
||||
}
|
||||
|
||||
notifyLowBatteryThrottled = throttle(notifyLowBattery, 10000);
|
||||
|
||||
new ROSLIB.Topic({
|
||||
ros: ros,
|
||||
name: '/mavros/battery',
|
||||
messageType: 'sensor_msgs/BatteryState',
|
||||
throttle_rate: 5000
|
||||
}).subscribe(function(message) {
|
||||
var LOW_BATTERY = 3.8;
|
||||
batteryEl.innerHTML = (message.cell_voltage[0].toFixed(2) + ' V') || '';
|
||||
|
||||
if (message.cell_voltage[0] < LOW_BATTERY) {
|
||||
console.log('low battery');
|
||||
callNativeApp('lowBattery');
|
||||
body.classList.remove('low-battery');
|
||||
void body.offsetWidth; // trick for repeating animation
|
||||
body.classList.add('low-battery');
|
||||
} else {
|
||||
body.classList.remove('low-battery');
|
||||
}
|
||||
});
|
||||
|
||||
new ROSLIB.Topic({
|
||||
ros: ros,
|
||||
name: '/rosout_agg',
|
||||
messageType: 'rosgraph_msgs/Log'
|
||||
}).subscribe(function(message) {
|
||||
if(message.level >= 4) {
|
||||
if (message.msg.startsWith('CMD: ')) {
|
||||
return;
|
||||
}
|
||||
callNativeApp('notification', message);
|
||||
}
|
||||
});
|
||||
|
||||
var setMode = new ROSLIB.Service({
|
||||
ros: ros,
|
||||
name : '/mavros/set_mode',
|
||||
serviceType : 'mavros_msgs/SetMode'
|
||||
});
|
||||
|
||||
function setControlMode() {
|
||||
var CONTROL_MODE = 'STABILIZED';
|
||||
setMode.callService(new ROSLIB.ServiceRequest({ custom_mode: CONTROL_MODE }));
|
||||
}
|
||||
210
aruco_pose/CMakeLists.txt
Normal file
@@ -0,0 +1,210 @@
|
||||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(aruco_pose)
|
||||
|
||||
add_definitions(-std=c++11 -Wall -g)
|
||||
|
||||
## Compile as C++11, supported in ROS Kinetic and newer
|
||||
add_compile_options(-std=c++11)
|
||||
|
||||
## Find catkin macros and libraries
|
||||
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
|
||||
## is used, also find other catkin packages
|
||||
find_package(catkin REQUIRED COMPONENTS
|
||||
nodelet
|
||||
pluginlib
|
||||
roscpp
|
||||
image_transport
|
||||
cv_bridge
|
||||
tf
|
||||
#tf2
|
||||
#tf2_ros
|
||||
#aruco_msgs
|
||||
)
|
||||
|
||||
## System dependencies are found with CMake's conventions
|
||||
# find_package(Boost REQUIRED COMPONENTS system)
|
||||
|
||||
|
||||
## Uncomment this if the package has a setup.py. This macro ensures
|
||||
## modules and global scripts declared therein get installed
|
||||
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
|
||||
# catkin_python_setup()
|
||||
|
||||
################################################
|
||||
## Declare ROS messages, services and actions ##
|
||||
################################################
|
||||
|
||||
## To declare and build messages, services or actions from within this
|
||||
## package, follow these steps:
|
||||
## * Let MSG_DEP_SET be the set of packages whose message types you use in
|
||||
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
|
||||
## * In the file package.xml:
|
||||
## * add a build_depend tag for "message_generation"
|
||||
## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
|
||||
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
|
||||
## but can be declared for certainty nonetheless:
|
||||
## * add a run_depend tag for "message_runtime"
|
||||
## * In this file (CMakeLists.txt):
|
||||
## * add "message_generation" and every package in MSG_DEP_SET to
|
||||
## find_package(catkin REQUIRED COMPONENTS ...)
|
||||
## * add "message_runtime" and every package in MSG_DEP_SET to
|
||||
## catkin_package(CATKIN_DEPENDS ...)
|
||||
## * uncomment the add_*_files sections below as needed
|
||||
## and list every .msg/.srv/.action file to be processed
|
||||
## * uncomment the generate_messages entry below
|
||||
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
|
||||
|
||||
## Generate messages in the 'msg' folder
|
||||
#add_message_files(
|
||||
# FILES
|
||||
# Marker.msg
|
||||
# MarkerArray.msg
|
||||
#)
|
||||
|
||||
## Generate services in the 'srv' folder
|
||||
# add_service_files(
|
||||
# FILES
|
||||
# Service1.srv
|
||||
# Service2.srv
|
||||
# )
|
||||
|
||||
## Generate actions in the 'action' folder
|
||||
# add_action_files(
|
||||
# FILES
|
||||
# Action1.action
|
||||
# Action2.action
|
||||
# )
|
||||
|
||||
## Generate added messages and services with any dependencies listed here
|
||||
#generate_messages(
|
||||
# DEPENDENCIES
|
||||
# std_msgs # Or other packages containing msgs
|
||||
#)
|
||||
|
||||
################################################
|
||||
## Declare ROS dynamic reconfigure parameters ##
|
||||
################################################
|
||||
|
||||
## To declare and build dynamic reconfigure parameters within this
|
||||
## package, follow these steps:
|
||||
## * In the file package.xml:
|
||||
## * add a build_depend and a run_depend tag for "dynamic_reconfigure"
|
||||
## * In this file (CMakeLists.txt):
|
||||
## * add "dynamic_reconfigure" to
|
||||
## find_package(catkin REQUIRED COMPONENTS ...)
|
||||
## * uncomment the "generate_dynamic_reconfigure_options" section below
|
||||
## and list every .cfg file to be processed
|
||||
|
||||
## Generate dynamic reconfigure parameters in the 'cfg' folder
|
||||
# generate_dynamic_reconfigure_options(
|
||||
# cfg/DynReconf1.cfg
|
||||
# cfg/DynReconf2.cfg
|
||||
# )
|
||||
|
||||
###################################
|
||||
## catkin specific configuration ##
|
||||
###################################
|
||||
## The catkin_package macro generates cmake config files for your package
|
||||
## Declare things to be passed to dependent projects
|
||||
## INCLUDE_DIRS: uncomment this if you package contains header files
|
||||
## LIBRARIES: libraries you create in this project that dependent projects also need
|
||||
## CATKIN_DEPENDS: catkin_packages dependent projects also need
|
||||
## DEPENDS: system dependencies of this project that dependent projects also need
|
||||
catkin_package(
|
||||
# INCLUDE_DIRS include
|
||||
LIBRARIES aruco_pose
|
||||
# CATKIN_DEPENDS other_catkin_pkg
|
||||
# DEPENDS system_lib
|
||||
)
|
||||
|
||||
###########
|
||||
## Build ##
|
||||
###########
|
||||
|
||||
## Specify additional locations of header files
|
||||
## Your package locations should be listed before other locations
|
||||
include_directories(
|
||||
# include
|
||||
${catkin_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
## Declare a C++ library
|
||||
add_library(${PROJECT_NAME}
|
||||
src/aruco_pose.cpp
|
||||
)
|
||||
|
||||
## Add cmake target dependencies of the library
|
||||
## as an example, code may need to be generated before libraries
|
||||
## either from message generation or dynamic reconfigure
|
||||
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
|
||||
|
||||
## Declare a C++ executable
|
||||
## With catkin_make all packages are built within a single CMake context
|
||||
## The recommended prefix ensures that target names across packages don't collide
|
||||
# add_executable(${PROJECT_NAME}_node src/aruco_pose_node.cpp)
|
||||
|
||||
## Rename C++ executable without prefix
|
||||
## The above recommended prefix causes long target names, the following renames the
|
||||
## target back to the shorter version for ease of user use
|
||||
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
|
||||
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
|
||||
|
||||
## Add cmake target dependencies of the executable
|
||||
## same as for the library above
|
||||
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
|
||||
|
||||
## Specify libraries to link a library or executable target against
|
||||
link_directories(/opt/ros/kinetic/lib)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
${catkin_LIBRARIES}
|
||||
"/opt/ros/kinetic/lib/libopencv_aruco3.so" # TODO: fix launch fails with .so loading
|
||||
)
|
||||
|
||||
#############
|
||||
## Install ##
|
||||
#############
|
||||
|
||||
# all install targets should use catkin DESTINATION variables
|
||||
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
|
||||
|
||||
## Mark executable scripts (Python etc.) for installation
|
||||
## in contrast to setup.py, you can choose the destination
|
||||
# install(PROGRAMS
|
||||
# scripts/my_python_script
|
||||
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
# )
|
||||
|
||||
## Mark executables and/or libraries for installation
|
||||
# install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
|
||||
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
# )
|
||||
|
||||
## Mark cpp header files for installation
|
||||
# install(DIRECTORY include/${PROJECT_NAME}/
|
||||
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
|
||||
# FILES_MATCHING PATTERN "*.h"
|
||||
# PATTERN ".svn" EXCLUDE
|
||||
# )
|
||||
|
||||
## Mark other files for installation (e.g. launch and bag files, etc.)
|
||||
# install(FILES
|
||||
# # myfile1
|
||||
# # myfile2
|
||||
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
|
||||
# )
|
||||
|
||||
#############
|
||||
## Testing ##
|
||||
#############
|
||||
|
||||
## Add gtest based cpp test target and link libraries
|
||||
# catkin_add_gtest(${PROJECT_NAME}-test test/test_aruco_pose.cpp)
|
||||
# if(TARGET ${PROJECT_NAME}-test)
|
||||
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
|
||||
# endif()
|
||||
|
||||
## Add folders to be run by python nosetests
|
||||
# catkin_add_nosetests(test)
|
||||
5
aruco_pose/nodelet_plugins.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<library path="lib/libaruco_pose">
|
||||
<class name="aruco_pose/aruco_pose" type="ArucoPose" base_class_type="nodelet::Nodelet">
|
||||
<description/>
|
||||
</class>
|
||||
</library>
|
||||
62
aruco_pose/package.xml
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<name>aruco_pose</name>
|
||||
<version>0.0.0</version>
|
||||
<description>ArUco maps precise pose estimation nodelet</description>
|
||||
|
||||
<!-- One maintainer tag required, multiple allowed, one person per tag -->
|
||||
<!-- Example: -->
|
||||
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
|
||||
<maintainer email="okalachev@gmail.com">Oleg Kalachev</maintainer>
|
||||
|
||||
|
||||
<!-- One license tag required, multiple allowed, one license per tag -->
|
||||
<!-- Commonly used license strings: -->
|
||||
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
|
||||
<license>TODO</license>
|
||||
|
||||
|
||||
<!-- Url tags are optional, but multiple are allowed, one per tag -->
|
||||
<!-- Optional attribute type can be: website, bugtracker, or repository -->
|
||||
<!-- Example: -->
|
||||
<!-- <url type="website">http://wiki.ros.org/aruco_pose</url> -->
|
||||
|
||||
|
||||
<!-- Author tags are optional, multiple are allowed, one per tag -->
|
||||
<!-- Authors do not have to be maintainers, but could be -->
|
||||
<!-- Example: -->
|
||||
<!-- <author email="jane.doe@example.com">Jane Doe</author> -->
|
||||
|
||||
|
||||
<!-- The *_depend tags are used to specify dependencies -->
|
||||
<!-- Dependencies can be catkin packages or system dependencies -->
|
||||
<!-- Examples: -->
|
||||
<!-- Use build_depend for packages you need at compile time: -->
|
||||
<!-- <build_depend>message_generation</build_depend> -->
|
||||
<!-- Use buildtool_depend for build tool packages: -->
|
||||
<!-- <buildtool_depend>catkin</buildtool_depend> -->
|
||||
<!-- Use run_depend for packages you need at runtime: -->
|
||||
<!-- <run_depend>message_runtime</run_depend> -->
|
||||
<!-- Use test_depend for packages you need only for testing: -->
|
||||
<!-- <test_depend>gtest</test_depend> -->
|
||||
<buildtool_depend>catkin</buildtool_depend>
|
||||
|
||||
<build_depend>nodelet</build_depend>
|
||||
<build_depend>roscpp</build_depend>
|
||||
<build_depend>image_transport</build_depend>
|
||||
<build_depend>cv_bridge</build_depend>
|
||||
<build_depend>tf</build_depend>
|
||||
|
||||
<run_depend>nodelet</run_depend>
|
||||
<run_depend>roscpp</run_depend>
|
||||
<run_depend>image_transport</run_depend>
|
||||
<run_depend>cv_bridge</run_depend>
|
||||
<build_depend>tf</build_depend>
|
||||
|
||||
<!-- The export tag contains other, unspecified, tags -->
|
||||
<export>
|
||||
<nodelet plugin="${prefix}/nodelet_plugins.xml" />
|
||||
<!-- Other tools can request additional information be placed here -->
|
||||
|
||||
</export>
|
||||
</package>
|
||||
292
aruco_pose/src/aruco_pose.cpp
Normal file
@@ -0,0 +1,292 @@
|
||||
#include <algorithm>
|
||||
#include <nodelet/nodelet.h>
|
||||
#include <image_transport/image_transport.h>
|
||||
#include <cv_bridge/cv_bridge.h>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
#include <pluginlib/class_list_macros.h>
|
||||
#include <geometry_msgs/TransformStamped.h>
|
||||
#include <geometry_msgs/PoseStamped.h>
|
||||
#include <geometry_msgs/PoseWithCovarianceStamped.h>
|
||||
#include <visualization_msgs/MarkerArray.h>
|
||||
#include <tf/transform_datatypes.h>
|
||||
#include <opencv2/calib3d/calib3d.hpp>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <opencv2/aruco.hpp>
|
||||
#include <opencv2/aruco/dictionary.hpp>
|
||||
#include <stdio.h>
|
||||
#include <tf/transform_broadcaster.h>
|
||||
|
||||
namespace aruco_pose {
|
||||
|
||||
class ArucoPose : public nodelet::Nodelet {
|
||||
tf::TransformBroadcaster br;
|
||||
cv::Ptr<cv::aruco::Dictionary> dictionary;
|
||||
cv::Ptr<cv::aruco::DetectorParameters> parameters;
|
||||
cv::Ptr<cv::aruco::Board> board;
|
||||
std::string frame_id_;
|
||||
image_transport::CameraSubscriber img_sub;
|
||||
image_transport::Publisher img_pub;
|
||||
ros::Publisher marker_pub;
|
||||
ros::Publisher pose_pub;
|
||||
ros::NodeHandle nh_, nh_priv_;
|
||||
|
||||
virtual void onInit();
|
||||
void createBoard();
|
||||
cv::Point3f getObjPointsCenter(cv::Mat objPoints);
|
||||
void detect(const sensor_msgs::ImageConstPtr&, const sensor_msgs::CameraInfoConstPtr&);
|
||||
void parseCameraInfo(const sensor_msgs::CameraInfoConstPtr&, cv::Mat&, cv::Mat&);
|
||||
tf::Transform aruco2tf(cv::Mat rvec, cv::Mat tvec);
|
||||
};
|
||||
|
||||
void ArucoPose::onInit() {
|
||||
ROS_INFO("Initializing aruco_pose");
|
||||
nh_ = getNodeHandle();
|
||||
nh_priv_ = getPrivateNodeHandle();
|
||||
|
||||
nh_priv_.param("frame_id", frame_id_, std::string("aruco_map"));
|
||||
|
||||
dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_4X4_1000);
|
||||
parameters = cv::aruco::DetectorParameters::create();
|
||||
|
||||
try
|
||||
{
|
||||
createBoard();
|
||||
}
|
||||
catch (const std::exception &exc)
|
||||
{
|
||||
std::cerr << exc.what();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
image_transport::ImageTransport it(nh_);
|
||||
img_sub = it.subscribeCamera("image", 1, &ArucoPose::detect, this);
|
||||
|
||||
image_transport::ImageTransport it_priv(nh_priv_);
|
||||
img_pub = it_priv.advertise("debug", 1);
|
||||
|
||||
pose_pub = nh_priv_.advertise<geometry_msgs::PoseStamped>("pose", 1);
|
||||
|
||||
ROS_INFO("aruco_pose nodelet inited");
|
||||
}
|
||||
|
||||
cv::Ptr<cv::aruco::Board> createCustomGridBoard(int markersX, int markersY, float markerLength, float markerSeparationX, float markerSeparationY,
|
||||
const cv::Ptr<cv::aruco::Dictionary> &dictionary, std::vector<int> ids) {
|
||||
|
||||
CV_Assert(markersX > 0 && markersY > 0 && markerLength > 0 && markerSeparationX > 0 && markerSeparationY > 0);
|
||||
|
||||
cv::Ptr<cv::aruco::Board> res = cv::makePtr<cv::aruco::Board>();
|
||||
|
||||
res->dictionary = dictionary;
|
||||
|
||||
size_t totalMarkers = (size_t) markersX * markersY;
|
||||
res->ids = ids;
|
||||
res->objPoints.reserve(totalMarkers);
|
||||
|
||||
// calculate Board objPoints
|
||||
float maxY = (float)markersY * markerLength + (markersY - 1) * markerSeparationY;
|
||||
for(int y = 0; y < markersY; y++) {
|
||||
for(int x = 0; x < markersX; x++) {
|
||||
std::vector< cv::Point3f > corners;
|
||||
corners.resize(4);
|
||||
corners[0] = cv::Point3f(x * (markerLength + markerSeparationX),
|
||||
maxY - y * (markerLength + markerSeparationY), 0);
|
||||
corners[1] = corners[0] + cv::Point3f(markerLength, 0, 0);
|
||||
corners[2] = corners[0] + cv::Point3f(markerLength, -markerLength, 0);
|
||||
corners[3] = corners[0] + cv::Point3f(0, -markerLength, 0);
|
||||
res->objPoints.push_back(corners);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#include "fix.cpp"
|
||||
|
||||
void ArucoPose::createBoard()
|
||||
{
|
||||
static auto map_image_pub = nh_priv_.advertise<sensor_msgs::Image>("map_image", 1, true);
|
||||
cv_bridge::CvImage map_image_msg;
|
||||
cv::Mat map_image;
|
||||
|
||||
std::string type;
|
||||
|
||||
nh_priv_.param<std::string>("type", type, "gridboard");
|
||||
if (type == "gridboard")
|
||||
{
|
||||
ROS_INFO("Initialize gridboard");
|
||||
|
||||
int markers_x, markers_y, first_marker;
|
||||
float markers_side, markers_sep_x, markers_sep_y;
|
||||
std::vector<int> marker_ids;
|
||||
nh_priv_.param<int>("markers_x", markers_x, 10);
|
||||
nh_priv_.param<int>("markers_y", markers_y, 10);
|
||||
nh_priv_.param<int>("first_marker", first_marker, 0);
|
||||
|
||||
if (!nh_priv_.getParam("markers_side", markers_side))
|
||||
{
|
||||
ROS_ERROR("gridboard: required parameter ~markers_side is not set.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!nh_priv_.getParam("markers_sep_x", markers_sep_x))
|
||||
{
|
||||
if (!nh_priv_.getParam("markers_sep", markers_sep_x))
|
||||
{
|
||||
ROS_ERROR("gridboard: ~markers_sep_x or ~markers_sep parameters are required");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!nh_priv_.getParam("markers_sep_y", markers_sep_y))
|
||||
{
|
||||
if (!nh_priv_.getParam("markers_sep", markers_sep_y))
|
||||
{
|
||||
ROS_ERROR("gridboard: ~markers_sep_y or ~markers_sep parameters are required");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (nh_priv_.getParam("marker_ids", marker_ids))
|
||||
{
|
||||
if (markers_x * markers_y != marker_ids.size())
|
||||
{
|
||||
ROS_FATAL("~marker_ids length should be equal to ~markers_x * ~markers_y");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fill marker_ids automatically
|
||||
marker_ids.resize(markers_x * markers_y);
|
||||
for(int i = 0; i < markers_x * markers_y; i++)
|
||||
{
|
||||
marker_ids.at(i) = first_marker++;
|
||||
}
|
||||
}
|
||||
|
||||
// Create grid board
|
||||
board = createCustomGridBoard(markers_x, markers_y, markers_side, markers_sep_x, markers_sep_y, dictionary, marker_ids);
|
||||
|
||||
// Publish map image for debugging
|
||||
_drawPlanarBoard(board, cv::Size(2000, 2000), map_image, 50, 1);
|
||||
|
||||
cv::cvtColor(map_image, map_image, CV_GRAY2BGR);
|
||||
|
||||
map_image_msg.encoding = sensor_msgs::image_encodings::BGR8;
|
||||
map_image_msg.image = map_image;
|
||||
map_image_pub.publish(map_image_msg.toImageMsg());
|
||||
}
|
||||
else if (type == "custom")
|
||||
{
|
||||
// Not implemented yet
|
||||
ROS_FATAL("Custom boards are not implemented yet.");
|
||||
}
|
||||
else
|
||||
{
|
||||
ROS_ERROR("Incorrect map type '%s'", type.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
cv::Point3f ArucoPose::getObjPointsCenter(cv::Mat objPoints) {
|
||||
float min_x = std::numeric_limits<float>::max();
|
||||
float max_x = std::numeric_limits<float>::min();
|
||||
float min_y = min_x, max_y = max_x;
|
||||
for (int i = 0; i < objPoints.rows; i++) {
|
||||
max_x = std::max(max_x, objPoints.at<float>(i, 0));
|
||||
max_y = std::max(max_y, objPoints.at<float>(i, 1));
|
||||
min_x = std::min(min_x, objPoints.at<float>(i, 0));
|
||||
min_y = std::min(min_y, objPoints.at<float>(i, 1));
|
||||
}
|
||||
cv::Point3f res((min_x + max_x) / 2, (min_y + max_y) / 2, 0);
|
||||
return res;
|
||||
}
|
||||
|
||||
void ArucoPose::detect(const sensor_msgs::ImageConstPtr& msg, const sensor_msgs::CameraInfoConstPtr &cinfo) {
|
||||
cv::Mat image = cv_bridge::toCvShare(msg, "bgr8")->image;
|
||||
|
||||
std::vector<int> markerIds;
|
||||
std::vector<std::vector<cv::Point2f>> markerCorners;
|
||||
std::vector<std::vector<cv::Point2f>> rejectedCandidates;
|
||||
|
||||
cv::aruco::detectMarkers(image, dictionary, markerCorners, markerIds, parameters, rejectedCandidates);
|
||||
|
||||
cv::Mat cameraMatrix(3, 3, CV_64F);
|
||||
cv::Mat distCoeffs(8, 1, CV_64F);
|
||||
parseCameraInfo(cinfo, cameraMatrix, distCoeffs);
|
||||
|
||||
if (markerIds.size() > 0) {
|
||||
|
||||
cv::Mat rvec, tvec, objPoints;
|
||||
int valid = _estimatePoseBoard(markerCorners, markerIds, board, cameraMatrix, distCoeffs,
|
||||
rvec, tvec, false, objPoints);
|
||||
|
||||
if (valid) {
|
||||
// Send map transform
|
||||
tf::StampedTransform transform(aruco2tf(rvec, tvec), msg->header.stamp, cinfo->header.frame_id, frame_id_);
|
||||
br.sendTransform(transform);
|
||||
|
||||
// Publish map pose
|
||||
static geometry_msgs::PoseStamped ps;
|
||||
ps.header.frame_id = frame_id_;
|
||||
ps.header.stamp = msg->header.stamp;
|
||||
ps.pose.orientation.w = 1;
|
||||
pose_pub.publish(ps);
|
||||
|
||||
// Send reference point
|
||||
cv::Point3f ref = getObjPointsCenter(objPoints);
|
||||
tf::Vector3 ref_vector3 = tf::Vector3(ref.x, ref.y, ref.z);
|
||||
tf::Quaternion q(0, 0, 0);
|
||||
static tf::StampedTransform ref_transform;
|
||||
ref_transform.stamp_ = msg->header.stamp;
|
||||
ref_transform.frame_id_ = frame_id_;
|
||||
ref_transform.child_frame_id_ = "aruco_map_reference";
|
||||
ref_transform.setOrigin(ref_vector3);
|
||||
ref_transform.setRotation(q);
|
||||
br.sendTransform(ref_transform);
|
||||
|
||||
if(img_pub.getNumSubscribers() > 0)
|
||||
{
|
||||
// Publish debug image
|
||||
cv::aruco::drawDetectedMarkers(image, markerCorners, markerIds);
|
||||
cv::aruco::drawAxis(image, cameraMatrix, distCoeffs, rvec, tvec, 0.3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (img_pub.getNumSubscribers() > 0)
|
||||
{
|
||||
cv_bridge::CvImage out_msg;
|
||||
out_msg.header.frame_id = msg->header.frame_id;
|
||||
out_msg.header.stamp = msg->header.stamp;
|
||||
out_msg.encoding = sensor_msgs::image_encodings::BGR8;
|
||||
out_msg.image = image;
|
||||
img_pub.publish(out_msg.toImageMsg());
|
||||
}
|
||||
}
|
||||
|
||||
void ArucoPose::parseCameraInfo(const sensor_msgs::CameraInfoConstPtr &cinfo, cv::Mat &cameraMat, cv::Mat &distCoeffs) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
cameraMat.at<double>(i, j) = cinfo->K[3 * i + j];
|
||||
}
|
||||
}
|
||||
for (int k = 0; k < cinfo->D.size(); k++) {
|
||||
distCoeffs.at<double>(k) = cinfo->D[k];
|
||||
}
|
||||
}
|
||||
|
||||
tf::Transform ArucoPose::aruco2tf(cv::Mat rvec, cv::Mat tvec) {
|
||||
|
||||
cv::Mat rot;
|
||||
cv::Rodrigues(rvec, rot);
|
||||
|
||||
tf::Matrix3x3 tf_rot(rot.at<double>(0,0), rot.at<double>(0,1), rot.at<double>(0,2),
|
||||
rot.at<double>(1,0), rot.at<double>(1,1), rot.at<double>(1,2),
|
||||
rot.at<double>(2,0), rot.at<double>(2,1), rot.at<double>(2,2));
|
||||
tf::Vector3 tf_orig(tvec.at<double>(0,0), tvec.at<double>(1,0), tvec.at<double>(2,0));
|
||||
return tf::Transform(tf_rot, tf_orig);
|
||||
}
|
||||
|
||||
PLUGINLIB_EXPORT_CLASS(ArucoPose, nodelet::Nodelet)
|
||||
|
||||
}
|
||||
145
aruco_pose/src/fix.cpp
Normal file
@@ -0,0 +1,145 @@
|
||||
using namespace cv;
|
||||
using namespace cv::aruco;
|
||||
|
||||
// Temporal fix!
|
||||
// TODO: remove
|
||||
// fix strange bug in our OpenCV version
|
||||
|
||||
void _getBoardObjectAndImagePoints(const Ptr<aruco::Board> &board, InputArrayOfArrays detectedCorners,
|
||||
InputArray detectedIds, OutputArray objPoints, OutputArray imgPoints) {
|
||||
|
||||
CV_Assert(board->ids.size() == board->objPoints.size());
|
||||
CV_Assert(detectedIds.total() == detectedCorners.total());
|
||||
|
||||
size_t nDetectedMarkers = detectedIds.total();
|
||||
|
||||
std::vector< Point3f > objPnts;
|
||||
objPnts.reserve(nDetectedMarkers);
|
||||
|
||||
std::vector< Point2f > imgPnts;
|
||||
imgPnts.reserve(nDetectedMarkers);
|
||||
|
||||
// look for detected markers that belong to the board and get their information
|
||||
for(unsigned int i = 0; i < nDetectedMarkers; i++) {
|
||||
int currentId = detectedIds.getMat().ptr< int >(0)[i];
|
||||
for(unsigned int j = 0; j < board->ids.size(); j++) {
|
||||
if(currentId == board->ids[j]) {
|
||||
for(int p = 0; p < 4; p++) {
|
||||
objPnts.push_back(board->objPoints[j][p]);
|
||||
imgPnts.push_back(detectedCorners.getMat(i).ptr< Point2f >(0)[p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create output
|
||||
Mat(objPnts).copyTo(objPoints);
|
||||
Mat(imgPnts).copyTo(imgPoints);
|
||||
}
|
||||
|
||||
int _estimatePoseBoard(InputArrayOfArrays _corners, InputArray _ids, const Ptr<aruco::Board> &board,
|
||||
InputArray _cameraMatrix, InputArray _distCoeffs, OutputArray _rvec,
|
||||
OutputArray _tvec, bool useExtrinsicGuess, Mat &objPoints) {
|
||||
|
||||
CV_Assert(_corners.total() == _ids.total());
|
||||
|
||||
// get object and image points for the solvePnP function
|
||||
Mat /*objPoints, */imgPoints;
|
||||
_getBoardObjectAndImagePoints(board, _corners, _ids, objPoints, imgPoints);
|
||||
|
||||
CV_Assert(imgPoints.total() == objPoints.total());
|
||||
|
||||
if(objPoints.total() == 0) // 0 of the detected markers in board
|
||||
return 0;
|
||||
|
||||
// std::cout << "objPoints: " << objPoints << std::endl;
|
||||
// std::cout << "imgPoints: " << imgPoints << std::endl;
|
||||
|
||||
solvePnP(objPoints, imgPoints, _cameraMatrix, _distCoeffs, _rvec, _tvec, useExtrinsicGuess);
|
||||
|
||||
// divide by four since all the four corners are concatenated in the array for each marker
|
||||
return (int)objPoints.total() / 4;
|
||||
}
|
||||
|
||||
void _drawPlanarBoard(Board *_board, Size outSize, OutputArray _img, int marginSize,
|
||||
int borderBits) {
|
||||
|
||||
CV_Assert(outSize.area() > 0);
|
||||
CV_Assert(marginSize >= 0);
|
||||
|
||||
_img.create(outSize, CV_8UC1);
|
||||
Mat out = _img.getMat();
|
||||
out.setTo(Scalar::all(255));
|
||||
out.adjustROI(-marginSize, -marginSize, -marginSize, -marginSize);
|
||||
|
||||
// calculate max and min values in XY plane
|
||||
CV_Assert(_board->objPoints.size() > 0);
|
||||
float minX, maxX, minY, maxY;
|
||||
minX = maxX = _board->objPoints[0][0].x;
|
||||
minY = maxY = _board->objPoints[0][0].y;
|
||||
|
||||
for(unsigned int i = 0; i < _board->objPoints.size(); i++) {
|
||||
for(int j = 0; j < 4; j++) {
|
||||
minX = min(minX, _board->objPoints[i][j].x);
|
||||
maxX = max(maxX, _board->objPoints[i][j].x);
|
||||
minY = min(minY, _board->objPoints[i][j].y);
|
||||
maxY = max(maxY, _board->objPoints[i][j].y);
|
||||
}
|
||||
}
|
||||
|
||||
float sizeX = maxX - minX;
|
||||
float sizeY = maxY - minY;
|
||||
|
||||
// proportion transformations
|
||||
float xReduction = sizeX / float(out.cols);
|
||||
float yReduction = sizeY / float(out.rows);
|
||||
|
||||
// determine the zone where the markers are placed
|
||||
if(xReduction > yReduction) {
|
||||
int nRows = int(sizeY / xReduction);
|
||||
int rowsMargins = (out.rows - nRows) / 2;
|
||||
out.adjustROI(-rowsMargins, -rowsMargins, 0, 0);
|
||||
} else {
|
||||
int nCols = int(sizeX / yReduction);
|
||||
int colsMargins = (out.cols - nCols) / 2;
|
||||
out.adjustROI(0, 0, -colsMargins, -colsMargins);
|
||||
}
|
||||
|
||||
// now paint each marker
|
||||
Dictionary &dictionary = *(_board->dictionary);
|
||||
Mat marker;
|
||||
Point2f outCorners[3];
|
||||
Point2f inCorners[3];
|
||||
for(unsigned int m = 0; m < _board->objPoints.size(); m++) {
|
||||
// transform corners to markerZone coordinates
|
||||
for(int j = 0; j < 3; j++) {
|
||||
Point2f pf = Point2f(_board->objPoints[m][j].x, _board->objPoints[m][j].y);
|
||||
// move top left to 0, 0
|
||||
pf -= Point2f(minX, minY);
|
||||
pf.x = pf.x / sizeX * float(out.cols);
|
||||
pf.y = (1.0f - pf.y / sizeY) * float(out.rows);
|
||||
outCorners[j] = pf;
|
||||
}
|
||||
|
||||
// get marker
|
||||
Size dst_sz(outCorners[2] - outCorners[0]); // assuming CCW order
|
||||
dst_sz.width = dst_sz.height = std::min(dst_sz.width, dst_sz.height); //marker should be square
|
||||
dictionary.drawMarker(_board->ids[m], dst_sz.width, marker, borderBits);
|
||||
|
||||
if((outCorners[0].y == outCorners[1].y) && (outCorners[1].x == outCorners[2].x)) {
|
||||
// marker is aligned to image axes
|
||||
marker.copyTo(out(Rect(outCorners[0], dst_sz)));
|
||||
continue;
|
||||
}
|
||||
|
||||
// interpolate tiny marker to marker position in markerZone
|
||||
inCorners[0] = Point2f(-0.5f, -0.5f);
|
||||
inCorners[1] = Point2f(marker.cols - 0.5f, -0.5f);
|
||||
inCorners[2] = Point2f(marker.cols - 0.5f, marker.rows - 0.5f);
|
||||
|
||||
// remove perspective
|
||||
Mat transformation = getAffineTransform(inCorners, outCorners);
|
||||
warpAffine(marker, out, transformation, out.size(), INTER_LINEAR,
|
||||
BORDER_TRANSPARENT);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 143 KiB |
|
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 127 KiB |
|
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 141 KiB |
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 107 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 226 KiB After Width: | Height: | Size: 226 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 126 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 157 KiB After Width: | Height: | Size: 157 KiB |
|
Before Width: | Height: | Size: 321 KiB After Width: | Height: | Size: 321 KiB |
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 685 KiB After Width: | Height: | Size: 685 KiB |
|
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 129 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 264 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 275 KiB After Width: | Height: | Size: 275 KiB |
|
Before Width: | Height: | Size: 350 KiB After Width: | Height: | Size: 350 KiB |
|
Before Width: | Height: | Size: 170 KiB After Width: | Height: | Size: 170 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 382 KiB After Width: | Height: | Size: 382 KiB |
|
Before Width: | Height: | Size: 594 KiB After Width: | Height: | Size: 594 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 127 KiB |
|
Before Width: | Height: | Size: 238 KiB After Width: | Height: | Size: 238 KiB |
|
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 242 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |