diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e9aa99e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,83 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+*.so
+*.dll
+*.dylib
+*.exe
+*.obj
+*.o
+
+# C extensions
+*.pyd
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+share/python-wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.nox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+*.py,cover
+.hypothesis/
+.pytest_cache/
+cover/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Braille editors
+*.brl
+
+# VS Code
+.vscode/
+
+# PyCharm
+.idea/
+
+# OS
+.DS_Store
+Thumbs.db
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100755
index b5935e3..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,208 +0,0 @@
-cmake_minimum_required(VERSION 2.8.3)
-project(auto_navi_expo)
-
-## 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
- geometry_msgs
- nav_msgs
- roscpp
- rospy
- std_msgs
- tf
- sensor_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
-# Message1.msg
-# Message2.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
-# )
-
-################################################
-## 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 your 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 auto_navi_expo
-# CATKIN_DEPENDS roscpp rospy std_msgs
-# DEPENDS system_lib
-)
-
-###########
-## Build ##
-###########
-
-## Specify additional locations of header files
-## Your package locations should be listed before other locations
-include_directories(arduino/motor_controller)
-include_directories(
-# include
- ${catkin_INCLUDE_DIRS}
-)
-
-## Declare a C++ library
-# add_library(${PROJECT_NAME}
-# src/${PROJECT_NAME}/auto_navi_expo.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/auto_navi_expo_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
-# target_link_libraries(${PROJECT_NAME}_node
-# ${catkin_LIBRARIES}
-# )
-
-#############
-## 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_auto_navi_expo.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)
-
-add_executable(base_controller src/base_controller.cpp)
-target_link_libraries(base_controller ${catkin_LIBRARIES})
-
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..d3713a6
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,74 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our
+community a harassment-free experience for everyone, regardless of age, body
+size, visible or invisible disability, ethnicity, sex, gender identity and
+expression, level of experience, education, socio-economic status, nationality,
+personal appearance, race, caste, religion, or sexual identity and orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming,
+diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our
+community include:
+
+* Demonstrating empathy and kindness toward other people
+* Being respectful of differing opinions, viewpoints, and experiences
+* Giving and gracefully accepting constructive feedback
+* Accepting responsibility and apologizing to those affected by our mistakes,
+ and learning from the experience
+* Focusing on what is best not just for us as individuals, but for the
+ overall community
+
+Examples of unacceptable behavior include:
+
+* The use of sexualized language or imagery, and sexual attention or
+ advances of any kind
+* Trolling, insulting or derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or email
+ address, without their explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Enforcement Responsibilities
+
+Community leaders are responsible for clarifying and enforcing our standards of
+acceptable behavior and will take appropriate and fair corrective action in
+response to any behavior that they deem inappropriate, threatening, offensive,
+or harmful.
+
+Community leaders have the right and responsibility to remove, edit, or reject
+comments, commits, code, wiki edits, issues, and other contributions that are
+not aligned to this Code of Conduct, and will communicate reasons for moderation
+decisions when appropriate.
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies when
+an individual is officially representing the community in public spaces.
+Examples of representing our community include using an official e-mail address,
+posting via an official social media account, or acting as an appointed
+representative at an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported to the community leaders responsible for enforcement.
+All complaints will be reviewed and investigated promptly and fairly.
+
+All community leaders are obligated to respect the privacy and security of the
+reporter of any incident.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 2.1, available at
+[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
+
+[homepage]: https://www.contributor-covenant.org
+[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..895368c
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,46 @@
+# Contributing to AgroBot
+
+First off, thanks for taking the time to contribute! ❤️
+
+All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions.
+
+## Table of Contents
+
+- [I Have a Question](#i-have-a-question)
+- [I Want To Contribute](#i-want-to-contribute)
+- [Reporting Bugs](#reporting-bugs)
+- [Suggesting Enhancements](#suggesting-enhancements)
+
+## I Have a Question
+
+If you want to ask a question, we assume that you have read the available documentation.
+
+Before you ask a question, it is best to search for existing Issues that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.
+
+## I Want To Contribute
+
+### Legal Notice
+When contributing to this project, you must agree that you have authored the content, that you have the rights to the content, that you have the rights to license the content to this project, and that the content does not infringe upon the proprietary rights of others.
+
+### Reporting Bugs
+
+#### Before Submitting a Bug Report
+
+A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.
+
+- Make sure that you are using the latest version.
+- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](). If you are looking for support, you might want to check [this section](#i-have-a-question)).
+- To see if other users have experienced (and potentially already solved) the same issue, you are invited to search for open and closed issues.
+
+### Suggesting Enhancements
+
+This section guides you through submitting an enhancement suggestion for AgroBot, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.
+
+#### How to Do I Submit a Good Enhancement Suggestion?
+
+Enhancement suggestions are tracked as [GitHub issues](https://github.com/bahattinyunus/AgroBot/issues).
+
+- Use a **clear and descriptive title** for the issue to identify the suggestion.
+- Provide a **step-by-step description of the suggested enhancement** in as much detail as possible.
+- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you.
+- You may include **screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to.
diff --git a/Images/Gmapping.png b/Images/Gmapping.png
deleted file mode 100755
index 063d3c4..0000000
Binary files a/Images/Gmapping.png and /dev/null differ
diff --git a/Images/Move base.png b/Images/Move base.png
deleted file mode 100755
index 6aa4a18..0000000
Binary files a/Images/Move base.png and /dev/null differ
diff --git a/rosserial/rosserial_xbee/src/xbee/LICENSE.txt b/LICENSE
old mode 100755
new mode 100644
similarity index 83%
rename from rosserial/rosserial_xbee/src/xbee/LICENSE.txt
rename to LICENSE
index fc5bedd..e806e69
--- a/rosserial/rosserial_xbee/src/xbee/LICENSE.txt
+++ b/LICENSE
@@ -1,6 +1,6 @@
-The MIT License
+MIT License
-Copyright (c) 2010 Paul Malmsten, Greg Rapp, Brian, Amit Synderman, Marco Sangalli
+Copyright (c) 2025 Bahattin Yunus
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-eHE SOFTWARE.
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
old mode 100755
new mode 100644
index b87a9ef..c59e754
--- a/README.md
+++ b/README.md
@@ -1,41 +1,61 @@
-# auto_navi_expo
-
-In this project, we build an autonomous terrestrial rover which can take care of indoor farming from plantation till before
-harvesting under ROS platform. We did 2D SLAM(gmapping) with Kinect Laser scan and Odom frame obtained from wheel encoder
-and gyroscope. We used teleop key to explore the indoor arena and used move base to navigate desired points.
-
-## Video Link :
-https://www.youtube.com/watch?v=_kQo_sd1_AM
-
-## Hardware Requirements :
- – Two geared DC motors with integrated encoder
- – Xbox kinect 360
- – Lenovo Zuk2/ Android
- – Arduino uno 320p
- – 6800mAh 3S LiPo battery (and balance charger)
- – Wood planks for chassis base
- – L shaped metal brackets
- – Nuts and Bolts
- – wires and cables
-
-## Software Requirements :
- – Ubuntu 16.04 and ROS kinetic
- – OpenCV
- – Tensorflow
- – Android Studio
-## Procedure:
-
-1. First clone my github repo using the command: $ git clone address/to/my/repo
-2. Install ros packages for navigation, freenect, and gmapping.
-3. Change the wheel diameter, track width, etc. in robot_specs.h
-4. Edit in robot_config.launch the static_transform_publisher args for tranformation of Kinect frame to Base link.
-5. If you aren’t using an android phone as an imu like I did, comment out the imu_node lines in robot_config.launch
-6. If you haven’t created a urdf model for your robot, comment out the urdf include lines in driver.launch, slam.launch,
- move_base.launch, and laser_scan.launch
-7. Try driving around the robot : $ roslaunch auto_navi_expo driver.launch
-8. For trying the laser scanner, SLAM gmapping, and navigation, roslaunch laser_scan.launch, slam.launch, and
-move_base.launch respectively.
-9. You will need to play around with the parameter settings in the launch files, such as the linear and angular scale constants in robot_config.launch, the params in amcl_diff.launch, the yaml files, etc.
-
-Future Work:
- Navigate to Multiway_points.
+# AgroBot 🚜🤖
+
+
+
+[](https://opensource.org/licenses/MIT)
+[](https://github.com/bahattinyunus/AgroBot)
+[](http://makeapullrequest.com)
+
+**AgroBot** is an advanced autonomous agricultural robot designed to optimize farming operations through smart monitoring, precise intervention, and data-driven decision making.
+
+## 🚀 Features
+
+* **Autonomous Navigation**: Self-driving capabilities in complex field environments.
+* **Crop Monitoring**: Real-time health assessment using computer vision.
+* **Precision Agriculture**: Targeted spraying and resource application.
+* **Data Analytics**: Comprehensive dashboard for farm management.
+
+## � Legacy Documentation: Auto Navi Expo
+
+*(Restored from previous version)*
+
+### auto_navi_expo
+
+* ...
+* way_points.
+* 9. You will need to [Check configuration]
+
+## �🛠️ Installation
+
+1. Clone the repository:
+ ```bash
+ git clone https://github.com/bahattinyunus/AgroBot.git
+ cd AgroBot
+ ```
+
+2. Install dependencies (Example):
+ ```bash
+ pip install -r requirements.txt
+ ```
+
+## 📖 Usage
+
+Run the main control loop:
+
+```bash
+python src/main.py
+```
+
+## 🤝 Contributing
+
+Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
+
+Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for more details.
+
+## 📜 License
+
+Distributed under the MIT License. See `LICENSE` for more information.
+
+## 📞 Contact
+
+Bahattin Yunus - [GitHub Profile](https://github.com/bahattinyunus)
diff --git a/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM(1).jpeg b/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM(1).jpeg
deleted file mode 100755
index 4e510f2..0000000
Binary files a/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM(1).jpeg and /dev/null differ
diff --git a/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM(2).jpeg b/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM(2).jpeg
deleted file mode 100755
index 3e85a8e..0000000
Binary files a/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM(2).jpeg and /dev/null differ
diff --git a/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM(3).jpeg b/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM(3).jpeg
deleted file mode 100755
index f6f8e13..0000000
Binary files a/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM(3).jpeg and /dev/null differ
diff --git a/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM(4).jpeg b/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM(4).jpeg
deleted file mode 100755
index 12fe36d..0000000
Binary files a/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM(4).jpeg and /dev/null differ
diff --git a/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM.jpeg b/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM.jpeg
deleted file mode 100755
index af9f066..0000000
Binary files a/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.15 AM.jpeg and /dev/null differ
diff --git a/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.16 AM.jpeg b/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.16 AM.jpeg
deleted file mode 100755
index b0a3514..0000000
Binary files a/app/screenshots/WhatsApp Image 2018-04-10 at 12.07.16 AM.jpeg and /dev/null differ
diff --git a/app/source code/app/.gitignore b/app/source code/app/.gitignore
deleted file mode 100755
index 796b96d..0000000
--- a/app/source code/app/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/app/source code/app/app.iml b/app/source code/app/app.iml
deleted file mode 100755
index 9b1a3b2..0000000
--- a/app/source code/app/app.iml
+++ /dev/null
@@ -1,151 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- generateDebugSources
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/source code/app/build.gradle b/app/source code/app/build.gradle
deleted file mode 100755
index beb566d..0000000
--- a/app/source code/app/build.gradle
+++ /dev/null
@@ -1,35 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 26
- defaultConfig {
- applicationId "com.example.rajiv.thala"
- minSdkVersion 15
- targetSdkVersion 26
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-}
-
-dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'com.android.support:appcompat-v7:26.1.0'
- implementation 'com.android.support.constraint:constraint-layout:1.0.2'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'com.android.support.test:runner:1.0.1'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
- compile 'com.android.support:cardview-v7:23.3.+'
- compile 'com.github.lzyzsd:circleprogress:1.2.1'
- implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
- compile 'com.github.Gavras:GIFView:v1.2'
- compile 'com.jjoe64:graphview:4.2.1'
-
-
-}
diff --git a/app/source code/app/proguard-rules.pro b/app/source code/app/proguard-rules.pro
deleted file mode 100755
index f1b4245..0000000
--- a/app/source code/app/proguard-rules.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
diff --git a/app/source code/app/src/androidTest/java/com/example/rajiv/thala/ExampleInstrumentedTest.java b/app/source code/app/src/androidTest/java/com/example/rajiv/thala/ExampleInstrumentedTest.java
deleted file mode 100755
index 3055694..0000000
--- a/app/source code/app/src/androidTest/java/com/example/rajiv/thala/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.example.rajiv.thala;
-
-import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.*;
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see Testing documentation
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
- @Test
- public void useAppContext() throws Exception {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- assertEquals("com.example.rajiv.thala", appContext.getPackageName());
- }
-}
diff --git a/app/source code/app/src/main/AndroidManifest.xml b/app/source code/app/src/main/AndroidManifest.xml
deleted file mode 100755
index 0d1df4a..0000000
--- a/app/source code/app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/source code/app/src/main/assets/auto.gif b/app/source code/app/src/main/assets/auto.gif
deleted file mode 100755
index a800e35..0000000
Binary files a/app/source code/app/src/main/assets/auto.gif and /dev/null differ
diff --git a/app/source code/app/src/main/assets/finaled.gif b/app/source code/app/src/main/assets/finaled.gif
deleted file mode 100755
index 2c3d149..0000000
Binary files a/app/source code/app/src/main/assets/finaled.gif and /dev/null differ
diff --git a/app/source code/app/src/main/assets/finalised.gif b/app/source code/app/src/main/assets/finalised.gif
deleted file mode 100755
index a348d05..0000000
Binary files a/app/source code/app/src/main/assets/finalised.gif and /dev/null differ
diff --git a/app/source code/app/src/main/assets/finalist.gif b/app/source code/app/src/main/assets/finalist.gif
deleted file mode 100755
index 7fd2137..0000000
Binary files a/app/source code/app/src/main/assets/finalist.gif and /dev/null differ
diff --git a/app/source code/app/src/main/ic_launcher-web.png b/app/source code/app/src/main/ic_launcher-web.png
deleted file mode 100755
index e6424b7..0000000
Binary files a/app/source code/app/src/main/ic_launcher-web.png and /dev/null differ
diff --git a/app/source code/app/src/main/java/com/example/rajiv/thala/bottag.java b/app/source code/app/src/main/java/com/example/rajiv/thala/bottag.java
deleted file mode 100755
index e92cd3f..0000000
--- a/app/source code/app/src/main/java/com/example/rajiv/thala/bottag.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.example.rajiv.thala;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.v7.app.AppCompatActivity;
-import android.view.View;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.widget.ImageView;
-
-public class bottag extends AppCompatActivity {
-ImageView t;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_bottag);
- t = (ImageView) findViewById(R.id.boticon);
- t.setVisibility(View.INVISIBLE);
- Animation anim = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.fade2);
- t.setAnimation(anim);
- anim.start();
- anim.setAnimationListener(new Animation.AnimationListener() {
- @Override
- public void onAnimationStart(Animation animation) {
-
- }
-
- @Override
- public void onAnimationEnd(Animation animation) {
- t.setVisibility(View.VISIBLE);
- new Handler().postDelayed(new Runnable() {
-
- /*
- * Showing splash screen with a timer. This will be useful when you
- * want to show case your app logo / company
- */
-
- @Override
- public void run() {
- // This method will be executed once the timer is over
- // Start your app main activity
- Intent i = new Intent(bottag.this, startexploring.class);
- startActivity(i);
-
- // close this activity
- finish();
- }
- }, 1800);
- }
-
- @Override
- public void onAnimationRepeat(Animation animation) {
-
- }
- });
-
- }
-}
diff --git a/app/source code/app/src/main/java/com/example/rajiv/thala/dataplot.java b/app/source code/app/src/main/java/com/example/rajiv/thala/dataplot.java
deleted file mode 100755
index 4195f0c..0000000
--- a/app/source code/app/src/main/java/com/example/rajiv/thala/dataplot.java
+++ /dev/null
@@ -1,186 +0,0 @@
-package com.example.rajiv.thala;
-
-import android.graphics.Color;
-import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
-import android.view.View;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-
-import com.jjoe64.graphview.GraphView;
-import com.jjoe64.graphview.LegendRenderer;
-import com.jjoe64.graphview.series.DataPoint;
-import com.jjoe64.graphview.series.LineGraphSeries;
-
-public class dataplot extends AppCompatActivity {
- GraphView g1,g2,g3,g4;
- Animation animatefade1,animatefade2;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- int graphcolor = Color.parseColor("#FF0000");
- int green = Color.parseColor("#00FF00");
- int axescolor = Color.parseColor("#001200");
- int plain = Color.parseColor("#FFFFFF");
- setContentView(R.layout.activity_dataplot);
- g1=(GraphView) findViewById(R.id.graph1);
- g2 = (GraphView) findViewById(R.id.graph2);
- g3=(GraphView) findViewById(R.id.graph3);
- g4=(GraphView) findViewById(R.id.graph4);
- LineGraphSeries series1 = new LineGraphSeries<>(new DataPoint[] {
-
- new DataPoint(1, 2),
- new DataPoint(2, 3),
- new DataPoint(3, 5),
- new DataPoint(4, 7),
- new DataPoint(5, 10),
- new DataPoint(6, 14)
- });
- LineGraphSeries series2 = new LineGraphSeries<>(new DataPoint[] {
- new DataPoint(1, 1),
- new DataPoint(2, 3),
- new DataPoint(3, 4),
- new DataPoint(4, 6),
- new DataPoint(5, 8),
- new DataPoint(6, 11)
- });
- LineGraphSeries series3 = new LineGraphSeries<>(new DataPoint[] {
-
- new DataPoint(1, 2),
- new DataPoint(2, 4),
- new DataPoint(3, 6),
- new DataPoint(4, 9),
- new DataPoint(5, 14),
- new DataPoint(6, 19)
- });
- LineGraphSeries series4 = new LineGraphSeries<>(new DataPoint[] {
- new DataPoint(1, 1),
- new DataPoint(2, 4),
- new DataPoint(3, 6),
- new DataPoint(4, 7),
- new DataPoint(5, 12),
- new DataPoint(6, 15)
- });
- LineGraphSeries series5 = new LineGraphSeries<>(new DataPoint[] {
- new DataPoint(1, 1),
- new DataPoint(2, 5),
- new DataPoint(3, 8),
- new DataPoint(4, 9),
- new DataPoint(5, 12),
- new DataPoint(6, 15)
- });
- LineGraphSeries series6 = new LineGraphSeries<>(new DataPoint[] {
- new DataPoint(1, 1),
- new DataPoint(2, 2),
- new DataPoint(3, 4),
- new DataPoint(4, 3),
- new DataPoint(5, 7),
- new DataPoint(6, 8)
- });
- series1.setColor(graphcolor);
- series1.setTitle("Expected");
- series2.setTitle("Actual");
- series2.setColor(green);
- series3.setColor(graphcolor);
- series4.setColor(green);
- series3.setTitle("Expected");
- series4.setTitle("Actual");
- animatefade1 = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.fade);
- animatefade2 = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.fade);
- series1.setDrawDataPoints(true);
- series1.setDataPointsRadius(10);
- series2.setDrawDataPoints(true);
- series2.setDataPointsRadius(10);
- g1.getGridLabelRenderer().setHorizontalAxisTitle("Days");
- g1.getGridLabelRenderer().setVerticalAxisTitle("Growth actual/expected");
- g1.getGridLabelRenderer().setVerticalAxisTitleColor(axescolor);
- g1.setTitle("Lettuce");
- g1.setBackgroundColor(plain);
-
- g1.startAnimation(animatefade1);
- g1.setTitleTextSize(30);
- g2.getGridLabelRenderer().setHorizontalAxisTitle("Days");
- g2.getGridLabelRenderer().setVerticalAxisTitle("Growth actual/expected");
- g2.getGridLabelRenderer().setVerticalAxisTitleColor(axescolor);
- g2.setTitle("Pea");
- g2.setBackgroundColor(plain);
- g2.setVisibility(View.INVISIBLE);
- g2.setTitleTextSize(30);
- g1.addSeries(series1);
- g1.addSeries(series2);
- g2.addSeries(series3);
- g2.addSeries(series4);
- g1.getLegendRenderer().setVisible(true);
- g1.getLegendRenderer().setBackgroundColor(Color.parseColor("#FFFFFF"));
- g1.getLegendRenderer().setFixedPosition(2,15);
- g1.getLegendRenderer().setAlign(LegendRenderer.LegendAlign.TOP);
- g2.getLegendRenderer().setVisible(true);
- g2.getLegendRenderer().setBackgroundColor(Color.parseColor("#FFFFFF"));
- g2.getLegendRenderer().setFixedPosition(2,15);
- g2.getLegendRenderer().setAlign(LegendRenderer.LegendAlign.TOP);
- g3.getLegendRenderer().setVisible(true);
- g3.getLegendRenderer().setBackgroundColor(Color.parseColor("#FFFFFF"));
- g3.getLegendRenderer().setFixedPosition(2,15);
- g3.getLegendRenderer().setAlign(LegendRenderer.LegendAlign.TOP);
- g4.getLegendRenderer().setVisible(true);
- g4.getLegendRenderer().setBackgroundColor(Color.parseColor("#FFFFFF"));
- g4.getLegendRenderer().setFixedPosition(2,15);
- g4.getLegendRenderer().setAlign(LegendRenderer.LegendAlign.TOP);
- g3.getGridLabelRenderer().setHorizontalAxisTitle("Days");
- g3.getGridLabelRenderer().setVerticalAxisTitle("Growth actual/expected");
- g3.getGridLabelRenderer().setVerticalAxisTitleColor(axescolor);
- g3.setTitle("Spinach");
- g3.setBackgroundColor(plain);
- g4.getGridLabelRenderer().setHorizontalAxisTitle("Days");
- g4.getGridLabelRenderer().setVerticalAxisTitle("Growth actual/expected");
- g4.getGridLabelRenderer().setVerticalAxisTitleColor(axescolor);
- g4.setTitle("Corn");
- g4.setBackgroundColor(plain);
- g3.setTitleTextSize(30);
- g4.setTitleTextSize(30);
- g3.addSeries(series1);
- g3.addSeries(series2);
- g4.addSeries(series3);
- g4.addSeries(series4 );
-
-
-
- animatefade1.setAnimationListener(new Animation.AnimationListener() {
- @Override
- public void onAnimationStart(Animation animation) {
-
- }
-
- @Override
- public void onAnimationEnd(Animation animation) {
- g2.startAnimation(animatefade2);
- }
-
- @Override
- public void onAnimationRepeat(Animation animation) {
-
- }
- });
- animatefade2.setAnimationListener(new Animation.AnimationListener() {
- @Override
- public void onAnimationStart(Animation animation) {
-
- }
-
- @Override
- public void onAnimationEnd(Animation animation) {
- g2.setVisibility(View.VISIBLE);
- }
-
- @Override
- public void onAnimationRepeat(Animation animation) {
-
- }
- });
-
-
-
-
- }
-}
diff --git a/app/source code/app/src/main/java/com/example/rajiv/thala/datasend.java b/app/source code/app/src/main/java/com/example/rajiv/thala/datasend.java
deleted file mode 100755
index 583b543..0000000
--- a/app/source code/app/src/main/java/com/example/rajiv/thala/datasend.java
+++ /dev/null
@@ -1,176 +0,0 @@
-package com.example.rajiv.thala;
-
-import android.content.Intent;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.os.StrictMode;
-import android.support.v7.app.AppCompatActivity;
-import android.util.Log;
-import android.view.View;
-import android.widget.EditText;
-import android.widget.TextView;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.net.UnknownHostException;
-
-public class datasend extends AppCompatActivity {
- Socket socket;
- public static String newLine = System.getProperty("line.separator");
- EditText datasend;
- public static boolean connected=false;
- boolean result=true;
- TextView data;
- boolean addrset=false;
- boolean exit=false;
- EditText ip;
- String ipaddr;
- public static PrintWriter out=null;
- public static BufferedReader red=null;
- TextView r;
- ConnectPhone x;
- ;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- ip=(EditText) findViewById(R.id.ip);
- datasend=(EditText) findViewById(R.id.datatext);
- data=(TextView) findViewById(R.id.data);
- StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
- StrictMode.setThreadPolicy(policy);
- String t="";
- /*while (!exit) {
- if(connected) {
- try {
- t = red.readLine();
- if (t != "")
- Log.i("inp", t);
- t = "";
- } catch (IOException e) {
- Log.i("nas", "kk");
- e.printStackTrace();
- }
- }
- }*/
- Log.i("connectivity","connec");
-
-
-
-
-
- }
-/* public void endcon(View view)
- {
- exit=true;
- out.println("exit");
- }*/
- public void ipenter(View view)
- {
- //ipaddr=ip.getText().toString();
- ipaddr="192.168.43.18";
- Log.i("ip",ipaddr);
- addrset=true;
- x=new ConnectPhone();
- x.execute();
- Intent i = new Intent(this,startexploring.class);
- startActivity(i);
- }
- /* public void senddata(View view)
- {
- if(connected) {
- out.println(datasend.getText().toString());
- Log.i(datasend.getText().toString(),"sent");
- datasend.setText("");
- }
- }*/
- public class ConnectPhone extends AsyncTask {
-
-
- @Override
- protected Boolean doInBackground(Void... params) {
-
- try {
- Log.i(InetAddress.getLocalHost()+"","test");
- } catch (UnknownHostException e) {
- e.printStackTrace();
- }
-
- try {
-
- socket = new Socket(ipaddr, 8006);
-
-
-
-
- } catch (IOException e) {
- result=false;
- e.printStackTrace();
-
- }
- if(result) {
- try {
- out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(),"utf-8")), true);
- } catch (IOException e) {
- e.printStackTrace();
- }
- try {
- red = new BufferedReader(new InputStreamReader(socket.getInputStream()));
- Log.i(socket.getInputStream() + "", "istream"+red.toString());
- } catch (IOException e) {
- e.printStackTrace();
- }
- connected = true;
-
- Log.i("connectivity","connec");
-
- }
-
-
- return result;
- }
-
-
- // @SuppressLint("SetTextI18n")
- @Override
- protected void onPostExecute(Boolean result) {
- /* Log.i("res:",result+"");
- String t = "";
- try {
- t = red.readLine();
- if (t != "") {
- Log.i("inp", t);
- data.setText(t);
- t=red.readLine();
- data.setText(t);
- Log.i("inp2",t);
- }
- t = "";
- } catch (IOException e) {
- Log.i("nas", "kk");
- e.printStackTrace();
- }*/
-
- finish();
-
- /* try {
- Log.i(red.readLine(),"its");
- } catch (IOException e) {
-
- }*/
- }
-
-
-
-
-
- }
- }
-
diff --git a/app/source code/app/src/main/java/com/example/rajiv/thala/healthy.java b/app/source code/app/src/main/java/com/example/rajiv/thala/healthy.java
deleted file mode 100755
index 1b87ba8..0000000
--- a/app/source code/app/src/main/java/com/example/rajiv/thala/healthy.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package com.example.rajiv.thala;
-
-import android.graphics.Color;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.v7.app.AppCompatActivity;
-import android.util.Log;
-import android.view.View;
-import android.widget.ProgressBar;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import java.io.IOException;
-
-import static com.example.rajiv.thala.datasend.red;
-
-public class healthy extends AppCompatActivity {
- ProgressBar p1;
- TextView health;
- RelativeLayout main;
- String status;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.healthiness);
- int warn= Color.parseColor("#FF0000");
- final int black= Color.parseColor("#000000");
- final int normal = Color.parseColor("#00FF00");
- int usual = Color.parseColor("#000000");
-
- main=(RelativeLayout) findViewById(R.id.main);
- main.setBackgroundColor(usual);
- p1=(ProgressBar) findViewById(R.id.prog);
- health=(TextView)findViewById(R.id.healthines);
- try {
- status=red.readLine();
- } catch (IOException e) {
- e.printStackTrace();
- }
- Log.i("status",status);
-
- if(status.equalsIgnoreCase("healthy"))
- {
- health.setTextColor(Color.parseColor("#FFFFFF"));
- health.setText("Scanning");
-
- new Handler().postDelayed(new Runnable() {
-
-
-
-
-
- @Override
- public void run() {
-
-
- p1.setVisibility(View.GONE);
- main.setBackgroundColor(normal);
- health.setTextColor(black);
- health.setText("Healthy!!");
-
-
- }
- }, 16000);
- }
- else {
- p1.setVisibility(View.GONE);
- main.setBackgroundColor(normal);
- }
-
-
- }
-}
diff --git a/app/source code/app/src/main/java/com/example/rajiv/thala/irrigation.java b/app/source code/app/src/main/java/com/example/rajiv/thala/irrigation.java
deleted file mode 100755
index 9999221..0000000
--- a/app/source code/app/src/main/java/com/example/rajiv/thala/irrigation.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.example.rajiv.thala;
-
-import android.graphics.Color;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.v7.app.AppCompatActivity;
-import android.util.Log;
-import android.view.View;
-import android.widget.ProgressBar;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-public class irrigation extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_irrigation);
- int warn= Color.parseColor("#FF0000");
- final int black= Color.parseColor("#000000");
- final int normal = Color.parseColor("#00FF00");
- int usual = Color.parseColor("#000000");
- final RelativeLayout main;
- final ProgressBar p1,progbar;
- final TextView health;
- String level;
- level="";
- main=(RelativeLayout) findViewById(R.id.main);
- main.setBackgroundColor(usual);
- p1=(ProgressBar) findViewById(R.id.prog);
- progbar=(ProgressBar) findViewById(R.id.progbar);
- progbar.setVisibility(View.INVISIBLE);
- health=(TextView)findViewById(R.id.healthines);
- /* try {
- level=red.readLine();
- } catch (IOException e) {
- e.printStackTrace();
- }*/
- level="37";
- Log.i("status",level);
- health.setTextColor(Color.parseColor("#FFFFFF"));
- health.setText("Scanning");
-
- final String finalLevel = level;
- new Handler().postDelayed(new Runnable() {
-
-
-
-
-
- @Override
- public void run() {
- // This method will be executed once the timer is over
- // Start your app main activity
-
- p1.setVisibility(View.GONE);
- /* main.setBackgroundColor(normal);
- health.setTextColor(black);*/
- health.setText("Mositure level:"+finalLevel +"%");
- progbar.setVisibility(View.VISIBLE);
- progbar.setProgress(Integer.parseInt(finalLevel));
- // close this activity
-
- }
- }, 16000);
-
-
-
-
- }
-}
diff --git a/app/source code/app/src/main/java/com/example/rajiv/thala/plantalert.java b/app/source code/app/src/main/java/com/example/rajiv/thala/plantalert.java
deleted file mode 100755
index a93e0e5..0000000
--- a/app/source code/app/src/main/java/com/example/rajiv/thala/plantalert.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.example.rajiv.thala;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.DialogFragment;
-import android.content.DialogInterface;
-import android.os.Bundle;
-
-/**
- * Created by rajiv on 21/2/18.
- */
-
-public class plantalert extends DialogFragment {
-
- public static plantalert newInstance(String title) {
- plantalert frag = new plantalert();
- Bundle args = new Bundle();
- args.putString("title", title);
- frag.setArguments(args);
- return frag;
- }
-
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- String title = getArguments().getString("title");
-
- return new AlertDialog.Builder(getActivity())
- .setTitle(title)
- .setPositiveButton("Ok",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- ((proportionselect)getActivity()).doPositiveClick();
- }
- }
- )
- .setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- dismiss();
- }
- }
- )
- .create();
- }
-}
\ No newline at end of file
diff --git a/app/source code/app/src/main/java/com/example/rajiv/thala/proportionselect.java b/app/source code/app/src/main/java/com/example/rajiv/thala/proportionselect.java
deleted file mode 100755
index 37aa8ab..0000000
--- a/app/source code/app/src/main/java/com/example/rajiv/thala/proportionselect.java
+++ /dev/null
@@ -1,179 +0,0 @@
-package com.example.rajiv.thala;
-
-import android.app.DialogFragment;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
-import android.util.Log;
-import android.view.View;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.widget.ProgressBar;
-import android.widget.RelativeLayout;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-import static com.example.rajiv.thala.datasend.connected;
-import static com.example.rajiv.thala.datasend.out;
-
-public class proportionselect extends AppCompatActivity {
- SeekBar seekbar1,seekbar2,seekbar3,seekbar4;
- RelativeLayout overall;
- ProgressBar over;
- int field_area=100,yield=0,profit=0;
- Animation anim;
- TextView yieldq,profitq;
- int seek1=0,seek2=0,seek3=0,seek4=0;
- TextView percent1,percent2,percent3,percent4;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_plantselection);
- over = (ProgressBar) findViewById(R.id.overallfill);
- seekbar1 = (SeekBar) findViewById(R.id.percentbar1);
- seekbar2 = (SeekBar) findViewById(R.id.percentbar2);
- overall=(RelativeLayout) findViewById(R.id.overall);
- yieldq=(TextView) findViewById(R.id.yield);
- profitq=(TextView) findViewById(R.id.profit);
- anim = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.fadesmall);
- overall.setAnimation(anim);
- seekbar3 = (SeekBar) findViewById(R.id.percentbar3);
- seekbar4 = (SeekBar) findViewById(R.id.percentbar4);
- percent1=(TextView) findViewById(R.id.percentdisp1);
- percent2=(TextView) findViewById(R.id.percentdisp2);
- percent3=(TextView) findViewById(R.id.percentdisp3);
- percent4=(TextView) findViewById(R.id.percentdisp4);
- percent1.setText("0%");
- percent2.setText("0%");
- percent3.setText("0%");
- percent4.setText("0%");
- yieldq.setText("");
- profitq.setText("");
- seekbar1.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
- @Override
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- seek1=progress;
- if(!sum(seek1,seek2,seek3,seek4))
- seekbar1.setProgress(progress-1);
- percent1.setText(seekbar1.getProgress()*10+"%");
- yieldset(seek1,seek2,seek3,seek4);
- }
-
- @Override
- public void onStartTrackingTouch(SeekBar seekBar) {
-
- }
-
- @Override
- public void onStopTrackingTouch(SeekBar seekBar) {
-
- }
- });
-
- seekbar2.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
- @Override
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- seek2=progress;
- if(!sum(seek1,seek2,seek3,seek4))
- seekbar2.setProgress(progress-1);
- percent2.setText(seekbar2.getProgress()*10+"%");
- yieldset(seek1,seek2,seek3,seek4);
-
- }
-
- @Override
- public void onStartTrackingTouch(SeekBar seekBar) {
-
- }
-
- @Override
- public void onStopTrackingTouch(SeekBar seekBar) {
-
- }
- });
-
- seekbar3.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
- @Override
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- seek3=progress;
- if(!sum(seek1,seek2,seek3,seek4))
- seekbar3.setProgress(progress-1);
- percent3.setText(seekbar3.getProgress()*10+"%");
- yieldset(seek1,seek2,seek3,seek4);
- }
-
- @Override
- public void onStartTrackingTouch(SeekBar seekBar) {
-
- }
-
- @Override
- public void onStopTrackingTouch(SeekBar seekBar) {
-
- }
- });
-
- seekbar4.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
- @Override
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- seek4=progress;
- if(!sum(seek1,seek2,seek3,seek4))
- seekbar4.setProgress(progress-1);
- percent4.setText(seekbar4.getProgress()*10+"%");
- yieldset(seek1,seek2,seek3,seek4);
- }
-
- @Override
- public void onStartTrackingTouch(SeekBar seekBar) {
-
- }
-
- @Override
- public void onStopTrackingTouch(SeekBar seekBar) {
-
- }
- });
- }
- boolean sum(int a,int b,int c,int d)
- {
- if(a+b+c+d>10)
- return false;
- else
- return true;
- }
- void yieldset(int a,int b,int c,int d)
- {
- profit=a*300+b*500+c*400+d*600;
- profitq.setVisibility(View.GONE);
- yield=a*16+b*5+c*11+d*6;
- profitq.setText("Profit (INR):"+profit);
-
- yieldq.setText("Yield (in Kgs/sq.metre):"+(float)(yield)/100);
- over.setProgress(a+b+c+d);
-
- }
- void startbutton(View view)
- {
- DialogFragment newFragment = plantalert.newInstance("Do you want to continue with this proportion?");
- newFragment.show(getFragmentManager(), "Dialog");
-
-
- }
-
- public void doPositiveClick() {
- // Do stuff here.
- Log.i("FragmentAlertDialog", "Positive click!");
- //send data to laptop and never reach this screen again
- if(connected)
- out.println(seekbar1.getProgress()*10+" " +seekbar2.getProgress()*10+" "+seekbar3.getProgress()*10+" "+seekbar4.getProgress()*10+" ");
- Intent i = new Intent(this,startexploring.class);
- startActivity(i);
- }
-
- public void doNegativeClick() {
- // Do stuff here.
-
- }
-
-
-}
diff --git a/app/source code/app/src/main/java/com/example/rajiv/thala/remainstats.java b/app/source code/app/src/main/java/com/example/rajiv/thala/remainstats.java
deleted file mode 100755
index fbb05f3..0000000
--- a/app/source code/app/src/main/java/com/example/rajiv/thala/remainstats.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package com.example.rajiv.thala;
-
-import android.content.Intent;
-import android.graphics.Color;
-import android.net.Uri;
-import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
-import android.view.View;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.widget.Button;
-import android.widget.ProgressBar;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-//
-
-public class remainstats extends AppCompatActivity {
- ProgressBar pesticide,p1prog,p2prog,p3prog,p4prog,wedicide;
-
- TextView wedicidestat,pesticidestat,p1view,p2view,p3view,p4view;
- Button weed,pest,pb1,pb2,pb3,pb4;
- public static int wedi=10,pesti=12,p1=10,p2=17,p3=46,p4=87;
- RelativeLayout overall;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_remainstats);
- int warn= Color.parseColor("#FF0000");
- int normal = Color.parseColor("#000000");
- wedicidestat=(TextView) findViewById(R.id.wedicideview);
- pesticidestat=(TextView) findViewById(R.id.pesticideview);
- pest =(Button) findViewById(R.id.pestibuy);
- pb1 = (Button) findViewById(R.id.p1buy);
- pb2 = (Button) findViewById(R.id.p2buy);
- pb3 = (Button) findViewById(R.id.p3buy);
- pb4 = (Button) findViewById(R.id.p4buy);
- weed = (Button) findViewById(R.id.wedibuy);
- Animation anim = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.fadesmall);
-
- overall = (RelativeLayout) findViewById(R.id.overall);
- overall.setVisibility(View.INVISIBLE);
- overall.setAnimation(anim);
- anim.start();
- anim.setAnimationListener(new Animation.AnimationListener() {
- @Override
- public void onAnimationStart(Animation animation) {
-
- }
-
- @Override
- public void onAnimationEnd(Animation animation) {
- overall.setVisibility(View.VISIBLE);
- }
-
- @Override
- public void onAnimationRepeat(Animation animation) {
-
- }
- });
- p1prog = (ProgressBar) findViewById(R.id.p1progress);
- p2prog = (ProgressBar) findViewById(R.id.p2progress);
- p3prog = (ProgressBar) findViewById(R.id.p3progress);
- p4prog = (ProgressBar) findViewById(R.id.p4progress);
- p1view = (TextView) findViewById(R.id.p1text);
- p2view = (TextView) findViewById(R.id.p2text);
- p3view = (TextView) findViewById(R.id.p3text);
- p4view = (TextView) findViewById(R.id.p4text);
- wedicide= (ProgressBar) findViewById(R.id.wedicideleft);
- pesticide = (ProgressBar) findViewById(R.id.pesticideleft);
- wedicide.setProgress(wedi);
- pesticide.setProgress(pesti);
- weed.setVisibility(View.INVISIBLE);
- pest.setVisibility(View.INVISIBLE);
-
- overall = (RelativeLayout) findViewById(R.id.overall);
- wedicidestat.setText("Wedicide left:"+wedi+"%");
- pesticidestat.setText("Pesticide left:"+pesti+"%");
- setgeneral(p1prog,pb1,p1view,p1,"Lettuce");
- setgeneral(p2prog,pb2,p2view,p2,"Pea");
- setgeneral(p3prog,pb3,p3view,p3,"Spinach");
- setgeneral(p4prog,pb4,p4view,p4,"Corn");
- if(wedi<20)
- {
-
- weed.setVisibility(View.VISIBLE);
- //set
- }
- if(pesti<20)
- {
-
- pest.setVisibility(View.VISIBLE);
- }
- }
- public void setgeneral(ProgressBar p,Button q,TextView t,int val,String s)
- {
- p.setProgress(val);
- q.setVisibility(View.INVISIBLE);
- if(val<20)
- q.setVisibility(View.VISIBLE);
- t.setText(s+":"+val+"%");
- }
- public void buyweedicide(View view)
- {
- Intent viewIntent =
- new Intent("android.intent.action.VIEW",
- Uri.parse("https://www.amazon.in/s/ref=nb_sb_ss_i_2_9?url=search-alias%3Daps&field-keywords=weedicide+for+lawn&sprefix=weedicide%2Caps%2C306&crid=1B9LRRMAWNNR6"));
- startActivity(viewIntent);
- }
- public void buypesticide(View view)
- {
- Intent viewIntent =
- new Intent("android.intent.action.VIEW",
- Uri.parse("https://www.amazon.in/s/ref=nb_sb_ss_c_1_4?url=search-alias%3Daps&field-keywords=pesticides+for+plants&sprefix=pest%2Caps%2C845&crid=3N72N61LQ0H5C&rh=i%3Aaps%2Ck%3Apesticides+for+plants"));
- startActivity(viewIntent);
- }
- public void buyp1(View view)
- {
- Intent viewIntent =
- new Intent("android.intent.action.VIEW",
- Uri.parse("https://www.amazon.in/s/ref=nb_sb_ss_i_3_8?url=search-alias%3Daps&field-keywords=lettuce+seeds+for+home+garden&sprefix=lettuce+%2Caps%2C309&crid=2HWK5AIXNFIYN"));
- startActivity(viewIntent);
- }
- public void buyp2(View view)
- {
- Intent viewIntent =
- new Intent("android.intent.action.VIEW",
- Uri.parse("https://www.amazon.in/s/ref=nb_sb_ss_i_1_25?url=search-alias%3Daps&field-keywords=pea+seeds+for+home+garden&sprefix=pea+seeds+for+home+garden%2Caps%2C1046&crid=2U9CKNW32JDQU&rh=i%3Aaps%2Ck%3Apea+seeds+for+home+garden"));
- startActivity(viewIntent);
- }
- public void buyp3(View view)
- {
- Intent viewIntent =
- new Intent("android.intent.action.VIEW",
- Uri.parse("https://www.amazon.in/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=spinach+seeds+for+home+garden&rh=i%3Aaps%2Ck%3Aspinach+seeds+for+home+garden"));
- startActivity(viewIntent);
- }
- public void buyp4(View view)
- {
- Intent viewIntent =
- new Intent("android.intent.action.VIEW",
- Uri.parse("https://www.amazon.in/Divine-Tree-Sweet-Seeds-Garden/dp/B078T2WP8M/ref=sr_1_6?ie=UTF8&qid=1519741882&sr=8-6&keywords=corn+seeds+for+home+garden"));
- startActivity(viewIntent);
- }
-}
diff --git a/app/source code/app/src/main/java/com/example/rajiv/thala/splashscreen.java b/app/source code/app/src/main/java/com/example/rajiv/thala/splashscreen.java
deleted file mode 100755
index f5bc24b..0000000
--- a/app/source code/app/src/main/java/com/example/rajiv/thala/splashscreen.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.example.rajiv.thala;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.v7.app.AppCompatActivity;
-
-
-
-public class splashscreen extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_splashscreen);
-
-
- new Handler().postDelayed(new Runnable() {
-
- /*
- * Showing splash screen with a timer. This will be useful when you
- * want to show case your app logo / company
- */
-
- @Override
- public void run() {
- // This method will be executed once the timer is over
- // Start your app main activity
- Intent i = new Intent(splashscreen.this, bottag.class);
- startActivity(i);
-
- // close this activity
- finish();
- }
- }, 3200);
- }
-
-}
-
diff --git a/app/source code/app/src/main/java/com/example/rajiv/thala/startexploring.java b/app/source code/app/src/main/java/com/example/rajiv/thala/startexploring.java
deleted file mode 100755
index bcd294f..0000000
--- a/app/source code/app/src/main/java/com/example/rajiv/thala/startexploring.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.example.rajiv.thala;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
-import android.view.View;
-import android.widget.Button;
-
-public class startexploring extends AppCompatActivity {
- Button ps,ps1,ps2;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.startexp);
- /* ps=(Button) findViewById(R.id.ps);
- // ps1=(Button) findViewById(R.id.ps1);
- //ps2 = (Button) findViewById(R.id.ps2);
- Animation anim = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.faderepeat);
- ps.setAnimation(anim);
- ps1.setAnimation(anim);
- ps2.setAnimation(anim);
- anim.start();*/
- }
- public void opt2func(View view)
- {
-// out.println("scan");
- Intent i=new Intent(this,dataplot.class);
- startActivity(i);
- }
- public void opt1func(View view)
- {
-
- Intent i=new Intent(this,proportionselect.class);
- startActivity(i);
- }
- public void opt3func(View view)
- {
-
- Intent i=new Intent(this,remainstats.class);
- startActivity(i);
- }
-}
diff --git a/app/source code/app/src/main/res/anim/fade.xml b/app/source code/app/src/main/res/anim/fade.xml
deleted file mode 100755
index 9b7c107..0000000
--- a/app/source code/app/src/main/res/anim/fade.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/app/source code/app/src/main/res/anim/fade2.xml b/app/source code/app/src/main/res/anim/fade2.xml
deleted file mode 100755
index b37b91c..0000000
--- a/app/source code/app/src/main/res/anim/fade2.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
diff --git a/app/source code/app/src/main/res/anim/faderepeat.xml b/app/source code/app/src/main/res/anim/faderepeat.xml
deleted file mode 100755
index 16bcf5d..0000000
--- a/app/source code/app/src/main/res/anim/faderepeat.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/app/source code/app/src/main/res/anim/fadesmall.xml b/app/source code/app/src/main/res/anim/fadesmall.xml
deleted file mode 100755
index 54c9d0f..0000000
--- a/app/source code/app/src/main/res/anim/fadesmall.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/source code/app/src/main/res/anim/rotate.xml b/app/source code/app/src/main/res/anim/rotate.xml
deleted file mode 100755
index fdfbe27..0000000
--- a/app/source code/app/src/main/res/anim/rotate.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
\ No newline at end of file
diff --git a/app/source code/app/src/main/res/drawable-hdpi/ic_action_name.png b/app/source code/app/src/main/res/drawable-hdpi/ic_action_name.png
deleted file mode 100755
index 06812f8..0000000
Binary files a/app/source code/app/src/main/res/drawable-hdpi/ic_action_name.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-mdpi/ic_action_name.png b/app/source code/app/src/main/res/drawable-mdpi/ic_action_name.png
deleted file mode 100755
index 88b1aec..0000000
Binary files a/app/source code/app/src/main/res/drawable-mdpi/ic_action_name.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/back.png b/app/source code/app/src/main/res/drawable-v24/back.png
deleted file mode 100755
index f472f16..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/back.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/back3.png b/app/source code/app/src/main/res/drawable-v24/back3.png
deleted file mode 100755
index e3e0261..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/back3.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/background.png b/app/source code/app/src/main/res/drawable-v24/background.png
deleted file mode 100755
index 9190efd..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/background.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/bgm.png b/app/source code/app/src/main/res/drawable-v24/bgm.png
deleted file mode 100755
index c14dc07..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/bgm.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/bgm2.png b/app/source code/app/src/main/res/drawable-v24/bgm2.png
deleted file mode 100755
index 3f20027..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/bgm2.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/blue.png b/app/source code/app/src/main/res/drawable-v24/blue.png
deleted file mode 100755
index fae6389..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/blue.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/botanical.png b/app/source code/app/src/main/res/drawable-v24/botanical.png
deleted file mode 100755
index d6ead3c..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/botanical.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/con.png b/app/source code/app/src/main/res/drawable-v24/con.png
deleted file mode 100755
index e77aa62..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/con.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/damn.png b/app/source code/app/src/main/res/drawable-v24/damn.png
deleted file mode 100755
index 5c3d480..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/damn.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/data.png b/app/source code/app/src/main/res/drawable-v24/data.png
deleted file mode 100755
index 187b57e..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/data.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/farmbot.png b/app/source code/app/src/main/res/drawable-v24/farmbot.png
deleted file mode 100755
index aa54b30..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/farmbot.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/farmbot2.png b/app/source code/app/src/main/res/drawable-v24/farmbot2.png
deleted file mode 100755
index 11f920f..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/farmbot2.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/finalaa.png b/app/source code/app/src/main/res/drawable-v24/finalaa.png
deleted file mode 100755
index 18a5f0e..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/finalaa.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/finalaah.png b/app/source code/app/src/main/res/drawable-v24/finalaah.png
deleted file mode 100755
index d99b41b..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/finalaah.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/source code/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
deleted file mode 100755
index c7bd21d..0000000
--- a/app/source code/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/source code/app/src/main/res/drawable-v24/isit.png b/app/source code/app/src/main/res/drawable-v24/isit.png
deleted file mode 100755
index 49fdb0c..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/isit.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/last.png b/app/source code/app/src/main/res/drawable-v24/last.png
deleted file mode 100755
index c4fcb64..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/last.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/last1.png b/app/source code/app/src/main/res/drawable-v24/last1.png
deleted file mode 100755
index dfae258..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/last1.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/loggo.png b/app/source code/app/src/main/res/drawable-v24/loggo.png
deleted file mode 100755
index 5485551..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/loggo.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/logo.png b/app/source code/app/src/main/res/drawable-v24/logo.png
deleted file mode 100755
index 27c771e..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/logo.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/logo4.png b/app/source code/app/src/main/res/drawable-v24/logo4.png
deleted file mode 100755
index 01cb79e..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/logo4.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/logofinal.png b/app/source code/app/src/main/res/drawable-v24/logofinal.png
deleted file mode 100755
index 900405b..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/logofinal.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/old_paper.png b/app/source code/app/src/main/res/drawable-v24/old_paper.png
deleted file mode 100755
index c622f10..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/old_paper.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/plant.png b/app/source code/app/src/main/res/drawable-v24/plant.png
deleted file mode 100755
index 53c02ff..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/plant.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/planter.png b/app/source code/app/src/main/res/drawable-v24/planter.png
deleted file mode 100755
index a290427..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/planter.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/selectp.png b/app/source code/app/src/main/res/drawable-v24/selectp.png
deleted file mode 100755
index 2713992..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/selectp.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/snt.png b/app/source code/app/src/main/res/drawable-v24/snt.png
deleted file mode 100755
index f17b69d..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/snt.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/snt2.png b/app/source code/app/src/main/res/drawable-v24/snt2.png
deleted file mode 100755
index fc64c42..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/snt2.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/statistics.png b/app/source code/app/src/main/res/drawable-v24/statistics.png
deleted file mode 100755
index 702c125..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/statistics.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/stats.png b/app/source code/app/src/main/res/drawable-v24/stats.png
deleted file mode 100755
index 9e79238..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/stats.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/storehouse.png b/app/source code/app/src/main/res/drawable-v24/storehouse.png
deleted file mode 100755
index 827ee7f..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/storehouse.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/thelast.png b/app/source code/app/src/main/res/drawable-v24/thelast.png
deleted file mode 100755
index dfae258..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/thelast.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-v24/unnamed.png b/app/source code/app/src/main/res/drawable-v24/unnamed.png
deleted file mode 100755
index c4f33bf..0000000
Binary files a/app/source code/app/src/main/res/drawable-v24/unnamed.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-xhdpi/ic_action_name.png b/app/source code/app/src/main/res/drawable-xhdpi/ic_action_name.png
deleted file mode 100755
index c94f47a..0000000
Binary files a/app/source code/app/src/main/res/drawable-xhdpi/ic_action_name.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable-xxhdpi/ic_action_name.png b/app/source code/app/src/main/res/drawable-xxhdpi/ic_action_name.png
deleted file mode 100755
index 26825e2..0000000
Binary files a/app/source code/app/src/main/res/drawable-xxhdpi/ic_action_name.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/drawable/button.xml b/app/source code/app/src/main/res/drawable/button.xml
deleted file mode 100755
index 05c33bb..0000000
--- a/app/source code/app/src/main/res/drawable/button.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/source code/app/src/main/res/drawable/buybutton.xml b/app/source code/app/src/main/res/drawable/buybutton.xml
deleted file mode 100755
index 690242b..0000000
--- a/app/source code/app/src/main/res/drawable/buybutton.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/source code/app/src/main/res/drawable/circleshape.xml b/app/source code/app/src/main/res/drawable/circleshape.xml
deleted file mode 100755
index 5fe43fa..0000000
--- a/app/source code/app/src/main/res/drawable/circleshape.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/source code/app/src/main/res/drawable/circularprogress.xml b/app/source code/app/src/main/res/drawable/circularprogress.xml
deleted file mode 100755
index 215578d..0000000
--- a/app/source code/app/src/main/res/drawable/circularprogress.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/source code/app/src/main/res/drawable/ic_launcher_background.xml b/app/source code/app/src/main/res/drawable/ic_launcher_background.xml
deleted file mode 100755
index 01f0af0..0000000
--- a/app/source code/app/src/main/res/drawable/ic_launcher_background.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/source code/app/src/main/res/drawable/startplantbutton.xml b/app/source code/app/src/main/res/drawable/startplantbutton.xml
deleted file mode 100755
index a107788..0000000
--- a/app/source code/app/src/main/res/drawable/startplantbutton.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/app/source code/app/src/main/res/layout/activity_bottag.xml b/app/source code/app/src/main/res/layout/activity_bottag.xml
deleted file mode 100755
index 30e7c3b..0000000
--- a/app/source code/app/src/main/res/layout/activity_bottag.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
diff --git a/app/source code/app/src/main/res/layout/activity_dataplot.xml b/app/source code/app/src/main/res/layout/activity_dataplot.xml
deleted file mode 100755
index 362a244..0000000
--- a/app/source code/app/src/main/res/layout/activity_dataplot.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/source code/app/src/main/res/layout/activity_healthy.xml b/app/source code/app/src/main/res/layout/activity_healthy.xml
deleted file mode 100755
index 97dd4bb..0000000
--- a/app/source code/app/src/main/res/layout/activity_healthy.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
diff --git a/app/source code/app/src/main/res/layout/activity_irrigation.xml b/app/source code/app/src/main/res/layout/activity_irrigation.xml
deleted file mode 100755
index f729137..0000000
--- a/app/source code/app/src/main/res/layout/activity_irrigation.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
diff --git a/app/source code/app/src/main/res/layout/activity_main.xml b/app/source code/app/src/main/res/layout/activity_main.xml
deleted file mode 100755
index be59504..0000000
--- a/app/source code/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/source code/app/src/main/res/layout/activity_plantselection.xml b/app/source code/app/src/main/res/layout/activity_plantselection.xml
deleted file mode 100755
index 073ff51..0000000
--- a/app/source code/app/src/main/res/layout/activity_plantselection.xml
+++ /dev/null
@@ -1,222 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/source code/app/src/main/res/layout/activity_remainstats.xml b/app/source code/app/src/main/res/layout/activity_remainstats.xml
deleted file mode 100755
index bfeb0c7..0000000
--- a/app/source code/app/src/main/res/layout/activity_remainstats.xml
+++ /dev/null
@@ -1,328 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/source code/app/src/main/res/layout/activity_splashscreen.xml b/app/source code/app/src/main/res/layout/activity_splashscreen.xml
deleted file mode 100755
index d406f5f..0000000
--- a/app/source code/app/src/main/res/layout/activity_splashscreen.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
diff --git a/app/source code/app/src/main/res/layout/activity_startexploring.xml b/app/source code/app/src/main/res/layout/activity_startexploring.xml
deleted file mode 100755
index 74931ab..0000000
--- a/app/source code/app/src/main/res/layout/activity_startexploring.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
diff --git a/app/source code/app/src/main/res/layout/healthiness.xml b/app/source code/app/src/main/res/layout/healthiness.xml
deleted file mode 100755
index 33de161..0000000
--- a/app/source code/app/src/main/res/layout/healthiness.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
diff --git a/app/source code/app/src/main/res/layout/startexp.xml b/app/source code/app/src/main/res/layout/startexp.xml
deleted file mode 100755
index a0b4631..0000000
--- a/app/source code/app/src/main/res/layout/startexp.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/source code/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/source code/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
deleted file mode 100755
index 1a64e94..0000000
--- a/app/source code/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/source code/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/source code/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted file mode 100755
index 1a64e94..0000000
--- a/app/source code/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/source code/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/source code/app/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100755
index 39e898f..0000000
Binary files a/app/source code/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-hdpi/ic_launcher_circle.png b/app/source code/app/src/main/res/mipmap-hdpi/ic_launcher_circle.png
deleted file mode 100755
index 76b27fc..0000000
Binary files a/app/source code/app/src/main/res/mipmap-hdpi/ic_launcher_circle.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/app/source code/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
deleted file mode 100755
index 234d348..0000000
Binary files a/app/source code/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/source code/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
deleted file mode 100755
index 559e014..0000000
Binary files a/app/source code/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/source code/app/src/main/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100755
index 19b8e37..0000000
Binary files a/app/source code/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-mdpi/ic_launcher_circle.png b/app/source code/app/src/main/res/mipmap-mdpi/ic_launcher_circle.png
deleted file mode 100755
index da15c6e..0000000
Binary files a/app/source code/app/src/main/res/mipmap-mdpi/ic_launcher_circle.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/app/source code/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
deleted file mode 100755
index d039721..0000000
Binary files a/app/source code/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/source code/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
deleted file mode 100755
index 6906557..0000000
Binary files a/app/source code/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/source code/app/src/main/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100755
index 5f53970..0000000
Binary files a/app/source code/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-xhdpi/ic_launcher_circle.png b/app/source code/app/src/main/res/mipmap-xhdpi/ic_launcher_circle.png
deleted file mode 100755
index 0f5ac64..0000000
Binary files a/app/source code/app/src/main/res/mipmap-xhdpi/ic_launcher_circle.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/source code/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
deleted file mode 100755
index 8fa1965..0000000
Binary files a/app/source code/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/source code/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
deleted file mode 100755
index 6698651..0000000
Binary files a/app/source code/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/source code/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted file mode 100755
index 77cc09d..0000000
Binary files a/app/source code/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-xxhdpi/ic_launcher_circle.png b/app/source code/app/src/main/res/mipmap-xxhdpi/ic_launcher_circle.png
deleted file mode 100755
index e4cb2b3..0000000
Binary files a/app/source code/app/src/main/res/mipmap-xxhdpi/ic_launcher_circle.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/source code/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
deleted file mode 100755
index 5940e84..0000000
Binary files a/app/source code/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/source code/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
deleted file mode 100755
index 72245dc..0000000
Binary files a/app/source code/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/source code/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
deleted file mode 100755
index af073ef..0000000
Binary files a/app/source code/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-xxxhdpi/ic_launcher_circle.png b/app/source code/app/src/main/res/mipmap-xxxhdpi/ic_launcher_circle.png
deleted file mode 100755
index bf406a1..0000000
Binary files a/app/source code/app/src/main/res/mipmap-xxxhdpi/ic_launcher_circle.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/source code/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
deleted file mode 100755
index 4cfc2b5..0000000
Binary files a/app/source code/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/source code/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
deleted file mode 100755
index fe33080..0000000
Binary files a/app/source code/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/app/source code/app/src/main/res/values-v21/styles.xml b/app/source code/app/src/main/res/values-v21/styles.xml
deleted file mode 100755
index a943cad..0000000
--- a/app/source code/app/src/main/res/values-v21/styles.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/source code/app/src/main/res/values/colors.xml b/app/source code/app/src/main/res/values/colors.xml
deleted file mode 100755
index 3ab3e9c..0000000
--- a/app/source code/app/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- #3F51B5
- #303F9F
- #FF4081
-
diff --git a/app/source code/app/src/main/res/values/strings.xml b/app/source code/app/src/main/res/values/strings.xml
deleted file mode 100755
index 376ecc0..0000000
--- a/app/source code/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- AGRI X
-
diff --git a/app/source code/app/src/main/res/values/styles.xml b/app/source code/app/src/main/res/values/styles.xml
deleted file mode 100755
index c716e79..0000000
--- a/app/source code/app/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/source code/app/src/main/res/xml/circularprogressbar.xml b/app/source code/app/src/main/res/xml/circularprogressbar.xml
deleted file mode 100755
index 624ed13..0000000
--- a/app/source code/app/src/main/res/xml/circularprogressbar.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/source code/app/src/test/java/com/example/rajiv/thala/ExampleUnitTest.java b/app/source code/app/src/test/java/com/example/rajiv/thala/ExampleUnitTest.java
deleted file mode 100755
index 5597bf1..0000000
--- a/app/source code/app/src/test/java/com/example/rajiv/thala/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.example.rajiv.thala;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see Testing documentation
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/archive/Sangam_Motor_rpm/Sangam_Motor_rpm.ino b/archive/Sangam_Motor_rpm/Sangam_Motor_rpm.ino
deleted file mode 100755
index 148ec50..0000000
--- a/archive/Sangam_Motor_rpm/Sangam_Motor_rpm.ino
+++ /dev/null
@@ -1,112 +0,0 @@
-
-// pins for the encoder inputs
-#define RH_ENCODER_A 3
-#define RH_ENCODER_B 5
-#define LH_ENCODER_A 4
-#define LH_ENCODER_B 2
-#define RH_Directionf 8
-#define RH_Directionb 11
-#define LH_Directionf 6
-#define LH_Directionb 7
-#define RH_Pwm 10
-#define LH_Pwm 9
-
-// variables to store the number of encoder pulses
-// for each motor
-volatile double leftCount = 0;
-volatile double rightCount = 0;
-volatile int prev, time ,start, counter=0, time_delay, RPM_left, RPM_right, prev_rotR, prev_rotL, cur_rotR, cur_rotL;
-
-void setup()
-{
- pinMode(LH_ENCODER_A, INPUT);
- pinMode(LH_ENCODER_B, INPUT);
- pinMode(RH_ENCODER_A, INPUT);
- pinMode(RH_ENCODER_B, INPUT);
-
- pinMode(RH_Directionf, OUTPUT);
- pinMode(RH_Directionb, OUTPUT);
- pinMode(LH_Directionf, OUTPUT);
- pinMode(LH_Directionb, OUTPUT);
- pinMode(RH_Pwm, OUTPUT);
- pinMode(LH_Pwm, OUTPUT);
-
- // initialize hardware interrupts
- attachInterrupt(0, leftEncoderEvent, CHANGE);
- attachInterrupt(1, rightEncoderEvent, CHANGE);
-
- Serial.begin(9600);
-
- prev = 0;
- prev_rotR = 0;
- prev_rotL = 0;
-}
-
-void loop()
-{
- //Serial.print("Right Count: ");
- time = millis();
- time_delay = time - prev;
- cur_rotR = (rightCount*60)/1425;
- cur_rotL = (leftCount*60)/1425;
- RPM_right = -(cur_rotR - prev_rotR)*0.7407;//10
- RPM_left = -(cur_rotL - prev_rotL)*0.6688;//9.03
-
- digitalWrite(RH_Directionf, HIGH);
- digitalWrite(RH_Directionb, LOW);
- analogWrite(RH_Pwm, 250);
-
- digitalWrite(LH_Directionf, HIGH);
- digitalWrite(LH_Directionb, LOW);
- analogWrite(LH_Pwm, 250);
-
- Serial.print(rightCount);
- Serial.print(" ");
- Serial.print(leftCount);
- Serial.print(" ");
- Serial.println(RPM_left);
-
- /*Serial.print(cur_rotL);
- Serial.print(" ");
- Serial.println(cur_rotR);*/
-
- prev_rotR = cur_rotR;
- prev_rotL = cur_rotL;
- delay(100);
-}
-
-// encoder event for the interrupt call
-void leftEncoderEvent()
- {
- if (digitalRead(LH_ENCODER_A) == HIGH) {
- if (digitalRead(LH_ENCODER_B) == LOW) {
- leftCount++;
- } else {
- leftCount--;
- }
- } else {
- if (digitalRead(LH_ENCODER_B) == LOW) {
- leftCount--;
- } else {
- leftCount++;
- }
- }
-}
-
-// encoder event for the interrupt call
-void rightEncoderEvent()
-{
- if (digitalRead(RH_ENCODER_A) == HIGH) {
- if (digitalRead(RH_ENCODER_B) == LOW) {
- rightCount++;
- } else {
- rightCount--;
- }
- } else {
- if (digitalRead(RH_ENCODER_B) == LOW) {
- rightCount--;
- } else {
- rightCount++;
- }
- }
-}
diff --git a/archive/imu.py b/archive/imu.py
deleted file mode 100755
index 8a60d4a..0000000
--- a/archive/imu.py
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/usr/bin/env python
-#credits : http://forum.arduino.cc/index.php/topic,8573.0.html
-
-import rospy
-import socket
-import tf
-from sensor_msgs.msg import Imu
-from math import sqrt,atan2,cos,sin,pi
-
-def map_min_max(x, in_min, in_max, out_min, out_max):
- return (long(x)-long(in_min))*(long(out_max)-long(out_min))/(long(in_max)-long(in_min))+long(out_min)
-
-def imu_publisher(sock):
- host="192.168.42.7"
- port=5555
- roll_offset = 0.0
- pitch_offset = 0.0
- yaw_offset = 0.0
- gyro_x_offset = 0.0
- gyro_y_offset = 0.0
- gyro_z_offset = 0.0
- pub_freq = 10
- alpha = 0.9
- yaw_mag = 0.0
- yaw_cf = 0.0
- yawU = 0.0
- roll_gyro = 0.0
- pitch_gyro = 0.0
- yaw_gyro = 0.0
- gyro_x_filt = 0.0
- gyro_y_filt = 0.0
- gyro_z_filt = 0.0
- accel_x_filt = 0.0
- accel_y_filt = 0.0
- accel_z_filt = 0.0
- mag_x_filt = 0.0
- mag_y_filt = 0.0
- mag_z_filt = 0.0
- count = 0
- num_callibration_itrs = 60
- debug = False
-
- pub = rospy.Publisher('imu', Imu, queue_size=50)
- rospy.init_node('imu_publisher', anonymous=True)
- rate = rospy.Rate(pub_freq)
- if rospy.has_param('~num_callibration_itrs'):
- num_callibration_itrs = rospy.get_param('~num_callibration_itrs')
- if rospy.has_param('~host'):
- host = rospy.get_param('~host')
- if rospy.has_param('~debug'):
- debug = rospy.get_param('~debug')
-
- sock.bind((host,port))
-
- current_time = rospy.Time.now()
- last_time = rospy.Time.now()
-
- rospy.loginfo("waiting for device...")
- while not rospy.is_shutdown():
- data,addr = sock.recvfrom(1024)
- line = data.split(',')
- if len(line) == 13: #received complete packet
- current_time = rospy.Time.now()
- accel_x = float(line[2]) ##m/s^2
- accel_y = float(line[3])
- accel_z = float(line[4])
- gyro_x = float(line[6]) #rad/s
- gyro_y = float(line[7])
- gyro_z = float(line[8])
- mag_x = float(line[10])
- mag_y = float(line[11])
- mag_z = float(line[12])
-
- if count == 0:
- rospy.loginfo("callibrating accelerometer and gyroscope readings for %s itrs...", num_callibration_itrs)
- for i in range(0, num_callibration_itrs):
- gyro_x_offset += gyro_x
- gyro_y_offset += gyro_y
- gyro_z_offset += gyro_z
- gyro_x_offset /= num_callibration_itrs
- gyro_y_offset /= num_callibration_itrs
- gyro_z_offset /= num_callibration_itrs
-
- #filter accel and mag readings with low pass filter
- accel_x_filt += alpha * (accel_x - accel_x_filt)
- accel_y_filt += alpha * (accel_y - accel_y_filt)
- accel_z_filt += alpha * (accel_z - accel_z_filt)
-
- mag_x_filt += alpha * (mag_x - mag_x_filt)
- mag_y_filt += alpha * (mag_y - mag_y_filt)
- mag_z_filt += alpha * (mag_z - mag_z_filt)
-
- gyro_x_filt += alpha * (gyro_x - gyro_x_filt)
- gyro_y_filt += alpha * (gyro_y - gyro_y_filt)
- gyro_z_filt += alpha * (gyro_z - gyro_z_filt)
-
- #normalize accel and mag readings
- accel_norm = sqrt(pow(accel_x_filt,2)+pow(accel_y_filt,2)+pow(accel_z_filt,2))
- accel_x_filt /= accel_norm
- accel_y_filt /= accel_norm
- accel_z_filt /= accel_norm
-
- mag_norm = sqrt(pow(mag_x_filt,2)+pow(mag_y_filt,2)+pow(mag_z_filt,2))
- mag_x_filt /= mag_norm
- mag_y_filt /= mag_norm
- mag_z_filt /= mag_norm
-
- #discretize gyro readings
- #gyro_z = float(int((gyro_z) * 100 / 20))/5
- #print gyro_z
- #calculate roll pitch yaw
- pitch = atan2(accel_x_filt, sqrt(pow(accel_y_filt,2) + pow(accel_z_filt,2)))
- roll = atan2(-accel_y_filt, sqrt(pow(accel_x_filt,2) + pow(accel_z_filt,2)))
- yaw_mag = atan2(-mag_y_filt*cos(roll)+mag_z_filt*sin(roll),
- mag_x_filt*cos(pitch)+mag_z_filt*sin(pitch)*sin(roll)+mag_z_filt*sin(pitch)*cos(roll))
- yawU = atan2(mag_x_filt, mag_y_filt)
- dt = current_time.to_sec() - last_time.to_sec()
- yaw_cf = alpha*(yaw_cf + dt*(gyro_z-gyro_z_offset)) + (1-alpha)*yawU
-
- roll_gyro += dt*(gyro_x_filt - gyro_x_offset)
- pitch_gyro += dt*(gyro_y_filt - gyro_y_offset)
- yaw_gyro += dt*(gyro_z - gyro_z_offset)
-
- #callibrate roll pitch yaw
- #roll = roll_gyro
- #pitch = pitch_gyro
- yaw = yaw_gyro
- if count < num_callibration_itrs:
- roll_offset += roll
- pitch_offset += pitch
- yaw_offset += yaw
- count += 1
- elif count == num_callibration_itrs:
- roll_offset /= num_callibration_itrs
- pitch_offset /= num_callibration_itrs
- yaw_offset /= num_callibration_itrs
- rospy.loginfo("finished callibrating rpy")
- count += 1
-
- #publish ros Imu message
- else:
- roll -= roll_offset
- pitch -= pitch_offset
- yaw -= yaw_offset
- if roll < -pi:
- roll += 2*pi
- if pitch < -pi:
- pitch += 2*pi
- if yaw > pi:
- yaw -= 2*pi
- if yaw < -pi:
- yaw += 2*pi
- if debug:
- rospy.loginfo('roll %s pitch %s yaw %s', int(roll*180/pi), int(pitch*180/pi), int(yaw*180/pi))
- imu_msg = Imu()
- imu_msg.header.stamp = rospy.Time.now()
- imu_msg.header.frame_id = '/base_link'
- q = tf.transformations.quaternion_from_euler(0.0, 0.0, yaw)
- imu_msg.orientation.x = q[0]
- imu_msg.orientation.y = q[1]
- imu_msg.orientation.z = q[2]
- imu_msg.orientation.w = q[3]
- imu_msg.orientation_covariance = [1e6, 0, 0, 0, 1e6, 0, 0, 0, 1e-6]
- imu_msg.angular_velocity_covariance[0] = -1
- imu_msg.linear_acceleration_covariance[0] = -1
- pub.publish(imu_msg)
- last_time = current_time
- #rate.sleep()
- else:
- rospy.loginfo("received incomplete UDP packet from android IMU")
- continue
-
-
-if __name__ == '__main__':
- try:
- sock=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
- imu_publisher(sock)
- except rospy.ROSInterruptException:
- pass
diff --git a/archive/incremental_encoder/incremental_encoder.ino b/archive/incremental_encoder/incremental_encoder.ino
deleted file mode 100755
index 5cc2fe5..0000000
--- a/archive/incremental_encoder/incremental_encoder.ino
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *
- * Records encoder ticks for each wheel
- * and prints the number of ticks for
- * each encoder every 500ms
- *
- */
-
-// pins for the encoder inputs
-#define RH_ENCODER_A 3
-#define RH_ENCODER_B 5
-#define LH_ENCODER_A 4
-#define LH_ENCODER_B 2
-
-#define PWML 9
-#define PWMR 10
-#define RGT1 6
-#define RGT2 7
-#define LT1 8
-#define LT2 11
-#define LOOPTIME 100 // PID loop time(ms)
-#define SMOOTH 10
-
-// variables to store the number of encoder pulses
-// for each motor
-volatile double leftCount = 0;
-volatile double rightCount = 0;
-unsigned long lastMilli = 0; // loop timing
-unsigned long lastMilliPub = 0;
-volatile float prev, now ,start, counter=0, time_delay, RPM_left, RPM_right, prev_rotR, prev_rotL, cur_rotR, cur_rotL;
-
-void setup() {
- pinMode(LH_ENCODER_A, INPUT);
- pinMode(LH_ENCODER_B, INPUT);
- pinMode(RH_ENCODER_A, INPUT);
- pinMode(RH_ENCODER_B, INPUT);
-
- pinMode(PWML,OUTPUT);
- pinMode(PWMR,OUTPUT);
- pinMode(RGT1,OUTPUT);
- pinMode(RGT2,OUTPUT);
- pinMode(LT1,OUTPUT);
- pinMode(LT2,OUTPUT);
-
- // initialize hardware interrupts
-
- attachInterrupt(0, leftEncoderEvent, CHANGE);
- attachInterrupt(1, rightEncoderEvent, CHANGE);
-
- Serial.begin(9600);
-
- prev = millis();
- prev_rotR = 0;
- prev_rotL = 0;
-}
-
-void loop() {
- //Serial.print("Right Count: ");
-unsigned long time = millis();
- if(time-lastMilli>= LOOPTIME)
- { // enter tmed loop
- analogWrite(PWML, 255);
- analogWrite(PWMR, 255);
- digitalWrite(RGT1, HIGH);
- digitalWrite(RGT2, LOW);
- digitalWrite(LT1, HIGH);
- digitalWrite(LT2, LOW);
-
- time_delay = time-lastMilli;
- cur_rotR = rightCount/5000;
- cur_rotL = leftCount/5000;
- RPM_right = (cur_rotR-prev_rotR)*622;
- RPM_left = (cur_rotL-prev_rotL)*622;
- //Serial.print(digitalRead(LH_ENCODER_A));
- //Serial.print(digitalRead(LH_ENCODER_B));
- Serial.print(RPM_left);
- Serial.print(" ");
- Serial.println(RPM_right);
- //Serial.println();
- prev_rotR = cur_rotR;
- prev_rotL = cur_rotL;
- //delay(100);
- lastMilli = time;
- }
- if(time-lastMilliPub >= LOOPTIME)
- {
- // publishRPM(time-lastMilliPub);
- lastMilliPub = time;
- }
- //delay(100);
- }
-
-// encoder event for the interrupt call
-void leftEncoderEvent() {
- if (digitalRead(LH_ENCODER_A) == HIGH) {
- if (digitalRead(LH_ENCODER_B) == LOW) {
- leftCount++;
- } else {
- leftCount--;
- }
- } else {
- if (digitalRead(LH_ENCODER_B) == LOW) {
- leftCount--;
- } else {
- leftCount++;
- }
- }
-}
-
-// encoder event for the interrupt call
-void rightEncoderEvent() {
- if (digitalRead(RH_ENCODER_A) == HIGH) {
- if (digitalRead(RH_ENCODER_B) == LOW) {
- rightCount++;
- } else {
- rightCount--;
- }
- } else {
- if (digitalRead(RH_ENCODER_B) == LOW) {
- rightCount--;
- } else {
- rightCount++;
- }
- }
-}
diff --git a/archive/laser_buffer.cpp b/archive/laser_buffer.cpp
deleted file mode 100755
index 4a3ce7f..0000000
--- a/archive/laser_buffer.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#include
-#include
-#include
-#include
-
-ros::Time current_time;
-sensor_msgs::LaserScan curr_scan;
-sensor_msgs::LaserScan prev_scan;
-
-void handle_scan( const sensor_msgs::LaserScan& ls) {
- prev_scan = curr_scan;
- curr_scan = ls;
-}
-
-int main(int argc, char** argv){
- ros::init(argc, argv, "laser_buffer");
- ros::NodeHandle n;
- ros::Subscriber sub = n.subscribe("scan_raw", 50, handle_scan);
- ros::Publisher pub = n.advertise("scan", 50);
- char base_link[] = "/base_link";
- char laser_link[] = "/camera_depth_frame";
- int is_first_scan = 1;
- ros::Duration d(1.0);
- float rate = 10.0;
- if (argc > 1) sscanf(argv[1], "%f", &rate);
- ros::Rate r(rate);
- while(n.ok()){
- ros::spinOnce();
- current_time = ros::Time::now();
- ros::topic::waitForMessage("scan_raw", n, d);
- if (is_first_scan == 1) {
- curr_scan.header.stamp = current_time;
- curr_scan.header.frame_id = laser_link;
- pub.publish(curr_scan);
- is_first_scan = 0;
- r.sleep();
- continue;
- }
- prev_scan.header.stamp = current_time;
- prev_scan.header.frame_id = laser_link;
- pub.publish(prev_scan);
- r.sleep();
- }
-}
diff --git a/archive/motor_controller/motor_controller.ino b/archive/motor_controller/motor_controller.ino
deleted file mode 100755
index cd8383a..0000000
--- a/archive/motor_controller/motor_controller.ino
+++ /dev/null
@@ -1,204 +0,0 @@
-#include
-
-// Author: Sung Jik Cha
-// Credits:
-// http://forum.arduino.cc/index.php?topic=8652.0
-// Dallaby http://letsmakerobots.com/node/19558#comment-49685
-// Bill Porter http://www.billporter.info/?p=286
-// bobbyorr (nice connection diagram) http://forum.pololu.com/viewtopic.php?f=15&t=1923
-
-//ROS headers
-#if (ARDUINO >= 100)
- #include
-#else
- #include
-#endif
-#include
-#include
-#include
-#include
-//#include "robot_specs.h"
-
-//Motor Shield headers
-#include
-#include
-//#include "utility/Adafruit_PWMServoDriver.h"
-
-#define encodPinA1 3 // encoder A pin
-#define encodPinB1 8 // encoder B pin
-#define encodPinA2 2
-#define encodPinB2 7
-#define LOOPTIME 100 // PID loop time(ms)
-#define SMOOTH 10
-
-#define sign(x) (x > 0) - (x < 0)
-
-// Create the motor shield object with the default I2C address
-Adafruit_MotorShield AFMS = Adafruit_MotorShield();
-// Select which 'port' M1, M2, M3 or M4.
-Adafruit_DCMotor *motor1 = AFMS.getMotor(1);
-Adafruit_DCMotor *motor2 = AFMS.getMotor(2);
-
-unsigned long lastMilli = 0; // loop timing
-unsigned long lastMilliPub = 0;
-double rpm_req1 = 0;
-double rpm_req2 = 0;
-double rpm_act1 = 0;
-double rpm_act2 = 0;
-double rpm_req1_smoothed = 0;
-double rpm_req2_smoothed = 0;
-int direction1 = FORWARD;
-int direction2 = FORWARD;
-int prev_direction1 = RELEASE;
-int prev_direction2 = RELEASE;
-int PWM_val1 = 0;
-int PWM_val2 = 0;
-volatile long count1 = 0; // rev counter
-volatile long count2 = 0;
-long countAnt1 = 0;
-long countAnt2 = 0;
-float Kp = 0.5;
-float Kd = 0;
-float Ki = 0;
-ros::NodeHandle nh;
-
-void handle_cmd( const geometry_msgs::Twist& cmd_msg) {
- double x = cmd_msg.linear.x;
- double z = cmd_msg.angular.z;
- if (z == 0) { // go straight
- // convert m/s to rpm
- rpm_req1 = x*60/(0.2166);
- rpm_req2 = rpm_req1;
- }
- else if (x == 0) {
- // convert rad/s to rpm
- rpm_req2 = z*0.276*60/(0.2166*2);
- rpm_req1 = -rpm_req2;
- }
- else {
- rpm_req1 = x*60/(0.2166)-z*0.276*60/(0.2166*2);
- rpm_req2 = x*60/(0.2166)+z*0.276*60/(0.2166*2);
- }
-}
-
-ros::Subscriber sub("cmd_vel", handle_cmd);
-geometry_msgs::Vector3Stamped rpm_msg;
-ros::Publisher rpm_pub("rpm", &rpm_msg);
-ros::Time current_time;
-ros::Time last_time;
-
-void setup() {
- AFMS.begin(); // create with the default frequency 1.6KHz
- count1 = 0;
- count2 = 0;
- countAnt1 = 0;
- countAnt2 = 0;
- rpm_req1 = 0;
- rpm_req2 = 0;
- rpm_act1 = 0;
- rpm_act2 = 0;
- PWM_val1 = 0;
- PWM_val2 = 0;
- nh.initNode();
- nh.getHardware()->setBaud(57600);
- nh.subscribe(sub);
- nh.advertise(rpm_pub);
-
- pinMode(encodPinA1, INPUT);
- pinMode(encodPinB1, INPUT);
- digitalWrite(encodPinA1, HIGH); // turn on pullup resistor
- digitalWrite(encodPinB1, HIGH);
- attachInterrupt(1, encoder1, RISING);
-
- pinMode(encodPinA2, INPUT);
- pinMode(encodPinB2, INPUT);
- digitalWrite(encodPinA2, HIGH); // turn on pullup resistor
- digitalWrite(encodPinB2, HIGH);
- attachInterrupt(0, encoder2, RISING);
- motor1->setSpeed(0);
- motor2->setSpeed(0);
- motor1->run(FORWARD);
- motor1->run(RELEASE);
- motor2->run(FORWARD);
- motor2->run(RELEASE);
-}
-
-void loop() {
- nh.spinOnce();
- unsigned long time = millis();
- if(time-lastMilli>= LOOPTIME) { // enter tmed loop
- getMotorData(time-lastMilli);
- PWM_val1 = updatePid(1, PWM_val1, rpm_req1, rpm_act1);
- PWM_val2 = updatePid(2, PWM_val2, rpm_req2, rpm_act2);
-
- if(PWM_val1 > 0) direction1 = FORWARD;
- else if(PWM_val1 < 0) direction1 = BACKWARD;
- if (rpm_req1 == 0) direction1 = RELEASE;
- if(PWM_val2 > 0) direction2 = FORWARD;
- else if(PWM_val2 < 0) direction2 = BACKWARD;
- if (rpm_req2 == 0) direction2 = RELEASE;
- motor1->run(direction1);
- motor2->run(direction2);
-
- motor1->setSpeed(abs(PWM_val1));
- motor2->setSpeed(abs(PWM_val2));
-
- publishRPM(time-lastMilli);
- lastMilli = time;
- }
- if(time-lastMilliPub >= LOOPTIME) {
- // publishRPM(time-lastMilliPub);
- lastMilliPub = time;
- }
-}
-
-void getMotorData(unsigned long time) {
- rpm_act1 = double((count1-countAnt1)*60*1000)/double(time*1560);//encoder_pulse*gear_ratio);
- rpm_act2 = double((count2-countAnt2)*60*1000)/double(time*1560);//encoder_pulse*gear_ratio);
- countAnt1 = count1;
- countAnt2 = count2;
-}
-
-int updatePid(int id, int command, double targetValue, double currentValue) {
- double pidTerm = 0; // PID correction
- double error = 0;
- double new_pwm = 0;
- double new_cmd = 0;
- static double last_error1 = 0;
- static double last_error2 = 0;
- static double int_error1 = 0;
- static double int_error2 = 0;
-
- error = targetValue-currentValue;
- if (id == 1) {
- int_error1 += error;
- pidTerm = Kp*error + Kd*(error-last_error1) + Ki*int_error1;
- last_error1 = error;
- }
- else {
- int_error2 += error;
- pidTerm = Kp*error + Kd*(error-last_error2) + Ki*int_error2;
- last_error2 = error;
- }
- new_pwm = constrain(double(command)*58/4095.0 + pidTerm, -58, 58);
- new_cmd = 4095.0*new_pwm/58;
- return int(new_cmd);
-}
-
-void publishRPM(unsigned long time) {
- rpm_msg.header.stamp = nh.now();
- rpm_msg.vector.x = 10;//rpm_act1;
- rpm_msg.vector.y = 10;//rpm_act2;
- rpm_msg.vector.z = 0.01;//double(time)/1000;
- rpm_pub.publish(&rpm_msg);
- nh.spinOnce();
-}
-
-void encoder1() {
- if (digitalRead(encodPinA1) == digitalRead(encodPinB1)) count1++;
- else count1--;
-}
-void encoder2() {
- if (digitalRead(encodPinA2) == digitalRead(encodPinB2)) count2--;
- else count2++;
-}
diff --git a/archive/motor_controller/robot_specs.h b/archive/motor_controller/robot_specs.h
deleted file mode 100755
index a93942c..0000000
--- a/archive/motor_controller/robot_specs.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef ROBOT_SPECS_H
-#define ROBOT_SPECS_H
-
-#define encoder_pulse 13//
-#define gear_ratio 120//
-#define wheel_diameter 0.069 //m
-#define wheel_width 0.027 //m
-#define track_width 0.276 //m
-#define MAX_RPM 58//
-#define pi 3.1415926
-#define two_pi 6.2831853
-#endif
diff --git a/archive/motor_controller_v1/motor_controller_v1.ino b/archive/motor_controller_v1/motor_controller_v1.ino
deleted file mode 100755
index 063bf03..0000000
--- a/archive/motor_controller_v1/motor_controller_v1.ino
+++ /dev/null
@@ -1,247 +0,0 @@
-// Test MD03a / Pololu motor with encoder
-// speed control (PI), V & I display
-// Credits:
-// Dallaby http://letsmakerobots.com/node/19558#comment-49685
-// Bill Porter http://www.billporter.info/?p=286
-// bobbyorr (nice connection diagram) http://forum.pololu.com/viewtopic.php?f=15&t=1923
-
-//ROS headers
-#if (ARDUINO >= 100)
- #include
-#else
- #include
-#endif
-#include
-#include
-#include
-#include
-#include
-#include
-
-//Motor Shield headers
-#include
-#include
-#include "utility/Adafruit_PWMServoDriver.h"
-
-#define encodPinA1 3 // encoder A pin
-#define encodPinB1 8 // encoder B pin
-#define encodPinA2 2
-#define encodPinB2 7
-#define LOOPTIME 50 // PID loop time(ms)
-#define encoder_pulse 26
-#define gear_ratio 20
-#define wheel_diameter 0.065 //m
-#define wheel_width 27
-#define axis_length 0.21 //m
-#define max_RPM 298
-#define pi 3.14159265
-
-// Create the motor shield object with the default I2C address
-Adafruit_MotorShield AFMS = Adafruit_MotorShield();
-// Select which 'port' M1, M2, M3 or M4. In this case, M1
-Adafruit_DCMotor *motor1 = AFMS.getMotor(1);
-Adafruit_DCMotor *motor2 = AFMS.getMotor(2);
-
-unsigned long lastMilli = 0; // loop timing
-unsigned long lastMilliPrint = 0;
-unsigned long lastMilliPub = 0;
-int rpm_req1 = 0;
-int rpm_req2 = 0;
-int rpm_act1 = 0;
-int rpm_act2 = 0;
-int direction1 = FORWARD;
-int direction2 = FORWARD;
-int PWM_val1 = 0; // (25% = 64; 50% = 127; 75% = 191; 100% = 255)
-int PWM_val2 = 0;
-volatile long count1 = 0; // rev counter
-volatile long count2 = 0;
-float Kp = 1; // PID proportional control Gain
-float Kd = 0.5; // PID Derivitave control gain
-float x_pos = 0.0;
-float y_pos = 0.0;
-float theta = 0.0;
-char base_link[] = "/base_link";
-char odom[] = "/odom";
-
-ros::NodeHandle nh;
-
-void handle_cmd( const geometry_msgs::Twist& cmd_msg) {
- float x = cmd_msg.linear.x;
- float z = cmd_msg.angular.z;
- if (z == 0) { // go straight
- // convert m/s to rpm
- rpm_req1 = x*60/(pi*wheel_diameter);
- rpm_req2 = rpm_req1;
- }
- else if (x == 0) {
- // convert rad/s to rpm
- rpm_req2 = z*axis_length*60/(2*pi*2);
- rpm_req1 = -rpm_req2;
- }
- else {
- rpm_req2 = x*60/(pi*wheel_diameter)-z*axis_length*60/(2*pi*2);
- rpm_req1 = x*60/(pi*wheel_diameter)+z*axis_length*60/(2*pi*2);
- }
- if (rpm_req1 >= 0) direction1 = FORWARD;
- else direction1 = BACKWARD;
- if (rpm_req2 >= 0) direction2 = FORWARD;
- else direction2 = BACKWARD;
-}
-
-ros::Subscriber sub("cmd_vel", handle_cmd);
-geometry_msgs::TransformStamped t;
-tf::TransformBroadcaster broadcaster;
-nav_msgs::Odometry odom_msg;
-ros::Publisher odom_pub("odom", &odom_msg);
-ros::Time current_time;
-ros::Time last_time;
-
-void setup() {
- Serial.begin(57600);
- AFMS.begin(); // create with the default frequency 1.6KHz
-
- nh.initNode();
- //nh.getHardware()->setBaud(115200);
- nh.subscribe(sub);
- nh.advertise(odom_pub);
- broadcaster.init(nh);
-
- pinMode(encodPinA1, INPUT);
- pinMode(encodPinB1, INPUT);
- digitalWrite(encodPinA1, HIGH); // turn on pullup resistor
- digitalWrite(encodPinB1, HIGH);
- attachInterrupt(1, rencoder1, FALLING);
-
- pinMode(encodPinA2, INPUT);
- pinMode(encodPinB2, INPUT);
- digitalWrite(encodPinA2, HIGH); // turn on pullup resistor
- digitalWrite(encodPinB2, HIGH);
- attachInterrupt(0, rencoder2, FALLING);
-}
-
-void loop() {
-
- nh.spinOnce();
- unsigned long time = millis();
- if(time-lastMilli>= LOOPTIME) { // enter tmed loop
- getMotorData(time-lastMilli); // calculate speed, volts and Amps
- PWM_val1 = updatePid1(PWM_val1, rpm_req1, rpm_act1); // compute PWM value
- PWM_val2 = updatePid2(PWM_val2, rpm_req2, rpm_act2); // compute PWM value
- motor1->setSpeed(PWM_val1); // send PWM to motor
- motor2->setSpeed(PWM_val2);
- motor1->run(direction1);
- motor2->run(direction2);
- lastMilli = time;
- }
- if(time-lastMilliPub >= LOOPTIME*10) {
- publishOdom(time-lastMilliPub);
- lastMilliPub = time;
- }
- //printMotorInfo(); // display data
-}
-
-void getMotorData(unsigned long time) { // calculate speed, volts and Amps
- static long countAnt1 = 0; // last count
- static long countAnt2 = 0;
- rpm_act1 = ((count1 - countAnt1)*(60*(1000/time)))/(encoder_pulse*gear_ratio);
- rpm_act2 = ((count2 - countAnt2)*(60*(1000/time)))/(encoder_pulse*gear_ratio);
- countAnt1 = count1;
- countAnt2 = count2;
-}
-
-int updatePid1(int command, int targetValue, int currentValue) {
-float pidTerm = 0; // PID correction
-int error=0;
-static int last_error1=0;
- error = abs(targetValue) - abs(currentValue);
- pidTerm = (Kp * error) + (Kd * (error - last_error1));
- last_error1 = error;
- return constrain(command + int(pidTerm), 0, 255);
-}
-
-int updatePid2(int command, int targetValue, int currentValue) {
-float pidTerm = 0; // PID correction
-int error=0;
-static int last_error2=0;
- error = abs(targetValue) - abs(currentValue);
- pidTerm = (Kp * error) + (Kd * (error - last_error2));
- last_error2 = error;
- return constrain(command + int(pidTerm), 0, 255);
-}
-
-void publishOdom(unsigned long time) {
- double dx = 0.0;
- double dy = 0.0;
- double dxy_ave = 0.0;
- double dth = 0.0;
- double dt = 0.0;
- int signed_rpm_act1 = 0;
- int signed_rpm_act2 = 0;
-
- if(direction1 == FORWARD) signed_rpm_act1 = rpm_act1;
- else signed_rpm_act1 = -rpm_act1;
-
- if(direction2 == FORWARD) signed_rpm_act2 = rpm_act2;
- else signed_rpm_act2 = -rpm_act2;
-
- dt = (double)time/1000; //ms to s
- current_time = nh.now();
- dxy_ave = (signed_rpm_act1+signed_rpm_act2)*dt*wheel_diameter*pi/(60*2);
- dth = (signed_rpm_act1-signed_rpm_act2)*dt*wheel_diameter*pi/(60*axis_length);
- dx = cos(dth) * dxy_ave;
- dy = -sin(dth) * dxy_ave;
- x_pos += (cos(theta) * dx - sin(theta) * dy);
- y_pos += (sin(theta) * dx + cos(theta) * dy);
- theta += dth;
-
- geometry_msgs::Quaternion odom_quat = tf::createQuaternionFromYaw(theta);
- t.header.frame_id = odom;
- t.child_frame_id = base_link;
- t.transform.translation.x = x_pos;
- t.transform.translation.y = y_pos;
- t.transform.translation.z = 0.0;
- t.transform.rotation = odom_quat;
- t.header.stamp = current_time;
-
- broadcaster.sendTransform(t);
-
- odom_msg.header.stamp = current_time;
- odom_msg.header.frame_id = odom;
- odom_msg.pose.pose.position.x = x_pos;
- odom_msg.pose.pose.position.y = y_pos;
- odom_msg.pose.pose.position.z = 0.0;
- odom_msg.pose.pose.orientation = odom_quat;
- odom_msg.child_frame_id = base_link;
- odom_msg.twist.twist.linear.x = dxy_ave/dt;
- odom_msg.twist.twist.linear.y = 0.0;
- odom_msg.twist.twist.linear.z = 0.0;
- odom_msg.twist.twist.angular.z = dth/dt;
- odom_pub.publish(&odom_msg);
-}
-
-void printMotorInfo() { // display data
- if((millis()-lastMilliPrint) >= 1000) {
- lastMilliPrint = millis();
- Serial.print("required RPM:"); Serial.print(rpm_req1);
- Serial.println("");
- Serial.print(" motor1 RPM:"); Serial.print(rpm_act1);
- Serial.println("");
- Serial.print(" motor1 PWM:"); Serial.print(PWM_val1);
- Serial.println("");
- Serial.print(" motor2 RPM:"); Serial.print(rpm_act2);
- Serial.println("");
- Serial.print(" motor2 PWM:"); Serial.print(PWM_val2);
- Serial.println("");
- Serial.println("-------------");
- }
-}
-
-void rencoder1() { // pulse and direction, direct port reading to save cycles
- if (PINB & 0b00000001) count1--; // if(digitalRead(encodPinB1)==HIGH) count ++;
- else count1++; // if (digitalRead(encodPinB1)==LOW) count --; count2--; // if (digitalRead(encodPinB2)==LOW) count --;
-}
-
-void rencoder2() { // pulse and direction, direct port reading to save cycles count1--; // if (digitalRead(encodPinB1)==LOW) count --;
- if (PIND & 0b10000000) count2--; // if(digitalRead(encodPinB2)==HIGH) count ++;
- else count2++; // if (digitalRead(encodPinB2)==LOW) count --;
-}
diff --git a/archive/motor_controller_v2/motor_controller_v2.ino b/archive/motor_controller_v2/motor_controller_v2.ino
deleted file mode 100755
index b1c521e..0000000
--- a/archive/motor_controller_v2/motor_controller_v2.ino
+++ /dev/null
@@ -1,273 +0,0 @@
-// Test MD03a / Pololu motor with encoder
-// speed control (PI), V & I display
-// Credits:
-// Dallaby http://letsmakerobots.com/node/19558#comment-49685
-// Bill Porter http://www.billporter.info/?p=286
-// bobbyorr (nice connection diagram) http://forum.pololu.com/viewtopic.php?f=15&t=1923
-
-//ROS headers
-#if (ARDUINO >= 100)
- #include
-#else
- #include
-#endif
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-//Motor Shield headers
-#include
-#include
-#include "utility/Adafruit_PWMServoDriver.h"
-
-#define encodPinA1 3 // encoder A pin
-#define encodPinB1 8 // encoder B pin
-#define encodPinA2 2
-#define encodPinB2 7
-#define LOOPTIME 100 // PID loop time(ms)
-#define encoder_pulse 13
-#define gear_ratio 20
-#define wheel_diameter 0.069 //m
-#define wheel_width 27
-#define axis_length 0.276 //m
-#define max_RPM 298
-#define pi 3.14159265
-
-// Create the motor shield object with the default I2C address
-Adafruit_MotorShield AFMS = Adafruit_MotorShield();
-// Select which 'port' M1, M2, M3 or M4. In this case, M1
-Adafruit_DCMotor *motor1 = AFMS.getMotor(1);
-Adafruit_DCMotor *motor2 = AFMS.getMotor(2);
-
-unsigned long lastMilli = 0; // loop timing
-unsigned long lastMilliPrint = 0;
-unsigned long lastMilliPub = 0;
-int rpm_req1 = 0;
-int rpm_req2 = 0;
-int rpm_act1 = 0;
-int rpm_act2 = 0;
-int direction1 = FORWARD;
-int direction2 = FORWARD;
-int PWM_val1 = 0; // (25% = 64; 50% = 127; 75% = 191; 100% = 255)
-int PWM_val2 = 0;
-volatile long count1 = 0; // rev counter
-volatile long count2 = 0;
-float Kp = 1; // PID proportional control Gain
-float Kd = 0.5; // PID Derivitave control gain
-float x_pos = 0.0;
-float y_pos = 0.0;
-float theta = 0.0;
-char base_link[] = "/base_link";
-char odom[] = "/odom";
-
-ros::NodeHandle nh;
-
-void handle_cmd( const geometry_msgs::Twist& cmd_msg) {
- float x = cmd_msg.linear.x;
- float z = cmd_msg.angular.z;
- if (z == 0) { // go straight
- // convert m/s to rpm
- rpm_req1 = x*60/(pi*wheel_diameter);
- rpm_req2 = rpm_req1;
- }
- else if (x == 0) {
- // convert rad/s to rpm
- rpm_req2 = z*axis_length*60/(wheel_diameter*pi*2);
- rpm_req1 = -rpm_req2;
- }
- else {
- rpm_req1 = x*60/(pi*wheel_diameter)-z*axis_length*60/(wheel_diameter*pi*2);
- rpm_req2 = x*60/(pi*wheel_diameter)+z*axis_length*60/(wheel_diameter*pi*2);
- }
- if (rpm_req1 >= 0) direction1 = FORWARD;
- else direction1 = BACKWARD;
- if (rpm_req2 >= 0) direction2 = FORWARD;
- else direction2 = BACKWARD;
-}
-
-ros::Subscriber sub("cmd_vel", handle_cmd);
-//geometry_msgs::TransformStamped t;
-//tf::TransformBroadcaster broadcaster;
-//nav_msgs::Odometry odom_msg;
-geometry_msgs::Vector3Stamped rpm_msg;
-//ros::Publisher odom_pub("odom", &odom_msg);
-ros::Publisher rpm_pub("rpm", &rpm_msg);
-ros::Time current_time;
-ros::Time last_time;
-
-void setup() {
- AFMS.begin(); // create with the default frequency 1.6KHz
-
- nh.initNode();
- nh.getHardware()->setBaud(57600);
- nh.subscribe(sub);
- //nh.advertise(odom_pub);
- nh.advertise(rpm_pub);
- //broadcaster.init(nh);
-
- pinMode(encodPinA1, INPUT);
- pinMode(encodPinB1, INPUT);
- digitalWrite(encodPinA1, HIGH); // turn on pullup resistor
- digitalWrite(encodPinB1, HIGH);
- attachInterrupt(1, rencoder1, FALLING);
-
- pinMode(encodPinA2, INPUT);
- pinMode(encodPinB2, INPUT);
- digitalWrite(encodPinA2, HIGH); // turn on pullup resistor
- digitalWrite(encodPinB2, HIGH);
- attachInterrupt(0, rencoder2, FALLING);
-}
-
-void loop() {
-
- nh.spinOnce();
- unsigned long time = millis();
- if(time-lastMilli>= LOOPTIME) { // enter tmed loop
- getMotorData(time-lastMilli); // calculate speed, volts and Amps
- PWM_val1 = updatePid1(PWM_val1, rpm_req1, rpm_act1); // compute PWM value
- PWM_val2 = updatePid2(PWM_val2, rpm_req2, rpm_act2); // compute PWM value
- motor1->setSpeed(PWM_val1); // send PWM to motor
- motor2->setSpeed(PWM_val2);
- motor1->run(direction1);
- motor2->run(direction2);
- lastMilli = time;
- }
- if(time-lastMilliPub >= LOOPTIME) {
- // publishOdom(time-lastMilliPub);
- publishRPM(time-lastMilliPub);
- lastMilliPub = time;
- }
- //printMotorInfo(); // display data
-}
-
-void getMotorData(unsigned long time) { // calculate speed, volts and Amps
- static long countAnt1 = 0; // last count
- static long countAnt2 = 0;
- rpm_act1 = ((count1 - countAnt1)*(60*(1000/time)))/(encoder_pulse*gear_ratio);
- rpm_act2 = ((count2 - countAnt2)*(60*(1000/time)))/(encoder_pulse*gear_ratio);
- countAnt1 = count1;
- countAnt2 = count2;
-}
-
-int updatePid1(int command, int targetValue, int currentValue) {
-float pidTerm = 0; // PID correction
-int error=0;
-static int last_error1=0;
- error = abs(targetValue) - abs(currentValue);
- pidTerm = (Kp * error) + (Kd * (error - last_error1));
- last_error1 = error;
- return constrain(command + int(pidTerm), 0, 255);
-}
-
-int updatePid2(int command, int targetValue, int currentValue) {
-float pidTerm = 0; // PID correction
-int error=0;
-static int last_error2=0;
- error = abs(targetValue) - abs(currentValue);
- pidTerm = (Kp * error) + (Kd * (error - last_error2));
- last_error2 = error;
- return constrain(command + int(pidTerm), 0, 255);
-}
-
-/**
-void publishOdom(unsigned long time) {
- double dx = 0.0;
- double dy = 0.0;
- double dxy_ave = 0.0;
- double dth = 0.0;
- double dt = 0.0;
- int signed_rpm_act1 = 0;
- int signed_rpm_act2 = 0;
-
- if(direction1 == FORWARD) signed_rpm_act1 = rpm_act1;
- else signed_rpm_act1 = -rpm_act1;
-
- if(direction2 == FORWARD) signed_rpm_act2 = rpm_act2;
- else signed_rpm_act2 = -rpm_act2;
-
- dt = (double)time/1000; //ms to s
- current_time = nh.now();
- dxy_ave = (signed_rpm_act1+signed_rpm_act2)*dt*wheel_diameter*pi/(60*2);
- dth = (signed_rpm_act1-signed_rpm_act2)*dt*wheel_diameter*pi/(60*axis_length);
- dx = cos(dth) * dxy_ave;
- dy = -sin(dth) * dxy_ave;
- x_pos += (cos(theta) * dx - sin(theta) * dy);
- y_pos += (sin(theta) * dx + cos(theta) * dy);
- theta += dth;
-
- geometry_msgs::Quaternion odom_quat = tf::createQuaternionFromYaw(theta);
- t.header.frame_id = base_link;
- t.child_frame_id = odom;
- t.transform.translation.x = x_pos;
- t.transform.translation.y = y_pos;
- t.transform.translation.z = 0.0;
- t.transform.rotation = odom_quat;
- t.header.stamp = current_time;
-
- broadcaster.sendTransform(t);
- nh.spinOnce();
-
- odom_msg.header.stamp = current_time;
- odom_msg.header.frame_id = odom;
- odom_msg.pose.pose.position.x = x_pos;
- odom_msg.pose.pose.position.y = y_pos;
- odom_msg.pose.pose.position.z = 0.0;
- odom_msg.pose.pose.orientation = odom_quat;
- odom_msg.child_frame_id = base_link;
- odom_msg.twist.twist.linear.x = dxy_ave/dt;
- odom_msg.twist.twist.linear.y = 0.0;
- odom_msg.twist.twist.linear.z = 0.0;
- odom_msg.twist.twist.angular.z = dth/dt;
-
- odom_pub.publish(&odom_msg);
- nh.spinOnce();
-}
-**/
-void publishRPM(unsigned long time) {
- int signed_rpm_act1 = 0;
- int signed_rpm_act2 = 0;
-
- if(direction1 == FORWARD) signed_rpm_act1 = rpm_act1;
- else signed_rpm_act1 = -rpm_act1;
-
- if(direction2 == FORWARD) signed_rpm_act2 = rpm_act2;
- else signed_rpm_act2 = -rpm_act2;
-
- rpm_msg.header.stamp = nh.now();
- rpm_msg.vector.x = signed_rpm_act1;
- rpm_msg.vector.y = signed_rpm_act2;
- rpm_msg.vector.z = double(time)/1000;
- rpm_pub.publish(&rpm_msg);
- nh.spinOnce();
-}
-
-void printMotorInfo() { // display data
- if((millis()-lastMilliPrint) >= 1000) {
- lastMilliPrint = millis();
- Serial.print("required RPM:"); Serial.print(rpm_req1);
- Serial.println("");
- Serial.print(" motor1 RPM:"); Serial.print(rpm_act1);
- Serial.println("");
- Serial.print(" motor1 PWM:"); Serial.print(PWM_val1);
- Serial.println("");
- Serial.print(" motor2 RPM:"); Serial.print(rpm_act2);
- Serial.println("");
- Serial.print(" motor2 PWM:"); Serial.print(PWM_val2);
- Serial.println("");
- Serial.println("-------------");
- }
-}
-
-void rencoder1() { // pulse and direction, direct port reading to save cycles
- if (PINB & 0b00000001) count1--; // if(digitalRead(encodPinB1)==HIGH) count ++;
- else count1++; // if (digitalRead(encodPinB1)==LOW) count --; count2--; // if (digitalRead(encodPinB2)==LOW) count --;
-}
-
-void rencoder2() { // pulse and direction, direct port reading to save cycles count1--; // if (digitalRead(encodPinB1)==LOW) count --;
- if (PIND & 0b10000000) count2--; // if(digitalRead(encodPinB2)==HIGH) count ++;
- else count2++; // if (digitalRead(encodPinB2)==LOW) count --;
-}
diff --git a/archive/motor_controller_worked/motor_controller_worked.ino b/archive/motor_controller_worked/motor_controller_worked.ino
deleted file mode 100755
index 0cda3ba..0000000
--- a/archive/motor_controller_worked/motor_controller_worked.ino
+++ /dev/null
@@ -1,205 +0,0 @@
-#define RH_ENCODER_A 3
-#define RH_ENCODER_B 5
-#define LH_ENCODER_A 4
-#define LH_ENCODER_B 2
-#define RH_Directionf 6
-#define RH_Directionb 7
-#define LH_Directionf 8
-#define LH_Directionb 11
-#define RH_Pwm 10
-#define LH_Pwm 9
-#define LOOPTime 100 // PID loop Time(ms)
-#define SMOOTH 10
-
-// variables to store the number of encoder pulses
-// for each motor
-volatile double leftCount = 0;
-volatile double rightCount = 0;
-volatile int prev, now ,start, counter=0, Time_delay, prev_rotR =0, prev_rotL=0, cur_rotR=0, cur_rotL=0;
-unsigned long lastMilli = 0; // loop timing
-unsigned long lastMilliPub = 0;
-double Req_RPM_right = 0;
-double Req_RPM_left = 100;
-double Act_RPM_right = 0;
-double Act_RPM_left = 0;
-double Req_RPM_right_smoothed = 0;
-double Req_RPM_left_smoothed = 0;
-char direction1 ;
-char direction2 ;
-int PWM_val1 = 0;
-int PWM_val2 = 0;
-volatile long count1 = 0; // rev counter
-volatile long count2 = 0;
- static double last_error1 = 0;
- static double last_error2 = 0;
- static double int_error1 = 0;
- static double int_error2 = 0;
-long countAnt1 = 0;
-long countAnt2 = 0;
-float Kp = 0.4;
-float Kd = 0.02;
-float Ki = 0;
-int Time = 0;
-
-void setup()
-{
- Serial.begin(9600);
- pinMode(LH_ENCODER_A, INPUT);
- pinMode(LH_ENCODER_B, INPUT);
- pinMode(RH_ENCODER_A, INPUT);
- pinMode(RH_ENCODER_B, INPUT);
-
- pinMode(RH_Directionf, OUTPUT);
- pinMode(RH_Directionb, OUTPUT);
- pinMode(LH_Directionf, OUTPUT);
- pinMode(LH_Directionb, OUTPUT);
- pinMode(RH_Pwm, OUTPUT);
- pinMode(LH_Pwm, OUTPUT);
-
- // initialize hardware interrupts
- attachInterrupt(0, leftEncoderEvent, CHANGE);
- attachInterrupt(1, rightEncoderEvent, CHANGE);
-
- prev_rotR = 0;
- prev_rotL = 0;
- prev = 0;
-}
-
-void loop()
-{
- unsigned long Time = millis();
- //Serial.println(Time);
- if(Time-lastMilli>= LOOPTime)
- {
- Time_delay = Time-lastMilli;
- cur_rotR = rightCount/5000;
- cur_rotL = leftCount/5000;
- Act_RPM_right = double((cur_rotR - prev_rotR)*600);
- Act_RPM_left = double((cur_rotL - prev_rotL)*600);
-// Serial.println(Act_RPM_right);
- Serial.println(Act_RPM_left);
-
- prev_rotR = cur_rotR;
- prev_rotL = cur_rotL;
-
- PWM_val1 = updatePid(1, PWM_val1, Req_RPM_right, Act_RPM_right);
- PWM_val2 = updatePid(2, PWM_val2, Req_RPM_left, Act_RPM_left);
-
- if(PWM_val1 > 0) direction1 = 'f';
- else if(PWM_val1 < 0) direction1 = 'b';
- if (Req_RPM_right == 0) direction1 = 's';
- if(PWM_val2 > 0) direction2 = 'f';
- else if(PWM_val2 < 0) direction2 = 'b';
- if (Req_RPM_left == 0) direction2 = 's';
-
- PWM_val1 = abs(PWM_val1);
- PWM_val2 = abs(PWM_val2);
-
- if ( direction1 == 'f')
- {
- digitalWrite(LH_Directionf, HIGH);
- digitalWrite(LH_Directionb, LOW);
- analogWrite(LH_Pwm, PWM_val1);
- }
- else if( direction1 == 'b')
- {
- digitalWrite(LH_Directionf, LOW);
- digitalWrite(LH_Directionb, HIGH);
- analogWrite(LH_Pwm, PWM_val1);
-
- }
- else if(direction1 == 's')
- {
- digitalWrite(LH_Directionf, LOW);
- digitalWrite(LH_Directionb, LOW);
- analogWrite(LH_Pwm, PWM_val1);
- }
-
- if ( direction2 == 'f')
- {
- digitalWrite(RH_Directionf, HIGH);
- digitalWrite(RH_Directionb, LOW);
- analogWrite(RH_Pwm, PWM_val2);
- }
- else if( direction2 == 'b')
- {
- digitalWrite(RH_Directionf, LOW);
- digitalWrite(RH_Directionb, HIGH);
- analogWrite(RH_Pwm, PWM_val2);
- }
- else if(direction2 == 's')
- {
- digitalWrite(RH_Directionf, LOW);
- digitalWrite(RH_Directionb, LOW);
- analogWrite(RH_Pwm, PWM_val2);
- }
-
- lastMilli = Time;
- delay(100);
- }
- if(Time-lastMilliPub >= LOOPTime)
- {
- // publishRPM(Time-lastMilliPub);
- lastMilliPub = Time;
- }
-}
-
-int updatePid(int id, int command, double targetValue, double currentValue)
-{
- double pidTerm = 0; // PID correction
- double error = 0;
- double new_pwm = 0;
- double new_cmd = 0;
-
- error = targetValue-currentValue;
- if (id == 1)
- {
- int_error1 += error;
- pidTerm = Kp*error + Kd*(error-last_error1) + Ki*int_error1;
- last_error1 = error;
- }
- else
- {
- int_error2 += error;
- pidTerm = Kp*error + Kd*(error-last_error2) + Ki*int_error2;
- last_error2 = error;
- }
- new_pwm = constrain(double(command)*160/255 + pidTerm, -160, 160);
- new_cmd = 255*new_pwm/160;
- return int(new_cmd);
-}
-
-void leftEncoderEvent()
- {
- if (digitalRead(LH_ENCODER_A) == HIGH) {
- if (digitalRead(LH_ENCODER_B) == LOW) {
- leftCount++;
- } else {
- leftCount--;
- }
- } else {
- if (digitalRead(LH_ENCODER_B) == LOW) {
- leftCount--;
- } else {
- leftCount++;
- }
- }
-}
-
-// encoder event for the interrupt call
-void rightEncoderEvent()
-{
- if (digitalRead(RH_ENCODER_A) == HIGH) {
- if (digitalRead(RH_ENCODER_B) == LOW) {
- rightCount++;
- } else {
- rightCount--;
- }
- } else {
- if (digitalRead(RH_ENCODER_B) == LOW) {
- rightCount--;
- } else {
- rightCount++;
- }
- }
-}
diff --git a/archive/recv_udp.py b/archive/recv_udp.py
deleted file mode 100755
index dd458a0..0000000
--- a/archive/recv_udp.py
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env python
-
-import socket
-
-
-host="192.168.42.185"
-port=5555
-
-
-sock=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
-sock.bind((host,port))
-while 1:
- data,addr = sock.recvfrom(1024)
- print(data)
diff --git a/archive/yaw.py b/archive/yaw.py
deleted file mode 100755
index 2363a47..0000000
--- a/archive/yaw.py
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/usr/bin/env python
-#credits : http://forum.arduino.cc/index.php/topic,8573.0.html
-
-import rospy
-import socket
-import tf
-from sensor_msgs.msg import Imu
-from geometry_msgs.msg import Vector3
-from math import sqrt,atan2,cos,sin,pi
-
-def imu_publisher(sock):
- host="192.168.42.185"
- port=5555
- yaw_offset = 0.0
- roll_offset = 0.0
- pitch_offset = 0.0
- pub_freq = 10
- alpha = 0.9
- count = 0
- num_callibration_itrs = 60
- debug = False
-
- pub = rospy.Publisher('imu', Imu, queue_size=50)
- rpy_pub = rospy.Publisher('rpy', Vector3, queue_size=50)
-
- rospy.init_node('imu_publisher', anonymous=True)
- rate = rospy.Rate(pub_freq)
- if rospy.has_param('~num_callibration_itrs'):
- num_callibration_itrs = rospy.get_param('~num_callibration_itrs')
- if rospy.has_param('~host'):
- host = rospy.get_param('~host')
- if rospy.has_param('~debug'):
- debug = rospy.get_param('~debug')
-
- sock.bind((host,port))
-
- current_time = rospy.Time.now()
- last_time = rospy.Time.now()
-
- rospy.loginfo("waiting for device...")
- while not rospy.is_shutdown():
- data,addr = sock.recvfrom(1024)
- line = data.split(',')
- if len(line) == 4: #received complete packet
- current_time = rospy.Time.now()
- yaw = float(line[0])
- roll = float(line[1])
- pitch = float(line[2])
- if count < num_callibration_itrs:
- yaw_offset += yaw
- roll_offset += roll
- pitch_offset += pitch
- count += 1
- elif count == num_callibration_itrs:
- yaw_offset /= num_callibration_itrs
- roll_offset /= num_callibration_itrs
- pitch_offset /= num_callibration_itrs
- rospy.loginfo("finished callibrating yaw")
- count += 1
-
- #publish ros Imu message
- else:
- yaw -= yaw_offset
- roll -= roll_offset
- pitch -= pitch_offset
- if yaw > pi:
- yaw -= 2*pi
- if yaw < -pi:
- yaw += 2*pi
- if roll > pi:
- roll -= 2*pi
- if roll < -pi:
- roll += 2*pi
- if pitch > pi:
- pitch -= 2*pi
- if pitch < -pi:
- pitch += 2*pi
- if debug:
- rospy.loginfo('roll %s pitch %s yaw %s', int(roll), int(pitch), int(yaw))
- imu_msg = Imu()
- imu_msg.header.stamp = rospy.Time.now()
- imu_msg.header.frame_id = '/base_link'
- q = tf.transformations.quaternion_from_euler(0.0, 0.0, yaw)
- imu_msg.orientation.x = q[0]
- imu_msg.orientation.y = q[1]
- imu_msg.orientation.z = q[2]
- imu_msg.orientation.w = q[3]
- #imu_msg.orientation_covariance = [1e6, 0, 0, 0, 1e6, 0, 0, 0, 1e-6]
- imu_msg.angular_velocity_covariance[0] = -1
- imu_msg.linear_acceleration_covariance[0] = -1
- pub.publish(imu_msg)
- rpy_msg = Vector3()
- rpy_msg.x = roll
- rpy_msg.y = pitch
- rpy_msg.z = yaw
- rpy_pub.publish(rpy_msg)
- last_time = current_time
- #rate.sleep()
- else:
- rospy.loginfo("received incomplete UDP packet from android IMU")
- continue
-
-
-if __name__ == '__main__':
- try:
- sock=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
- imu_publisher(sock)
- except rospy.ROSInterruptException:
- pass
diff --git a/arduino/motor_controller/motor_controller.ino b/arduino/motor_controller/motor_controller.ino
deleted file mode 100755
index 0bf63a5..0000000
--- a/arduino/motor_controller/motor_controller.ino
+++ /dev/null
@@ -1,249 +0,0 @@
-#if (ARDUINO >= 100)
- #include
-#else
- #include
-#endif
-#include
-#include
-#include
-#include
-
-#define RH_ENCODER_A 3
-#define RH_ENCODER_B 5
-#define LH_ENCODER_A 4
-#define LH_ENCODER_B 2
-
-#define RH_Directionf 6
-#define RH_Directionb 7
-#define LH_Directionf 8
-#define LH_Directionb 11
-#define RH_Pwm 10
-#define LH_Pwm 9
-#define LOOPTIME 100 // PID loop time(ms)
-#define SMOOTH 10
-
-// variables to store the number of encoder pulses
-// for each motor
-volatile double leftCount = 0;
-volatile double rightCount = 0;
-volatile double prev, now ,start, time_delay =0, counter=0, prev_rotR, prev_rotL, cur_rotR, cur_rotL;
-volatile double error_l = 0, last_error1_l = 0 ;
-volatile double error_r = 0, last_error1_r = 0 ;
-volatile double int_errorl;
-volatile double int_errorr;
-unsigned long lastMilli = 0; // loop timing
-unsigned long lastMilliPub = 0;
-double Required_rpml = 0;
-double Required_rpmr = 0;
-double RPM_left = 0;
-double RPM_right = 0;
-double Required_rpml_smoothed = 0;
-double Required_rpmr_smoothed = 0;
-char direction1 ;
-char direction2 ;
-int PWM_val1 = 0;
-int PWM_val2 = 0;
-float Kp = 150;
-float Kd = 70;
-float Ki = 40;
-
-ros::NodeHandle nh;
-
-void handle_cmd( const geometry_msgs::Twist& cmd_msg)
-{
- double x = cmd_msg.linear.x;
- double z = cmd_msg.angular.z;
- if (z == 0) { // go straight
- // convert m/s to rpm
- Required_rpml = x*60/(0.3454); ///x < .157
- Required_rpmr = Required_rpml;
- }
- else if (x == 0) {
- // convert rad/s to rpm
- Required_rpmr = z*0.55*60/(0.3454*2);///z < .307
- Required_rpml = -Required_rpmr;
- }
- else {
- Required_rpml = x*60/(0.3454)-z*0.55*60/(0.3454*2);
- Required_rpmr = x*60/(0.3454)+z*0.55*60/(0.354*2);
- }
- int_errorr = 0;
- int_errorl = 0;
-}
-
-ros::Subscriber sub("cmd_vel", handle_cmd);
-geometry_msgs::Vector3Stamped rpm_msg;
-ros::Publisher rpm_pub("rpm", &rpm_msg);
-ros::Time current_time;
-ros::Time last_time;
-
-void setup()
-{
- Required_rpml = 0;
- Required_rpmr = 0;
- RPM_left = 0;
- RPM_right = 0;
- PWM_val1 = 0;
- PWM_val2 = 0;
- nh.initNode();
- nh.getHardware()->setBaud(57600);
- nh.subscribe(sub);
- nh.advertise(rpm_pub);
-
- pinMode(LH_ENCODER_A, INPUT);
- pinMode(LH_ENCODER_B, INPUT);
- pinMode(RH_ENCODER_A, INPUT);
- pinMode(RH_ENCODER_B, INPUT);
-
- pinMode(RH_Directionf, OUTPUT);
- pinMode(RH_Directionb, OUTPUT);
- pinMode(LH_Directionf, OUTPUT);
- pinMode(LH_Directionb, OUTPUT);
- pinMode(RH_Pwm, OUTPUT);
- pinMode(LH_Pwm, OUTPUT);
-
- // initialize hardware interrupts
- attachInterrupt(0, leftEncoderEvent, CHANGE);
- attachInterrupt(1, rightEncoderEvent, CHANGE);
-
- prev_rotR = 0;
- prev_rotL = 0;
- prev = 0;
-}
-
-void loop()
-{
- nh.spinOnce();
- unsigned long time = millis();
- if(time-lastMilli>= LOOPTIME)
- { // enter tmed loop
- time_delay = time - prev;
- cur_rotR = rightCount/5000;
- cur_rotL = leftCount/5000 ;
- RPM_left = (cur_rotR - prev_rotR)*622;
- RPM_right = (cur_rotL - prev_rotL)*622;
-
- prev_rotR = cur_rotR;
- prev_rotL = cur_rotL;
-
- error_l = - RPM_left + Required_rpml;
- int_errorl+= error_l;
- int Value_l = Value_l + 255*((Kp*error_l + Kd*(error_l-last_error1_l)) + Ki*(int_errorl))/(Kp*200 + Kd*400 );
- last_error1_l = error_l;
- PWM_val1 = Value_l;
- Serial.print(RPM_left);
- Serial.print(" ");
-
-
- error_r = - RPM_right + Required_rpmr;
- int_errorr+= error_r;
- int Value_r = Value_r + 255*((Kp*error_r + Kd*(error_r-last_error1_r)) + Ki*(int_errorr))/(Kp*200 + Kd*400);
- last_error1_r = error_r;
- PWM_val2 = Value_r;
- Serial.println(RPM_right);
-
-
-
- if(PWM_val1 > 0) direction1 = 'f';
- else if(PWM_val1 < 0) direction1 = 'b';
- if (Required_rpml == 0) direction1 = 's';
- if(PWM_val2 > 0) direction2 = 'f';
- else if(PWM_val2 < 0) direction2 = 'b';
- if (Required_rpmr == 0) direction2 = 's';
-
- PWM_val1 = abs(PWM_val1);
- PWM_val2 = abs(PWM_val2);
-
- if ( direction1 == 'f')
- {
- digitalWrite(LH_Directionf, HIGH);
- digitalWrite(LH_Directionb, LOW);
- analogWrite(LH_Pwm, PWM_val1);
- }
- else if( direction1 == 'b')
- {
- digitalWrite(LH_Directionf, LOW);
- digitalWrite(LH_Directionb, HIGH);
- analogWrite(LH_Pwm, PWM_val1);
-
- }
- else if(direction1 == 's')
- {
- digitalWrite(LH_Directionf, LOW);
- digitalWrite(LH_Directionb, LOW);
- analogWrite(LH_Pwm, PWM_val1);
- }
-
- if ( direction2 == 'f')
- {
- digitalWrite(RH_Directionf, HIGH);
- digitalWrite(RH_Directionb, LOW);
- analogWrite(RH_Pwm, PWM_val2);
- }
- else if( direction2 == 'b')
- {
- digitalWrite(RH_Directionf, LOW);
- digitalWrite(RH_Directionb, HIGH);
- analogWrite(RH_Pwm, PWM_val2);
- }
- else if(direction2 == 's')
- {
- digitalWrite(RH_Directionf, LOW);
- digitalWrite(RH_Directionb, LOW);
- analogWrite(RH_Pwm, PWM_val2);
- }
-
- publishRPM(time-lastMilli);
- lastMilli = time;
- }
- if(time-lastMilliPub >= LOOPTIME)
- {
- // publishRPM(time-lastMilliPub);
- lastMilliPub = time;
- }
-}
-
-void publishRPM(unsigned long time)
-{
- rpm_msg.header.stamp = nh.now();
- rpm_msg.vector.x = RPM_left;
- rpm_msg.vector.y = RPM_right;
- rpm_msg.vector.z = double(time)/1000;
- rpm_pub.publish(&rpm_msg);
- nh.spinOnce();
-}
-
-void leftEncoderEvent()
- {
- if (digitalRead(LH_ENCODER_A) == HIGH) {
- if (digitalRead(LH_ENCODER_B) == LOW) {
- leftCount++;
- } else {
- leftCount--;
- }
- } else {
- if (digitalRead(LH_ENCODER_B) == LOW) {
- leftCount--;
- } else {
- leftCount++;
- }
- }
-}
-
-// encoder event for the interrupt call
-void rightEncoderEvent()
-{
- if (digitalRead(RH_ENCODER_A) == HIGH) {
- if (digitalRead(RH_ENCODER_B) == LOW) {
- rightCount++;
- } else {
- rightCount--;
- }
- } else {
- if (digitalRead(RH_ENCODER_B) == LOW) {
- rightCount--;
- } else {
- rightCount++;
- }
- }
-}
diff --git a/arduino/motor_controller/robot_specs.h b/arduino/motor_controller/robot_specs.h
deleted file mode 100755
index 353c2b6..0000000
--- a/arduino/motor_controller/robot_specs.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef ROBOT_SPECS_H
-#define ROBOT_SPECS_H
-
-#define encoder_pulse 13//
-#define gear_ratio 60//
-#define wheel_diameter 0.11 //m
-#define wheel_width 0.04 //m
-#define track_width 0.55 //m
-#define MAX_RPM 60//
-#define pi 3.1415926
-#define two_pi 6.2831853
-#endif
diff --git a/assets/banner.png b/assets/banner.png
new file mode 100644
index 0000000..98fd500
Binary files /dev/null and b/assets/banner.png differ
diff --git a/communication/angle.py b/communication/angle.py
deleted file mode 100755
index 47e1893..0000000
--- a/communication/angle.py
+++ /dev/null
@@ -1,18 +0,0 @@
-import socket
-
-host="192.168.43.103"
-port=2055
-
-sock=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
-sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
-sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
-
-sock.bind((host,port))
-
-while True:
- data,addr = sock.recvfrom(1024)
- data = data.decode('utf-8')
- data = str(data)
- values = data.split(',')
-
- print(values[0])
diff --git a/communication/detect_devices.py b/communication/detect_devices.py
deleted file mode 100755
index e4d5996..0000000
--- a/communication/detect_devices.py
+++ /dev/null
@@ -1,14 +0,0 @@
-import bluetooth
-
-print("performing inquiry...")
-
-nearby_devices = bluetooth.discover_devices(
- duration=8, lookup_names=True, flush_cache=True, lookup_class=False)
-
-print("found %d devices" % len(nearby_devices))
-
-for addr, name in nearby_devices:
- try:
- print(" %s - %s" % (addr, name))
- except UnicodeEncodeError:
- print(" %s - %s" % (addr, name.encode('utf-8', 'replace')))
\ No newline at end of file
diff --git a/communication/find_connections.py b/communication/find_connections.py
deleted file mode 100755
index 6a0d206..0000000
--- a/communication/find_connections.py
+++ /dev/null
@@ -1,9 +0,0 @@
-import os
-import sys
-import struct
-import bluetooth
-
-
-if __name__ == "__main__":
- bdaddr = bluetooth.read_local_bdaddr()
-print(bdaddr)
\ No newline at end of file
diff --git a/communication/rfcomm_client.py b/communication/rfcomm_client.py
deleted file mode 100755
index b6d40f2..0000000
--- a/communication/rfcomm_client.py
+++ /dev/null
@@ -1,41 +0,0 @@
-from bluetooth import *
-import sys
-
-if sys.version < '3':
- input = raw_input
-
-addr = None
-
-if len(sys.argv) < 2:
- print("no device specified. Searching all nearby bluetooth devices for")
- print("the SampleServer service")
-else:
- addr = sys.argv[1]
- print("Searching for SampleServer on %s" % addr)
-
-# search for the SampleServer service
-uuid = "94f39d29-7d6d-437d-973b-fba39e49d4ee"
-service_matches = find_service( uuid = uuid, address = addr )
-
-if len(service_matches) == 0:
- print("couldn't find the SampleServer service =(")
- sys.exit(0)
-
-first_match = service_matches[0]
-port = first_match["port"]
-name = first_match["name"]
-host = first_match["host"]
-
-print("connecting to \"%s\" on %s" % (name, host))
-
-# Create the client socket
-sock=BluetoothSocket( RFCOMM )
-sock.connect((host, port))
-
-print("connected. type stuff")
-while True:
- data = input()
- if len(data) == 0: break
- sock.send(data)
-
-sock.close()
\ No newline at end of file
diff --git a/communication/rfcomm_server.py b/communication/rfcomm_server.py
deleted file mode 100755
index eef6c3e..0000000
--- a/communication/rfcomm_server.py
+++ /dev/null
@@ -1,35 +0,0 @@
-from bluetooth import *
-
-server_sock=BluetoothSocket( RFCOMM )
-server_sock.bind(("",PORT_ANY))
-server_sock.listen(1)
-
-port = server_sock.getsockname()[1]
-
-uuid = "00001101-0000-1000-8000-00805F9B34FB"
-
-advertise_service( server_sock, "SampleServer",
- service_id = uuid,
- service_classes = [ uuid, SERIAL_PORT_CLASS ],
- profiles = [ SERIAL_PORT_PROFILE ],
-# protocols = [ OBEX_UUID ]
- )
-
-print("Waiting for connection on RFCOMM channel %d" % port)
-
-client_sock, client_info = server_sock.accept()
-print("Accepted connection from ", client_info)
-
-try:
- while True:
- data = client_sock.recv(1024)
- if len(data) == 0: break
- print("received [%s]" % data)
-except IOError:
- pass
-
-print("disconnected")
-
-client_sock.close()
-server_sock.close()
-print("all done")
\ No newline at end of file
diff --git a/communication/socket_recieve_server.py b/communication/socket_recieve_server.py
deleted file mode 100755
index 5992bd3..0000000
--- a/communication/socket_recieve_server.py
+++ /dev/null
@@ -1,48 +0,0 @@
-import socket
-
-#host= "10.1.82.48"
-host= "192.168.43.103"
-#host= "10.1.76.196"
-
-port=8006
-data = None
-conn = None
-
-sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
-sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
-sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
-
-sock.bind((host,port))
-sock.listen(10)
-
-print(host,port)
-
-conn, addr = sock.accept()
-print(conn, addr)
-#conn.sendall('hello \n')
-#conn.sendall('hello \n')
-
-#conn.sendall(b'hello')
-#sock.send(b'hello')
-
-while True:
- #data = sock.recvfrom(1024)
- data = conn.recv(1024)
- #data = sock.recv(1024)
- #data = data.decode('utf-8')
- data = str(data)
- values = data.split(' ')
- #print(values[3], len(data))
- a = values[0]
- b = values[1]
- c = values[2]
- d = values[3]
-
- #if conn is not None:
- # print("in")
- # conn.send('hello')
-
- #if data is not None:
- # conn.send("recieved")
-
-sock.close()
diff --git a/depthimage_to_laserscan/CHANGELOG.rst b/depthimage_to_laserscan/CHANGELOG.rst
deleted file mode 100755
index ebd85c0..0000000
--- a/depthimage_to_laserscan/CHANGELOG.rst
+++ /dev/null
@@ -1,60 +0,0 @@
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Changelog for package depthimage_to_laserscan
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-1.0.7 (2014-06-16)
-------------------
-* Merge pull request `#11 `_ from ros-perception/hydro-devel
- Update indigo devel with angle fix
-* Merge pull request `#8 `_ from vliedel/hydro-devel
- fixed angle_increment
-* fixed angle_increment
-* Merge pull request `#7 `_ from bulwahn/hydro-devel
- check for CATKIN_ENABLE_TESTING
-* check for CATKIN_ENABLE_TESTING
-* Added ARCHIVE DESTINATION
-* Contributors: Chad Rockey, Lukas Bulwahn, vliedel
-
-1.0.6 (2013-10-31)
-------------------
-* Removed y component from projected beam radius.
-
-1.0.5 (2013-08-21)
-------------------
-* No more Willow Garage email.
-* Merge pull request `#4 `_ from ericperko/groovy-devel
- Cleaned up CMakeLists a bit
-* Cleaned up CMakeLists a bit
-
-1.0.4 (2013-01-22)
-------------------
-* Update version to 1.0.4
-* Merge pull request `#3 `_ from ahendrix/fix_testdeps
- Fix testdeps
-* Removed redundant test-depends.
-* Remove old makefile.
-
-1.0.3 (2012-12-23)
-------------------
-* fix exported libraries (fix `#2 `_)
-
-1.0.2 (2012-12-19)
-------------------
-* fix dyn reconf
-* Updated description.
-* Updated readme to link to wiki.
-
-1.0.1 (2012-12-14)
-------------------
-* Update package.xml
- New release for missing catkin build_depend.
-* Merge pull request `#1 `_ from ablasdel/groovy-devel
- updated catkin buildtool_depend
-* updated catkin buildtool_depend
-
-1.0.0 (2012-12-05)
-------------------
-* Cleanup of the CMakeLists.txt
-* First attempt at Catkinizing.
-* Pushing fuerte-devel to github.
-* Initial commit
diff --git a/depthimage_to_laserscan/CMakeLists.txt b/depthimage_to_laserscan/CMakeLists.txt
deleted file mode 100755
index a76b054..0000000
--- a/depthimage_to_laserscan/CMakeLists.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-# http://ros.org/doc/groovy/api/catkin/html/user_guide/supposed.html
-cmake_minimum_required(VERSION 2.8)
-project(depthimage_to_laserscan)
-
-# Load catkin and all dependencies required for this package
-find_package(catkin REQUIRED dynamic_reconfigure image_geometry image_transport nodelet roscpp sensor_msgs)
-#find_package(OpenCV REQUIRED)
-
-# Dynamic reconfigure support
-generate_dynamic_reconfigure_options(cfg/Depth.cfg)
-
-catkin_package(
- INCLUDE_DIRS include
- LIBRARIES DepthImageToLaserScan DepthImageToLaserScanROS DepthImageToLaserScanNodelet
- CATKIN_DEPENDS dynamic_reconfigure image_geometry image_transport nodelet roscpp sensor_msgs
-)
-
-include_directories(include ${catkin_INCLUDE_DIRS})
-
-add_library(DepthImageToLaserScan src/DepthImageToLaserScan.cpp)
-target_link_libraries(DepthImageToLaserScan ${catkin_LIBRARIES})
-
-add_library(DepthImageToLaserScanROS src/DepthImageToLaserScanROS.cpp)
-add_dependencies(DepthImageToLaserScanROS ${PROJECT_NAME}_gencfg)
-target_link_libraries(DepthImageToLaserScanROS DepthImageToLaserScan ${catkin_LIBRARIES})
-
-add_library(DepthImageToLaserScanNodelet src/DepthImageToLaserScanNodelet.cpp)
-target_link_libraries(DepthImageToLaserScanNodelet DepthImageToLaserScanROS ${catkin_LIBRARIES})
-
-add_executable(depthimage_to_laserscan src/depthimage_to_laserscan.cpp)
-target_link_libraries(depthimage_to_laserscan DepthImageToLaserScanROS ${catkin_LIBRARIES})
-
-if(CATKIN_ENABLE_TESTING)
- # Test the library
- catkin_add_gtest(libtest test/DepthImageToLaserScanTest.cpp)
- target_link_libraries(libtest DepthImageToLaserScan ${catkin_LIBRARIES})
-endif()
-
-# add the test executable, keep it from being built by "make all"
-add_executable(test_dtl EXCLUDE_FROM_ALL test/depthimage_to_laserscan_rostest.cpp)
-
-# Install targets
-install(TARGETS DepthImageToLaserScan DepthImageToLaserScanROS DepthImageToLaserScanNodelet depthimage_to_laserscan
- RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
- LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
-
-install(DIRECTORY include/${PROJECT_NAME}/
- DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
-)
-install(FILES nodelets.xml
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
-)
diff --git a/depthimage_to_laserscan/README.md b/depthimage_to_laserscan/README.md
deleted file mode 100755
index 5267491..0000000
--- a/depthimage_to_laserscan/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-depthimage_to_laserscan
-=======================
-
-Converts a depth image to a laser scan for use with navigation and localization.
-
-ROS Wiki Page:
-http://www.ros.org/wiki/depthimage_to_laserscan
diff --git a/depthimage_to_laserscan/cfg/Depth.cfg b/depthimage_to_laserscan/cfg/Depth.cfg
deleted file mode 100755
index 127c704..0000000
--- a/depthimage_to_laserscan/cfg/Depth.cfg
+++ /dev/null
@@ -1,17 +0,0 @@
-#! /usr/bin/env python
-
-PACKAGE='depthimage_to_laserscan'
-
-from dynamic_reconfigure.parameter_generator_catkin import *
-
-from math import pi
-
-gen = ParameterGenerator()
-# Name Type Reconfiguration level Description Default Min Max
-gen.add("scan_height", int_t, 0, "Height of the laser band (in pixels).", 1, 1, 500)
-gen.add("scan_time", double_t, 0, "Time for the entire scan sweep.", 0.033, 0.0, 1.0)
-gen.add("range_min", double_t, 0, "Minimum reported range (in meters).", 0.45, 0.0, 10.0)
-gen.add("range_max", double_t, 0, "Maximum reported range (in meters).", 10.0, 0.0, 10.0)
-gen.add("output_frame_id", str_t, 0, "Output frame_id for the laserscan.", "camera_depth_frame")
-
-exit(gen.generate(PACKAGE, "depthimage_to_laserscan", "Depth"))
\ No newline at end of file
diff --git a/depthimage_to_laserscan/include/depthimage_to_laserscan/DepthImageToLaserScan.h b/depthimage_to_laserscan/include/depthimage_to_laserscan/DepthImageToLaserScan.h
deleted file mode 100755
index e2921f7..0000000
--- a/depthimage_to_laserscan/include/depthimage_to_laserscan/DepthImageToLaserScan.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (c) 2012, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Author: Chad Rockey
- */
-
-#ifndef DEPTH_IMAGE_TO_LASERSCAN
-#define DEPTH_IMAGE_TO_LASERSCAN
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace depthimage_to_laserscan
-{
- class DepthImageToLaserScan
- {
- public:
- DepthImageToLaserScan();
- ~DepthImageToLaserScan();
-
- /**
- * Converts the information in a depth image (sensor_msgs::Image) to a sensor_msgs::LaserScan.
- *
- * This function converts the information in the depth encoded image (UInt16 or Float32 encoding) into
- * a sensor_msgs::LaserScan as accurately as possible. To do this, it requires the synchornized Image/CameraInfo
- * pair associated with the image.
- *
- * @param depth_msg UInt16 or Float32 encoded depth image.
- * @param info_msg CameraInfo associated with depth_msg
- * @return sensor_msgs::LaserScanPtr for the center row(s) of the depth image.
- *
- */
- sensor_msgs::LaserScanPtr convert_msg(const sensor_msgs::ImageConstPtr& depth_msg,
- const sensor_msgs::CameraInfoConstPtr& info_msg);
-
- /**
- * Sets the scan time parameter.
- *
- * This function stores the desired value for scan_time. In sensor_msgs::LaserScan, scan_time is defined as
- * "time between scans [seconds]". This value is not easily calculated from consquetive messages, and is thus
- * left to the user to set correctly.
- *
- * @param scan_time The value to use for outgoing sensor_msgs::LaserScan.
- *
- */
- void set_scan_time(const float scan_time);
-
- /**
- * Sets the minimum and maximum range for the sensor_msgs::LaserScan.
- *
- * range_min is used to determine how close of a value to allow through when multiple radii correspond to the same
- * angular increment. range_max is used to set the output message.
- *
- * @param range_min Minimum range to assign points to the laserscan, also minimum range to use points in the output scan.
- * @param range_max Maximum range to use points in the output scan.
- *
- */
- void set_range_limits(const float range_min, const float range_max);
-
- /**
- * Sets the number of image rows to use in the output LaserScan.
- *
- * scan_height is the number of rows (pixels) to use in the output. This will provide scan_height number of radii for each
- * angular increment. The output scan will output the closest radius that is still not smaller than range_min. This function
- * can be used to vertically compress obstacles into a single LaserScan.
- *
- * @param scan_height Number of pixels centered around the center of the image to compress into the LaserScan.
- *
- */
- void set_scan_height(const int scan_height);
-
- /**
- * Sets the frame_id for the output LaserScan.
- *
- * Output frame_id for the LaserScan. Will probably NOT be the same frame_id as the depth image.
- * Example: For OpenNI cameras, this should be set to 'camera_depth_frame' while the camera uses 'camera_depth_optical_frame'.
- *
- * @param output_frame_id Frame_id to use for the output sensor_msgs::LaserScan.
- *
- */
- void set_output_frame(const std::string output_frame_id);
-
- private:
- /**
- * Computes euclidean length of a cv::Point3d (as a ray from origin)
- *
- * This function computes the length of a cv::Point3d assumed to be a vector starting at the origin (0,0,0).
- *
- * @param ray The ray for which the magnitude is desired.
- * @return Returns the magnitude of the ray.
- *
- */
- double magnitude_of_ray(const cv::Point3d& ray) const;
-
- /**
- * Computes the angle between two cv::Point3d
- *
- * Computes the angle of two cv::Point3d assumed to be vectors starting at the origin (0,0,0).
- * Uses the following equation: angle = arccos(a*b/(|a||b|)) where a = ray1 and b = ray2.
- *
- * @param ray1 The first ray
- * @param ray2 The second ray
- * @return The angle between the two rays (in radians)
- *
- */
- double angle_between_rays(const cv::Point3d& ray1, const cv::Point3d& ray2) const;
-
- /**
- * Determines whether or not new_value should replace old_value in the LaserScan.
- *
- * Uses the values of range_min, and range_max to determine if new_value is a valid point. Then it determines if
- * new_value is 'more ideal' (currently shorter range) than old_value.
- *
- * @param new_value The current calculated range.
- * @param old_value The current range in the output LaserScan.
- * @param range_min The minimum acceptable range for the output LaserScan.
- * @param range_max The maximum acceptable range for the output LaserScan.
- * @return If true, insert new_value into the output LaserScan.
- *
- */
- bool use_point(const float new_value, const float old_value, const float range_min, const float range_max) const;
-
- /**
- * Converts the depth image to a laserscan using the DepthTraits to assist.
- *
- * This uses a method to inverse project each pixel into a LaserScan angular increment. This method first projects the pixel
- * forward into Cartesian coordinates, then calculates the range and angle for this point. When multiple points coorespond to
- * a specific angular measurement, then the shortest range is used.
- *
- * @param depth_msg The UInt16 or Float32 encoded depth message.
- * @param cam_model The image_geometry camera model for this image.
- * @param scan_msg The output LaserScan.
- * @param scan_height The number of vertical pixels to feed into each angular_measurement.
- *
- */
- template
- void convert(const sensor_msgs::ImageConstPtr& depth_msg, const image_geometry::PinholeCameraModel& cam_model,
- const sensor_msgs::LaserScanPtr& scan_msg, const int& scan_height) const{
- // Use correct principal point from calibration
- float center_x = cam_model.cx();
- float center_y = cam_model.cy();
-
- // Combine unit conversion (if necessary) with scaling by focal length for computing (X,Y)
- double unit_scaling = depthimage_to_laserscan::DepthTraits::toMeters( T(1) );
- float constant_x = unit_scaling / cam_model.fx();
- float constant_y = unit_scaling / cam_model.fy();
-
- const T* depth_row = reinterpret_cast(&depth_msg->data[0]);
- int row_step = depth_msg->step / sizeof(T);
-
- int offset = (int)(cam_model.cy()-scan_height/2);
- depth_row += offset*row_step; // Offset to center of image
-
- for(int v = offset; v < offset+scan_height_; v++, depth_row += row_step){
- for (int u = 0; u < (int)depth_msg->width; u++) // Loop over each pixel in row
- {
- T depth = depth_row[u];
-
- double r = depth; // Assign to pass through NaNs and Infs
- double th = -atan2((double)(u - center_x) * constant_x, unit_scaling); // Atan2(x, z), but depth divides out
- int index = (th - scan_msg->angle_min) / scan_msg->angle_increment;
-
- if (depthimage_to_laserscan::DepthTraits::valid(depth)){ // Not NaN or Inf
- // Calculate in XYZ
- double x = (u - center_x) * depth * constant_x;
- double z = depthimage_to_laserscan::DepthTraits::toMeters(depth);
-
- // Calculate actual distance
- r = sqrt(pow(x, 2.0) + pow(z, 2.0));
- }
-
- // Determine if this point should be used.
- if(use_point(r, scan_msg->ranges[index], scan_msg->range_min, scan_msg->range_max)){
- scan_msg->ranges[index] = r;
- }
- }
- }
- }
-
- image_geometry::PinholeCameraModel cam_model_; ///< image_geometry helper class for managing sensor_msgs/CameraInfo messages.
-
- float scan_time_; ///< Stores the time between scans.
- float range_min_; ///< Stores the current minimum range to use.
- float range_max_; ///< Stores the current maximum range to use.
- int scan_height_; ///< Number of pixel rows to use when producing a laserscan from an area.
- std::string output_frame_id_; ///< Output frame_id for each laserscan. This is likely NOT the camera's frame_id.
- };
-
-
-}; // depthimage_to_laserscan
-
-#endif
\ No newline at end of file
diff --git a/depthimage_to_laserscan/include/depthimage_to_laserscan/DepthImageToLaserScanROS.h b/depthimage_to_laserscan/include/depthimage_to_laserscan/DepthImageToLaserScanROS.h
deleted file mode 100755
index fc402ff..0000000
--- a/depthimage_to_laserscan/include/depthimage_to_laserscan/DepthImageToLaserScanROS.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2012, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Author: Chad Rockey
- */
-
-#ifndef DEPTH_IMAGE_TO_LASERSCAN_ROS
-#define DEPTH_IMAGE_TO_LASERSCAN_ROS
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-namespace depthimage_to_laserscan
-{
- class DepthImageToLaserScanROS
- {
- public:
- DepthImageToLaserScanROS(ros::NodeHandle& n, ros::NodeHandle& pnh);
-
- ~DepthImageToLaserScanROS();
-
- private:
- /**
- * Callback for image_transport
- *
- * Synchronized callback for depth image and camera info. Publishes laserscan at the end of this callback.
- *
- * @param depth_msg Image provided by image_transport.
- * @param info_msg CameraInfo provided by image_transport.
- *
- */
- void depthCb(const sensor_msgs::ImageConstPtr& depth_msg,
- const sensor_msgs::CameraInfoConstPtr& info_msg);
-
- /**
- * Callback that is called when there is a new subscriber.
- *
- * Will not subscribe to the image and camera_info until we have a subscriber for our LaserScan (lazy subscribing).
- *
- */
- void connectCb(const ros::SingleSubscriberPublisher& pub);
-
- /**
- * Callback called when a subscriber unsubscribes.
- *
- * If all current subscribers of our LaserScan stop listening, stop subscribing (lazy subscribing).
- *
- */
- void disconnectCb(const ros::SingleSubscriberPublisher& pub);
-
- /**
- * Dynamic reconfigure callback.
- *
- * Callback that is used to set each of the parameters insde the DepthImageToLaserScan object.
- *
- * @param config Dynamic Reconfigure object.
- * @param level Dynamic Reconfigure level.
- *
- */
- void reconfigureCb(depthimage_to_laserscan::DepthConfig& config, uint32_t level);
-
- ros::NodeHandle pnh_; ///< Private nodehandle used to generate the transport hints in the connectCb.
- image_transport::ImageTransport it_; ///< Subscribes to synchronized Image CameraInfo pairs.
- image_transport::CameraSubscriber sub_; ///< Subscriber for image_transport
- ros::Publisher pub_; ///< Publisher for output LaserScan messages
- dynamic_reconfigure::Server srv_; ///< Dynamic reconfigure server
-
- depthimage_to_laserscan::DepthImageToLaserScan dtl_; ///< Instance of the DepthImageToLaserScan conversion class.
-
- boost::mutex connect_mutex_; ///< Prevents the connectCb and disconnectCb from being called until everything is initialized.
- };
-
-
-}; // depthimage_to_laserscan
-
-#endif
\ No newline at end of file
diff --git a/depthimage_to_laserscan/include/depthimage_to_laserscan/depth_traits.h b/depthimage_to_laserscan/include/depthimage_to_laserscan/depth_traits.h
deleted file mode 100755
index beea1a7..0000000
--- a/depthimage_to_laserscan/include/depthimage_to_laserscan/depth_traits.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2012, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Author: Chad Rockey
- */
-
-#ifndef DEPTH_IMAGE_TO_LASERSCAN_DEPTH_TRAITS
-#define DEPTH_IMAGE_TO_LASERSCAN_DEPTH_TRAITS
-
-#include
-#include
-
-namespace depthimage_to_laserscan {
-
-// Encapsulate differences between processing float and uint16_t depths
-template struct DepthTraits {};
-
-template<>
-struct DepthTraits
-{
- static inline bool valid(uint16_t depth) { return depth != 0; }
- static inline float toMeters(uint16_t depth) { return depth * 0.001f; } // originally mm
- static inline uint16_t fromMeters(float depth) { return (depth * 1000.0f) + 0.5f; }
- static inline void initializeBuffer(std::vector& buffer) {} // Do nothing - already zero-filled
-};
-
-template<>
-struct DepthTraits
-{
- static inline bool valid(float depth) { return std::isfinite(depth); }
- static inline float toMeters(float depth) { return depth; }
- static inline float fromMeters(float depth) { return depth; }
-
- static inline void initializeBuffer(std::vector& buffer)
- {
- float* start = reinterpret_cast(&buffer[0]);
- float* end = reinterpret_cast(&buffer[0] + buffer.size());
- std::fill(start, end, std::numeric_limits::quiet_NaN());
- }
-};
-
-} // namespace depth_image_proc
-
-#endif
\ No newline at end of file
diff --git a/depthimage_to_laserscan/mainpage.dox b/depthimage_to_laserscan/mainpage.dox
deleted file mode 100755
index bc4f97c..0000000
--- a/depthimage_to_laserscan/mainpage.dox
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
-\mainpage
-\htmlinclude manifest.html
-
-\b depthimage_to_laserscan provides an efficient method to project laserscans directly from depth images. These messages are used to run laserscan based software such as gmapping, amcl, or the navigation stack from robots with only depth cameras such as the Mircosoft Kinect or ASUS Xtion.
-
-
-*/
diff --git a/depthimage_to_laserscan/nodelets.xml b/depthimage_to_laserscan/nodelets.xml
deleted file mode 100755
index aaf9092..0000000
--- a/depthimage_to_laserscan/nodelets.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
- Nodelet to convert raw depth images to sensor_msgs/LaserScans.
-
-
-
-
diff --git a/depthimage_to_laserscan/package.xml b/depthimage_to_laserscan/package.xml
deleted file mode 100755
index af81f45..0000000
--- a/depthimage_to_laserscan/package.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
- depthimage_to_laserscan
- 1.0.7
- depthimage_to_laserscan
- Chad Rockey
-
- BSD
-
- http://ros.org/wiki/depthimage_to_laserscan
- https://github.com/ros-perception/depthimage_to_laserscan/issues
- https://github.com/ros-perception/depthimage_to_laserscan
-
- Chad Rockey
-
- catkin
-
- roscpp
- gtest
- sensor_msgs
- nodelet
- image_transport
- image_geometry
- dynamic_reconfigure
- roscpp
- sensor_msgs
- nodelet
- image_transport
- image_geometry
- dynamic_reconfigure
-
-
-
-
-
diff --git a/depthimage_to_laserscan/src/DepthImageToLaserScan.cpp b/depthimage_to_laserscan/src/DepthImageToLaserScan.cpp
deleted file mode 100755
index 6ad0487..0000000
--- a/depthimage_to_laserscan/src/DepthImageToLaserScan.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 2012, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Author: Chad Rockey
- */
-
-#include
-
-using namespace depthimage_to_laserscan;
-
-DepthImageToLaserScan::DepthImageToLaserScan(){
-}
-
-DepthImageToLaserScan::~DepthImageToLaserScan(){
-}
-
-double DepthImageToLaserScan::magnitude_of_ray(const cv::Point3d& ray) const{
- return sqrt(pow(ray.x, 2.0) + pow(ray.y, 2.0) + pow(ray.z, 2.0));
-}
-
-double DepthImageToLaserScan::angle_between_rays(const cv::Point3d& ray1, const cv::Point3d& ray2) const{
- double dot_product = ray1.x*ray2.x + ray1.y*ray2.y + ray1.z*ray2.z;
- double magnitude1 = magnitude_of_ray(ray1);
- double magnitude2 = magnitude_of_ray(ray2);;
- return acos(dot_product / (magnitude1 * magnitude2));
-}
-
-bool DepthImageToLaserScan::use_point(const float new_value, const float old_value, const float range_min, const float range_max) const{
- // Check for NaNs and Infs, a real number within our limits is more desirable than these.
- bool new_finite = std::isfinite(new_value);
- bool old_finite = std::isfinite(old_value);
-
- // Infs are preferable over NaNs (more information)
- if(!new_finite && !old_finite){ // Both are not NaN or Inf.
- if(!isnan(new_value)){ // new is not NaN, so use it's +-Inf value.
- return true;
- }
- return false; // Do not replace old_value
- }
-
- // If not in range, don't bother
- bool range_check = range_min <= new_value && new_value <= range_max;
- if(!range_check){
- return false;
- }
-
- if(!old_finite){ // New value is in range and finite, use it.
- return true;
- }
-
- // Finally, if they are both numerical and new_value is closer than old_value, use new_value.
- bool shorter_check = new_value < old_value;
- return shorter_check;
-}
-
-sensor_msgs::LaserScanPtr DepthImageToLaserScan::convert_msg(const sensor_msgs::ImageConstPtr& depth_msg,
- const sensor_msgs::CameraInfoConstPtr& info_msg){
- // Set camera model
- cam_model_.fromCameraInfo(info_msg);
-
- // Calculate angle_min and angle_max by measuring angles between the left ray, right ray, and optical center ray
- cv::Point2d raw_pixel_left(0, cam_model_.cy());
- cv::Point2d rect_pixel_left = cam_model_.rectifyPoint(raw_pixel_left);
- cv::Point3d left_ray = cam_model_.projectPixelTo3dRay(rect_pixel_left);
-
- cv::Point2d raw_pixel_right(depth_msg->width-1, cam_model_.cy());
- cv::Point2d rect_pixel_right = cam_model_.rectifyPoint(raw_pixel_right);
- cv::Point3d right_ray = cam_model_.projectPixelTo3dRay(rect_pixel_right);
-
- cv::Point2d raw_pixel_center(cam_model_.cx(), cam_model_.cy());
- cv::Point2d rect_pixel_center = cam_model_.rectifyPoint(raw_pixel_center);
- cv::Point3d center_ray = cam_model_.projectPixelTo3dRay(rect_pixel_center);
-
- double angle_max = angle_between_rays(left_ray, center_ray);
- double angle_min = -angle_between_rays(center_ray, right_ray); // Negative because the laserscan message expects an opposite rotation of that from the depth image
-
- // Fill in laserscan message
- sensor_msgs::LaserScanPtr scan_msg(new sensor_msgs::LaserScan());
- scan_msg->header = depth_msg->header;
- if(output_frame_id_.length() > 0){
- scan_msg->header.frame_id = output_frame_id_;
- }
- scan_msg->angle_min = angle_min;
- scan_msg->angle_max = angle_max;
- scan_msg->angle_increment = (scan_msg->angle_max - scan_msg->angle_min) / (depth_msg->width - 1);
- scan_msg->time_increment = 0.0;
- scan_msg->scan_time = scan_time_;
- scan_msg->range_min = range_min_;
- scan_msg->range_max = range_max_;
-
- // Check scan_height vs image_height
- if(scan_height_/2 > cam_model_.cy() || scan_height_/2 > depth_msg->height - cam_model_.cy()){
- std::stringstream ss;
- ss << "scan_height ( " << scan_height_ << " pixels) is too large for the image height.";
- throw std::runtime_error(ss.str());
- }
-
- // Calculate and fill the ranges
- uint32_t ranges_size = depth_msg->width;
- scan_msg->ranges.assign(ranges_size, std::numeric_limits::quiet_NaN());
-
- if (depth_msg->encoding == sensor_msgs::image_encodings::TYPE_16UC1)
- {
- convert(depth_msg, cam_model_, scan_msg, scan_height_);
- }
- else if (depth_msg->encoding == sensor_msgs::image_encodings::TYPE_32FC1)
- {
- convert(depth_msg, cam_model_, scan_msg, scan_height_);
- }
- else
- {
- std::stringstream ss;
- ss << "Depth image has unsupported encoding: " << depth_msg->encoding;
- throw std::runtime_error(ss.str());
- }
-
- return scan_msg;
-}
-
-void DepthImageToLaserScan::set_scan_time(const float scan_time){
- scan_time_ = scan_time;
-}
-
-void DepthImageToLaserScan::set_range_limits(const float range_min, const float range_max){
- range_min_ = range_min;
- range_max_ = range_max;
-}
-
-void DepthImageToLaserScan::set_scan_height(const int scan_height){
- scan_height_ = scan_height;
-}
-
-void DepthImageToLaserScan::set_output_frame(const std::string output_frame_id){
- output_frame_id_ = output_frame_id;
-}
diff --git a/depthimage_to_laserscan/src/DepthImageToLaserScanNodelet.cpp b/depthimage_to_laserscan/src/DepthImageToLaserScanNodelet.cpp
deleted file mode 100755
index 1e51c16..0000000
--- a/depthimage_to_laserscan/src/DepthImageToLaserScanNodelet.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2012, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Author: Chad Rockey
- */
-
-#include
-#include
-
-
-namespace depthimage_to_laserscan
-{
-
-class DepthImageToLaserScanNodelet : public nodelet::Nodelet
-{
-public:
- DepthImageToLaserScanNodelet() {};
-
- ~DepthImageToLaserScanNodelet() {}
-
-private:
- virtual void onInit()
- {
- dtl.reset(new DepthImageToLaserScanROS(getNodeHandle(), getPrivateNodeHandle()));
- };
-
- boost::shared_ptr dtl;
-};
-
-}
-
-#include
-PLUGINLIB_DECLARE_CLASS(depthimage_to_laserscan, DepthImageToLaserScanNodelet, depthimage_to_laserscan::DepthImageToLaserScanNodelet, nodelet::Nodelet);
-
diff --git a/depthimage_to_laserscan/src/DepthImageToLaserScanROS.cpp b/depthimage_to_laserscan/src/DepthImageToLaserScanROS.cpp
deleted file mode 100755
index fe915c7..0000000
--- a/depthimage_to_laserscan/src/DepthImageToLaserScanROS.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2012, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Author: Chad Rockey
- */
-
-#include
-
-using namespace depthimage_to_laserscan;
-
-DepthImageToLaserScanROS::DepthImageToLaserScanROS(ros::NodeHandle& n, ros::NodeHandle& pnh):pnh_(pnh), it_(n), srv_(pnh) {
- boost::mutex::scoped_lock lock(connect_mutex_);
-
- // Dynamic Reconfigure
- dynamic_reconfigure::Server::CallbackType f;
- f = boost::bind(&DepthImageToLaserScanROS::reconfigureCb, this, _1, _2);
- srv_.setCallback(f);
-
- // Lazy subscription to depth image topic
- pub_ = n.advertise("scan", 10, boost::bind(&DepthImageToLaserScanROS::connectCb, this, _1), boost::bind(&DepthImageToLaserScanROS::disconnectCb, this, _1));
-}
-
-DepthImageToLaserScanROS::~DepthImageToLaserScanROS(){
- sub_.shutdown();
-}
-
-
-
-void DepthImageToLaserScanROS::depthCb(const sensor_msgs::ImageConstPtr& depth_msg,
- const sensor_msgs::CameraInfoConstPtr& info_msg){
- try
- {
- sensor_msgs::LaserScanPtr scan_msg = dtl_.convert_msg(depth_msg, info_msg);
- pub_.publish(scan_msg);
- }
- catch (std::runtime_error& e)
- {
- ROS_ERROR_THROTTLE(1.0, "Could not convert depth image to laserscan: %s", e.what());
- }
-}
-
-void DepthImageToLaserScanROS::connectCb(const ros::SingleSubscriberPublisher& pub) {
- boost::mutex::scoped_lock lock(connect_mutex_);
- if (!sub_ && pub_.getNumSubscribers() > 0) {
- ROS_DEBUG("Connecting to depth topic.");
- image_transport::TransportHints hints("raw", ros::TransportHints(), pnh_);
- sub_ = it_.subscribeCamera("image", 10, &DepthImageToLaserScanROS::depthCb, this, hints);
- }
-}
-
-void DepthImageToLaserScanROS::disconnectCb(const ros::SingleSubscriberPublisher& pub) {
- boost::mutex::scoped_lock lock(connect_mutex_);
- if (pub_.getNumSubscribers() == 0) {
- ROS_DEBUG("Unsubscribing from depth topic.");
- sub_.shutdown();
- }
-}
-
-void DepthImageToLaserScanROS::reconfigureCb(depthimage_to_laserscan::DepthConfig& config, uint32_t level){
- dtl_.set_scan_time(config.scan_time);
- dtl_.set_range_limits(config.range_min, config.range_max);
- dtl_.set_scan_height(config.scan_height);
- dtl_.set_output_frame(config.output_frame_id);
-}
diff --git a/depthimage_to_laserscan/src/depthimage_to_laserscan.cpp b/depthimage_to_laserscan/src/depthimage_to_laserscan.cpp
deleted file mode 100755
index 1502d71..0000000
--- a/depthimage_to_laserscan/src/depthimage_to_laserscan.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2012, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Author: Chad Rockey
- */
-
-#include
-
-int main(int argc, char **argv){
- ros::init(argc, argv, "depthimage_to_laserscan");
- ros::NodeHandle n;
- ros::NodeHandle pnh("~");
-
- depthimage_to_laserscan::DepthImageToLaserScanROS dtl(n, pnh);
-
- ros::spin();
-
- return 0;
-}
\ No newline at end of file
diff --git a/depthimage_to_laserscan/test/DepthImageToLaserScanTest.cpp b/depthimage_to_laserscan/test/DepthImageToLaserScanTest.cpp
deleted file mode 100755
index 1b4acc2..0000000
--- a/depthimage_to_laserscan/test/DepthImageToLaserScanTest.cpp
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Copyright (c) 2012, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Author: Chad Rockey
- */
-
-// Bring in my package's API, which is what I'm testing
-#include
-// Bring in gtest
-#include
-
-#include
-#include
-
-#include
-#include
-#include
-
-// Library object
-depthimage_to_laserscan::DepthImageToLaserScan dtl_;
-
-// Inputs
-sensor_msgs::ImagePtr depth_msg_;
-sensor_msgs::CameraInfoPtr info_msg_;
-
-// Check if the setters work properly and initialize member variables
-TEST(ConvertTest, setupLibrary)
-{
- // Set up library
- const float scan_time = 1.0/30.0;
- dtl_.set_scan_time(scan_time);
- const float range_min = 0.45;
- const float range_max = 10.0;
- dtl_.set_range_limits(range_min, range_max);
- const int scan_height = 1;
- dtl_.set_scan_height(scan_height);
- const std::string output_frame = "camera_depth_frame";
- dtl_.set_output_frame(output_frame);
-
- depth_msg_.reset(new sensor_msgs::Image);
- depth_msg_->header.seq = 42;
- depth_msg_->header.stamp.fromNSec(1234567890);
- depth_msg_->header.frame_id = "frame";
- depth_msg_->height = 480;
- depth_msg_->width = 640;
- depth_msg_->encoding = sensor_msgs::image_encodings::TYPE_16UC1;
- depth_msg_->is_bigendian = false;
- depth_msg_->step = depth_msg_->width*2; // 2 bytes per pixel
- uint16_t value = 0x0F;
- depth_msg_->data.assign(depth_msg_->height*depth_msg_->step, value); // Sets all values to 3.855m
-
- info_msg_.reset(new sensor_msgs::CameraInfo);
- info_msg_->header = depth_msg_->header;
- info_msg_->height = depth_msg_->height;
- info_msg_->width = depth_msg_->width;
- info_msg_->distortion_model = "plumb_bob";
- info_msg_->D.resize(5); // All 0, no distortion
- info_msg_->K[0] = 570.3422241210938;
- info_msg_->K[2] = 314.5;
- info_msg_->K[4] = 570.3422241210938;
- info_msg_->K[5] = 235.5;
- info_msg_->K[8] = 1.0;
- info_msg_->R[0] = 1.0;
- info_msg_->R[4] = 1.0;
- info_msg_->R[8] = 1.0;
- info_msg_->P[0] = 570.3422241210938;
- info_msg_->P[2] = 314.5;
- info_msg_->P[5] = 570.3422241210938;
- info_msg_->P[6] = 235.5;
- info_msg_->P[10] = 1.0;
-
- sensor_msgs::LaserScanPtr scan_msg = dtl_.convert_msg(depth_msg_, info_msg_);
-
- // Test set variables
- EXPECT_EQ(scan_msg->scan_time, scan_time);
- EXPECT_EQ(scan_msg->range_min, range_min);
- EXPECT_EQ(scan_msg->range_max, range_max);
- EXPECT_EQ(scan_msg->header.frame_id, output_frame);
- EXPECT_EQ(scan_msg->ranges.size(), depth_msg_->width);
-}
-
-// Test for the exception based on encoding
-TEST(ConvertTest, testExceptions)
-{
- // Test supported image encodings for exceptions
- // Does not segfault as long as scan_height = 1
- depth_msg_->encoding = sensor_msgs::image_encodings::RGB8;
- EXPECT_THROW(dtl_.convert_msg(depth_msg_, info_msg_), std::runtime_error);
- depth_msg_->encoding = sensor_msgs::image_encodings::TYPE_32FC1;
- EXPECT_NO_THROW(dtl_.convert_msg(depth_msg_, info_msg_));
- depth_msg_->encoding = sensor_msgs::image_encodings::TYPE_16UC1;
- EXPECT_NO_THROW(dtl_.convert_msg(depth_msg_, info_msg_));
-}
-
-// Check to make sure the mininum is output for each pixel column for various scan heights
-TEST(ConvertTest, testScanHeight)
-{
- for(int scan_height = 1; scan_height <= 100; scan_height++){
- uint16_t low_value = 500;
- uint16_t high_value = 3000;
-
- int data_len = depth_msg_->width;
- uint16_t* data = reinterpret_cast(&depth_msg_->data[0]);
- int row_step = depth_msg_->step / sizeof(uint16_t);
-
- dtl_.set_scan_height(scan_height);
-
- int offset = (int)(info_msg_->K[5]-scan_height/2);
- data += offset*row_step; // Offset to center of image
-
- for(int v = 0; v < scan_height; v++, data += row_step){
- for (int u = 0; u < data_len; u++) // Loop over each pixel in row
- {
- if(v % scan_height == u % scan_height){
- data[u] = low_value;
- } else {
- data[u] = high_value;
- }
- }
- }
-
- // Convert
- sensor_msgs::LaserScanPtr scan_msg = dtl_.convert_msg(depth_msg_, info_msg_);
-
- // Test for minimum
- float high_float_thresh = (float)high_value * 1.0f/1000.0f * 0.9f; // 0.9f represents 10 percent margin on range
- for(size_t i = 0; i < scan_msg->ranges.size(); i++){
- // If this is a valid point
- if(scan_msg->range_min <= scan_msg->ranges[i] && scan_msg->ranges[i] <= scan_msg->range_max){
- // Make sure it's not set to the high_value
- ASSERT_LT(scan_msg->ranges[i], high_float_thresh);
- }
- }
- }
-
- // Revert to 1 scan height
- dtl_.set_scan_height(1);
-
-}
-
-// Test a randomly filled image and ensure all values are < range_min
-// (range_max is currently violated to fill the messages)
-TEST(ConvertTest, testRandom)
-{
- srand ( 8675309 ); // Set seed for repeatable tests
-
- uint16_t* data = reinterpret_cast(&depth_msg_->data[0]);
- for(size_t i = 0; i < depth_msg_->width*depth_msg_->height; i++){
- data[i] = rand() % 500; // Distance between 0 and 0.5m
- }
-
- // Convert
- sensor_msgs::LaserScanPtr scan_msg = dtl_.convert_msg(depth_msg_, info_msg_);
-
- // Make sure all values are greater than or equal to range_min and less than or equal to range_max
- for(size_t i = 0; i < scan_msg->ranges.size(); i++){
- if(std::isfinite(scan_msg->ranges[i])){
- ASSERT_GE(scan_msg->ranges[i], scan_msg->range_min);
- ASSERT_LE(scan_msg->ranges[i], scan_msg->range_max);
- }
- }
-}
-
-// Test to preserve NaN
-TEST(ConvertTest, testNaN)
-{
- // Use a floating point image
- sensor_msgs::ImagePtr float_msg(new sensor_msgs::Image(*depth_msg_));
- float_msg->encoding = sensor_msgs::image_encodings::TYPE_32FC1;
- float_msg->step = float_msg->width*4; // 4 bytes per pixel
- float_msg->data.resize(float_msg->step * float_msg->height);
-
- float* data = reinterpret_cast(&float_msg->data[0]);
- for(size_t i = 0; i < float_msg->width*float_msg->height; i++){
- data[i] = std::numeric_limits::quiet_NaN();
- }
-
- // Convert
- sensor_msgs::LaserScanPtr scan_msg = dtl_.convert_msg(float_msg, info_msg_);
-
- // Make sure all values are NaN
- for(size_t i = 0; i < scan_msg->ranges.size(); i++){
- if(std::isfinite(scan_msg->ranges[i])){
- ADD_FAILURE() << "Non-NaN value produced from NaN test.";
- }
- }
-}
-
-// Test to preserve +Inf
-TEST(ConvertTest, testPositiveInf)
-{
- // Use a floating point image
- sensor_msgs::ImagePtr float_msg(new sensor_msgs::Image(*depth_msg_));
- float_msg->encoding = sensor_msgs::image_encodings::TYPE_32FC1;
- float_msg->step = float_msg->width*4; // 4 bytes per pixel
- float_msg->data.resize(float_msg->step * float_msg->height);
-
- float* data = reinterpret_cast(&float_msg->data[0]);
- for(size_t i = 0; i < float_msg->width*float_msg->height; i++){
- data[i] = std::numeric_limits::infinity();
- }
-
- // Convert
- sensor_msgs::LaserScanPtr scan_msg = dtl_.convert_msg(float_msg, info_msg_);
-
- // Make sure most (> 80%) values are Inf
- size_t nan_count = 0;
- for(size_t i = 0; i < scan_msg->ranges.size(); i++){
- if(std::isfinite(scan_msg->ranges[i])){ // NaNs are acceptable.
- ADD_FAILURE() << "Non-finite value produced from postive infniity test.";
- } else if(isnan(scan_msg->ranges[i])){
- nan_count++;
- } else if(scan_msg->ranges[i] < 0){
- ADD_FAILURE() << "Negative value produced from postive infinity test.";
- }
- }
-
- ASSERT_LE(nan_count, scan_msg->ranges.size() * 0.80);
-}
-
-// Test to preserve -Inf
-TEST(ConvertTest, testNegativeInf)
-{
- // Use a floating point image
- sensor_msgs::ImagePtr float_msg(new sensor_msgs::Image(*depth_msg_));
- float_msg->encoding = sensor_msgs::image_encodings::TYPE_32FC1;
- float_msg->step = float_msg->width*4; // 4 bytes per pixel
- float_msg->data.resize(float_msg->step * float_msg->height);
-
- float* data = reinterpret_cast(&float_msg->data[0]);
- for(size_t i = 0; i < float_msg->width*float_msg->height; i++){
- data[i] = -std::numeric_limits::infinity();
- }
-
- // Convert
- sensor_msgs::LaserScanPtr scan_msg = dtl_.convert_msg(float_msg, info_msg_);
-
- // Make sure most (> 80%) values are Inf
- size_t nan_count = 0;
- for(size_t i = 0; i < scan_msg->ranges.size(); i++){
- if(std::isfinite(scan_msg->ranges[i])){ // NaNs are acceptable.
- ADD_FAILURE() << "Non-finite value produced from postive infniity test.";
- } else if(isnan(scan_msg->ranges[i])){
- nan_count++;
- } else if(scan_msg->ranges[i] > 0){
- ADD_FAILURE() << "Postive value produced from negative infinity test.";
- }
- }
-
- ASSERT_LE(nan_count, scan_msg->ranges.size() * 0.80);
-}
-
-
-// Run all the tests that were declared with TEST()
-int main(int argc, char **argv){
-testing::InitGoogleTest(&argc, argv);
-return RUN_ALL_TESTS();
-}
\ No newline at end of file
diff --git a/depthimage_to_laserscan/test/depthimage_to_laserscan_rostest.cpp b/depthimage_to_laserscan/test/depthimage_to_laserscan_rostest.cpp
deleted file mode 100755
index 08ec920..0000000
--- a/depthimage_to_laserscan/test/depthimage_to_laserscan_rostest.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2012, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Author: Chad Rockey
- */
-
-// Bring in gtest
-#include
-
-#include
-
-#include
-#include
-#include
-#include
-
-// Outputs
-sensor_msgs::ImagePtr depth_msg_;
-sensor_msgs::CameraInfoPtr info_msg_;
-
-size_t message_count_;
-
-void callback(const sensor_msgs::LaserScanConstPtr& msg){
- message_count_++;
-}
-
-TEST(transform_listener, commsTest)
-{
- ros::NodeHandle n;
-
- // Set up output messages
- depth_msg_.reset(new sensor_msgs::Image);
- depth_msg_->header.seq = 42;
- depth_msg_->header.stamp.fromNSec(1234567890);
- depth_msg_->header.frame_id = "frame";
- depth_msg_->height = 480;
- depth_msg_->width = 640;
- depth_msg_->encoding = sensor_msgs::image_encodings::TYPE_16UC1;
- depth_msg_->is_bigendian = false;
- depth_msg_->step = depth_msg_->width*2; // 2 bytes per pixel
- uint16_t value = 0x0F;
- depth_msg_->data.assign(depth_msg_->height*depth_msg_->step, value); // Sets all values to 3.855m
-
- info_msg_.reset(new sensor_msgs::CameraInfo);
- info_msg_->header = depth_msg_->header;
- info_msg_->height = depth_msg_->height;
- info_msg_->width = depth_msg_->width;
- info_msg_->distortion_model = "plumb_bob";
- info_msg_->D.resize(5); // All 0, no distortion
- info_msg_->K[0] = 570.3422241210938;
- info_msg_->K[2] = 314.5;
- info_msg_->K[4] = 570.3422241210938;
- info_msg_->K[5] = 235.5;
- info_msg_->K[8] = 1.0;
- info_msg_->R[0] = 1.0;
- info_msg_->R[4] = 1.0;
- info_msg_->R[8] = 1.0;
- info_msg_->P[0] = 570.3422241210938;
- info_msg_->P[2] = 314.5;
- info_msg_->P[5] = 570.3422241210938;
- info_msg_->P[6] = 235.5;
- info_msg_->P[10] = 1.0;
-
- // Set up publisher
- ros::Publisher pub = n.advertise("image", 5);
- ros::Publisher pub_info = n.advertise("camera_info", 5);
-
- // Subscribe to output
- ros::Subscriber sub = n.subscribe("scan", 20, callback);
-
- // Sleep to allow connections to settle
- ros::Duration(5.0).sleep();
-
- size_t number_published = 10;
- double sleep_duration = 1.0/30.0;
-
- // Publish some data
- for(size_t i = 0; i < number_published; i++){
- pub.publish(depth_msg_);
- pub_info.publish(info_msg_);
- ros::Duration(sleep_duration).sleep();
- ros::spinOnce();
- }
-
- // Wait a while longer
- ros::Duration(2.0).sleep();
- ros::spinOnce();
-
- EXPECT_EQ(number_published, message_count_);
-}
-
-
-int main(int argc, char **argv){
- testing::InitGoogleTest(&argc, argv);
- ros::init(argc, argv, "depthimage_to_laserscan_unittest");
-
- message_count_ = 0;
-
- return RUN_ALL_TESTS();
-}
\ No newline at end of file
diff --git a/depthimage_to_laserscan/test/rostest/depthimage_to_laserscan.test b/depthimage_to_laserscan/test/rostest/depthimage_to_laserscan.test
deleted file mode 100755
index bd3f540..0000000
--- a/depthimage_to_laserscan/test/rostest/depthimage_to_laserscan.test
+++ /dev/null
@@ -1,6 +0,0 @@
-
- \
-
-
-
-
\ No newline at end of file
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 0000000..09be322
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,3 @@
+# Documentation
+
+Place detailed documentation, architecture diagrams, and user guides here.
diff --git a/incremental_encoder_adv/incremental_encoder_adv.ino b/incremental_encoder_adv/incremental_encoder_adv.ino
deleted file mode 100755
index 91eb3ee..0000000
--- a/incremental_encoder_adv/incremental_encoder_adv.ino
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *
- * Records encoder ticks for each wheel
- * and prints the number of ticks for
- * each encoder every 500ms
- *
- */
-
-// pins for the encoder inputs
-#define RH_ENCODER_A 3
-#define RH_ENCODER_B 5
-#define LH_ENCODER_A 4
-#define LH_ENCODER_B 2
-
-#define PWML 9
-#define PWMR 10
-#define RGT1 6
-#define RGT2 7
-#define LT1 8
-#define LT2 11
-
-// variables to store the number of encoder pulses
-// for each motor
-volatile double leftCount = 0;
-volatile double rightCount = 0;
-volatile float prev, now ,start, counter=0, time_delay, RPM_left, RPM_right, prev_rotR, prev_rotL, cur_rotR, cur_rotL;
-
-void setup() {
- pinMode(LH_ENCODER_A, INPUT);
- pinMode(LH_ENCODER_B, INPUT);
- pinMode(RH_ENCODER_A, INPUT);
- pinMode(RH_ENCODER_B, INPUT);
-
- pinMode(PWML,OUTPUT);
- pinMode(PWMR,OUTPUT);
- pinMode(RGT1,OUTPUT);
- pinMode(RGT2,OUTPUT);
- pinMode(LT1,OUTPUT);
- pinMode(LT2,OUTPUT);
-
- // initialize hardware interrupts
-
- attachInterrupt(0, leftEncoderEvent, CHANGE);
- attachInterrupt(1, rightEncoderEvent, CHANGE);
-
- Serial.begin(9600);
-
- prev = millis();
- prev_rotR = 0;
- prev_rotL = 0;
-}
-
-void loop() {
- //Serial.print("Right Count: ");
-
- analogWrite(PWML, 255);
- analogWrite(PWMR, 255);
- digitalWrite(RGT1, HIGH);
- digitalWrite(RGT2, LOW);
- digitalWrite(LT1, HIGH);
- digitalWrite(LT2, LOW);
-
- now = millis();
- time_delay = now - prev;
- cur_rotR = rightCount/5000;
- cur_rotL = leftCount/5000 ;
- RPM_right = (cur_rotR - prev_rotR)*600;
- RPM_left = (cur_rotL - prev_rotL)*600;
- Serial.print(digitalRead(2));
- Serial.print(digitalRead(4));
-
- Serial.print(" ");
- Serial.print(RPM_left);
-
- Serial.print(" ");
- Serial.println(RPM_right);
-
- prev_rotR = cur_rotR;
- prev_rotL = cur_rotL;
- delay(100);
- }
-
-// encoder event for the interrupt call
-void leftEncoderEvent() {
- if (digitalRead(LH_ENCODER_A) == HIGH) {
- if (digitalRead(LH_ENCODER_B) == LOW) {
- leftCount++;
- } else {
- leftCount--;
- }
- } else {
- if (digitalRead(LH_ENCODER_B) == LOW) {
- leftCount--;
- } else {
- leftCount++;
- }
- }
-}
-
-// encoder event for the interrupt call
-void rightEncoderEvent() {
- if (digitalRead(RH_ENCODER_A) == HIGH) {
- if (digitalRead(RH_ENCODER_B) == LOW) {
- rightCount++;
- } else {
- rightCount--;
- }
- } else {
- if (digitalRead(RH_ENCODER_B) == LOW) {
- rightCount--;
- } else {
- rightCount++;
- }
- }
-}
diff --git a/launch/amcl_diff.launch b/launch/amcl_diff.launch
deleted file mode 100755
index 32a13cd..0000000
--- a/launch/amcl_diff.launch
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/launch/driver.launch b/launch/driver.launch
deleted file mode 100755
index 5083566..0000000
--- a/launch/driver.launch
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/launch/kinect_laser.launch b/launch/kinect_laser.launch
deleted file mode 100755
index 8b2e789..0000000
--- a/launch/kinect_laser.launch
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/launch/laser_scan.launch b/launch/laser_scan.launch
deleted file mode 100755
index d901db7..0000000
--- a/launch/laser_scan.launch
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/launch/move_base.launch b/launch/move_base.launch
deleted file mode 100755
index dcc6af5..0000000
--- a/launch/move_base.launch
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/launch/robot_config.launch b/launch/robot_config.launch
deleted file mode 100755
index ef5df2e..0000000
--- a/launch/robot_config.launch
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/launch/rviz/amcl.rviz b/launch/rviz/amcl.rviz
deleted file mode 100755
index 8a39c2a..0000000
--- a/launch/rviz/amcl.rviz
+++ /dev/null
@@ -1,367 +0,0 @@
-Panels:
- - Class: rviz/Displays
- Help Height: 0
- Name: Displays
- Property Tree Widget:
- Expanded: ~
- Splitter Ratio: 0.572327
- Tree Height: 402
- - Class: rviz/Selection
- Name: Selection
- - Class: rviz/Tool Properties
- Expanded:
- - /2D Pose Estimate1
- - /2D Nav Goal1
- - /Publish Point1
- Name: Tool Properties
- Splitter Ratio: 0.588679
- - Class: rviz/Views
- Expanded:
- - /Current View1
- Name: Views
- Splitter Ratio: 0.5
- - Class: rviz/Time
- Experimental: false
- Name: Time
- SyncMode: 0
- SyncSource: LaserScan
-Visualization Manager:
- Class: ""
- Displays:
- - Alpha: 0.5
- Cell Size: 1
- Class: rviz/Grid
- Color: 160; 160; 164
- Enabled: true
- Line Style:
- Line Width: 0.03
- Value: Lines
- Name: Grid
- Normal Cell Count: 0
- Offset:
- X: 0
- Y: 0
- Z: 0
- Plane: XY
- Plane Cell Count: 10
- Reference Frame: base_link
- Value: true
- - Alpha: 0.9
- Autocompute Intensity Bounds: true
- Autocompute Value Bounds:
- Max Value: 10
- Min Value: -10
- Value: true
- Axis: Z
- Channel Name: x
- Class: rviz/LaserScan
- Color: 255; 255; 255
- Color Transformer: Intensity
- Decay Time: 0.1
- Enabled: true
- Invert Rainbow: false
- Max Color: 255; 255; 255
- Max Intensity: 51.7348
- Min Color: 255; 0; 0
- Min Intensity: 50.2358
- Name: LaserScan
- Position Transformer: XYZ
- Queue Size: 10
- Selectable: true
- Size (Pixels): 3
- Size (m): 0.03
- Style: Flat Squares
- Topic: /scan
- Use Fixed Frame: true
- Use rainbow: true
- Value: true
- - Class: rviz/Axes
- Enabled: false
- Length: 0.34
- Name: Axes
- Radius: 0.02
- Reference Frame: base_link
- Value: false
- - Alpha: 1
- Class: rviz/RobotModel
- Collision Enabled: false
- Enabled: true
- Links:
- All Links Enabled: true
- Expand Joint Details: false
- Expand Link Details: false
- Expand Tree: false
- Link Tree Style: Links in Alphabetic Order
- base_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- kinect:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- laptop:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- wheel_left:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- wheel_right:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- wheel_track:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- Name: RobotModel
- Robot Description: robot_description
- TF Prefix: ""
- Update Interval: 0
- Value: true
- Visual Enabled: true
- - Alpha: 0.7
- Class: rviz/Map
- Color Scheme: map
- Draw Behind: false
- Enabled: true
- Name: Map
- Topic: /map
- Value: true
- - Arrow Length: 0.1
- Class: rviz/PoseArray
- Color: 255; 25; 0
- Enabled: true
- Name: Particle Cloud
- Topic: /particlecloud
- Value: true
- - Alpha: 1
- Class: rviz/Polygon
- Color: 255; 25; 0
- Enabled: true
- Name: Robot Footprint
- Topic: /move_base/local_costmap/obstacle_layer_footprint/footprint_stamped
- Value: true
- - Alpha: 1
- Buffer Length: 1
- Class: rviz/Path
- Color: 25; 255; 0
- Enabled: true
- Line Style: Lines
- Line Width: 0.03
- Name: Global Plan
- Offset:
- X: 0
- Y: 0
- Z: 0
- Topic: /move_base/TrajectoryPlannerROS/global_plan
- Value: true
- - Alpha: 0.5
- Autocompute Intensity Bounds: true
- Autocompute Value Bounds:
- Max Value: 10
- Min Value: -10
- Value: true
- Axis: Z
- Channel Name: total_cost
- Class: rviz/PointCloud2
- Color: 255; 255; 255
- Color Transformer: Intensity
- Decay Time: 0
- Enabled: true
- Invert Rainbow: false
- Max Color: 255; 255; 255
- Max Intensity: 57.6
- Min Color: 0; 0; 0
- Min Intensity: 2.8
- Name: Cost Cloud
- Position Transformer: XYZ
- Queue Size: 10
- Selectable: true
- Size (Pixels): 3
- Size (m): 0.05
- Style: Flat Squares
- Topic: /move_base/TrajectoryPlannerROS/cost_cloud
- Use Fixed Frame: true
- Use rainbow: true
- Value: true
- - Alpha: 1
- Buffer Length: 1
- Class: rviz/Path
- Color: 25; 25; 255
- Enabled: true
- Line Style: Lines
- Line Width: 0.03
- Name: Local Plan
- Offset:
- X: 0
- Y: 0
- Z: 0
- Topic: /move_base/TrajectoryPlannerROS/local_plan
- Value: true
- - Alpha: 1
- Buffer Length: 1
- Class: rviz/Path
- Color: 25; 255; 0
- Enabled: true
- Line Style: Lines
- Line Width: 0.03
- Name: Planner Plan
- Offset:
- X: 0
- Y: 0
- Z: 0
- Topic: /move_base/NavfnROS/plan
- Value: true
- - Alpha: 1
- Axes Length: 1
- Axes Radius: 0.1
- Class: rviz/Pose
- Color: 255; 25; 0
- Enabled: true
- Head Length: 0.3
- Head Radius: 0.1
- Name: Current Goal
- Shaft Length: 1
- Shaft Radius: 0.05
- Shape: Arrow
- Topic: /move_base/current_goal
- Value: true
- - Alpha: 0.7
- Class: rviz/Map
- Color Scheme: costmap
- Draw Behind: false
- Enabled: true
- Name: Local Costmap
- Topic: /move_base/local_costmap/costmap
- Value: true
- - Alpha: 0.8
- Class: rviz/Map
- Color Scheme: costmap
- Draw Behind: true
- Enabled: true
- Name: Global Costmap
- Topic: /move_base/global_costmap/costmap
- Value: true
- - Class: rviz/Camera
- Enabled: true
- Image Rendering: background and overlay
- Image Topic: /camera/rgb/image_color
- Name: Camera
- Overlay Alpha: 0.5
- Queue Size: 2
- Transport Hint: raw
- Value: true
- Visibility:
- Axes: true
- Cost Cloud: true
- Current Goal: true
- Global Costmap: true
- Global Plan: true
- Grid: true
- LaserScan: true
- Local Costmap: true
- Local Plan: true
- Map: true
- Particle Cloud: true
- Planner Plan: true
- Robot Footprint: true
- RobotModel: true
- Trajectory Cloud: true
- Value: true
- Zoom Factor: 1
- - Alpha: 1
- Autocompute Intensity Bounds: true
- Autocompute Value Bounds:
- Max Value: 10
- Min Value: -10
- Value: true
- Axis: Z
- Channel Name: intensity
- Class: rviz/PointCloud2
- Color: 255; 255; 255
- Color Transformer: ""
- Decay Time: 0
- Enabled: false
- Invert Rainbow: false
- Max Color: 255; 255; 255
- Max Intensity: 4096
- Min Color: 0; 0; 0
- Min Intensity: 0
- Name: Trajectory Cloud
- Position Transformer: ""
- Queue Size: 10
- Selectable: true
- Size (Pixels): 3
- Size (m): 0.01
- Style: Flat Squares
- Topic: /move_base/DWAPlannerROS/trajectory_cloud
- Use Fixed Frame: true
- Use rainbow: true
- Value: false
- Enabled: true
- Global Options:
- Background Color: 48; 48; 48
- Fixed Frame: map
- Frame Rate: 30
- Name: root
- Tools:
- - Class: rviz/Interact
- Hide Inactive Objects: true
- - Class: rviz/MoveCamera
- - Class: rviz/Select
- - Class: rviz/FocusCamera
- - Class: rviz/Measure
- - Class: rviz/SetInitialPose
- Topic: /initialpose
- - Class: rviz/SetGoal
- Topic: /move_base_simple/goal
- - Class: rviz/PublishPoint
- Single click: true
- Topic: /clicked_point
- Value: true
- Views:
- Current:
- Angle: 0.00500009
- Class: rviz/TopDownOrtho
- Enable Stereo Rendering:
- Stereo Eye Separation: 0.06
- Stereo Focal Distance: 1
- Swap Stereo Eyes: false
- Value: false
- Name: Current View
- Near Clip Distance: 0.01
- Scale: 79.5038
- Target Frame:
- Value: TopDownOrtho (rviz)
- X: 50.7798
- Y: 50.218
- Saved: ~
-Window Geometry:
- Camera:
- collapsed: false
- Displays:
- collapsed: false
- Height: 711
- Hide Left Dock: false
- Hide Right Dock: true
- QMainWindow State: 000000ff00000000fd00000004000000000000024300000208fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006e00fffffffb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afc00000049000002080000011801000025fa000000000100000002fb0000000c00430061006d0065007200610100000000ffffffff0000007c00fffffffb000000100044006900730070006c0061007900730100000000000001400000012700fffffffb0000000a0049006d0061006700650200000220000001310000013c00000174fb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000012700000208fc0200000004fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730000000049000000970000006e00fffffffb0000000a0056006900650077007300000000e60000016b000000ca00fffffffb0000001e0054006f006f006c002000500072006f0070006500720074006900650073010000014f000001920000000000000000fb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000556000000a9fc0100000002fb0000000c00430061006d0065007200610100000000000005560000000000000000fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000005560000004afc0100000002fb0000000800540069006d00650100000000000005560000040100fffffffb0000000800540069006d006501000000000000045000000000000000000000030d0000020800000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
- Selection:
- collapsed: false
- Time:
- collapsed: false
- Tool Properties:
- collapsed: true
- Views:
- collapsed: true
- Width: 1366
- X: 0
- Y: 0
diff --git a/launch/rviz/laser.rviz b/launch/rviz/laser.rviz
deleted file mode 100755
index 2e14d1f..0000000
--- a/launch/rviz/laser.rviz
+++ /dev/null
@@ -1,197 +0,0 @@
-Panels:
- - Class: rviz/Displays
- Help Height: 78
- Name: Displays
- Property Tree Widget:
- Expanded:
- - /Global Options1
- - /Status1
- - /LaserScan1
- - /Axes2
- Splitter Ratio: 0.5
- Tree Height: 749
- - Class: rviz/Selection
- Name: Selection
- - Class: rviz/Tool Properties
- Expanded:
- - /2D Pose Estimate1
- - /2D Nav Goal1
- - /Publish Point1
- Name: Tool Properties
- Splitter Ratio: 0.588679
- - Class: rviz/Views
- Expanded:
- - /Current View1
- Name: Views
- Splitter Ratio: 0.5
- - Class: rviz/Time
- Experimental: false
- Name: Time
- SyncMode: 0
- SyncSource: LaserScan
-Visualization Manager:
- Class: ""
- Displays:
- - Alpha: 0.5
- Cell Size: 1
- Class: rviz/Grid
- Color: 160; 160; 164
- Enabled: true
- Line Style:
- Line Width: 0.03
- Value: Lines
- Name: Grid
- Normal Cell Count: 0
- Offset:
- X: 0
- Y: 0
- Z: 0
- Plane: XY
- Plane Cell Count: 10
- Reference Frame:
- Value: true
- - Alpha: 1
- Autocompute Intensity Bounds: true
- Autocompute Value Bounds:
- Max Value: 10
- Min Value: -10
- Value: true
- Axis: Z
- Channel Name: intensity
- Class: rviz/LaserScan
- Color: 255; 255; 255
- Color Transformer: Intensity
- Decay Time: 60
- Enabled: true
- Invert Rainbow: false
- Max Color: 255; 255; 255
- Max Intensity: 4096
- Min Color: 0; 0; 0
- Min Intensity: 0
- Name: LaserScan
- Position Transformer: XYZ
- Queue Size: 10
- Selectable: true
- Size (Pixels): 3
- Size (m): 0.01
- Style: Flat Squares
- Topic: /scan
- Use Fixed Frame: true
- Use rainbow: true
- Value: true
- - Class: rviz/Axes
- Enabled: true
- Length: 0.34
- Name: Axes
- Radius: 0.05
- Reference Frame: base_link
- Value: true
- - Alpha: 1
- Class: rviz/RobotModel
- Collision Enabled: false
- Enabled: true
- Links:
- All Links Enabled: true
- Expand Joint Details: false
- Expand Link Details: false
- Expand Tree: false
- Link Tree Style: Links in Alphabetic Order
- base_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- kinect:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- laptop:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- wheel_left:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- wheel_right:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- wheel_track:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- Name: RobotModel
- Robot Description: robot_description
- TF Prefix: ""
- Update Interval: 0
- Value: true
- Visual Enabled: true
- - Class: rviz/Axes
- Enabled: true
- Length: 0.51
- Name: Axes
- Radius: 0.05
- Reference Frame: camera_depth_frame
- Value: true
- Enabled: true
- Global Options:
- Background Color: 48; 48; 48
- Fixed Frame: odom
- Frame Rate: 30
- Name: root
- Tools:
- - Class: rviz/Interact
- Hide Inactive Objects: true
- - Class: rviz/MoveCamera
- - Class: rviz/Select
- - Class: rviz/FocusCamera
- - Class: rviz/Measure
- - Class: rviz/SetInitialPose
- Topic: /initialpose
- - Class: rviz/SetGoal
- Topic: /move_base_simple/goal
- - Class: rviz/PublishPoint
- Single click: true
- Topic: /clicked_point
- Value: true
- Views:
- Current:
- Angle: 0
- Class: rviz/TopDownOrtho
- Enable Stereo Rendering:
- Stereo Eye Separation: 0.06
- Stereo Focal Distance: 1
- Swap Stereo Eyes: false
- Value: false
- Name: Current View
- Near Clip Distance: 0.01
- Scale: 120.675
- Target Frame:
- Value: TopDownOrtho (rviz)
- X: -0.0317816
- Y: -0.0431364
- Saved: ~
-Window Geometry:
- Displays:
- collapsed: false
- Height: 1050
- Hide Left Dock: false
- Hide Right Dock: false
- QMainWindow State: 000000ff00000000fd00000004000000000000013c00000385fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006800fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000002800000385000000e600fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000011300000385fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000002800000385000000be00fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e100000197000000030000072f00000044fc0100000002fb0000000800540069006d006501000000000000072f0000038800fffffffb0000000800540069006d00650100000000000004500000000000000000000004d40000038500000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
- Selection:
- collapsed: false
- Time:
- collapsed: false
- Tool Properties:
- collapsed: false
- Views:
- collapsed: false
- Width: 1839
- X: 81
- Y: 30
diff --git a/launch/rviz/slam.rviz b/launch/rviz/slam.rviz
deleted file mode 100755
index 095d483..0000000
--- a/launch/rviz/slam.rviz
+++ /dev/null
@@ -1,164 +0,0 @@
-Panels:
- - Class: rviz/Displays
- Help Height: 81
- Name: Displays
- Property Tree Widget:
- Expanded:
- - /Global Options1
- - /Status1
- - /Axes1
- Splitter Ratio: 0.5
- Tree Height: 433
- - Class: rviz/Selection
- Name: Selection
- - Class: rviz/Tool Properties
- Expanded:
- - /2D Pose Estimate1
- - /2D Nav Goal1
- - /Publish Point1
- Name: Tool Properties
- Splitter Ratio: 0.588679
- - Class: rviz/Views
- Expanded:
- - /Current View1
- Name: Views
- Splitter Ratio: 0.5
- - Class: rviz/Time
- Experimental: false
- Name: Time
- SyncMode: 0
- SyncSource: Camera
-Visualization Manager:
- Class: ""
- Displays:
- - Alpha: 0.5
- Cell Size: 1
- Class: rviz/Grid
- Color: 160; 160; 164
- Enabled: true
- Line Style:
- Line Width: 0.03
- Value: Lines
- Name: Grid
- Normal Cell Count: 0
- Offset:
- X: 0
- Y: 0
- Z: 0
- Plane: XY
- Plane Cell Count: 10
- Reference Frame:
- Value: true
- - Class: rviz/Axes
- Enabled: true
- Length: 0.51
- Name: Axes
- Radius: 0.05
- Reference Frame: base_link
- Value: true
- - Alpha: 0.7
- Class: rviz/Map
- Color Scheme: map
- Draw Behind: false
- Enabled: true
- Name: Map
- Topic: /map
- Value: true
- - Class: rviz/Camera
- Enabled: false
- Image Rendering: background and overlay
- Image Topic: /camera/rgb/image_color
- Name: Camera
- Overlay Alpha: 0.5
- Queue Size: 2
- Transport Hint: raw
- Value: false
- Visibility:
- "": true
- Axes: true
- Grid: true
- Map: true
- Value: true
- Zoom Factor: 1
- - Class: rviz/Image
- Enabled: false
- Image Topic: /camera/rgb/image_raw
- Max Value: 1
- Median window: 5
- Min Value: 0
- Name: Image
- Normalize Range: true
- Queue Size: 2
- Transport Hint: raw
- Value: false
- - Class: rviz/Image
- Enabled: true
- Image Topic: /camera/rgb/image_color
- Max Value: 1
- Median window: 5
- Min Value: 0
- Name: Image
- Normalize Range: true
- Queue Size: 2
- Transport Hint: raw
- Value: true
- Enabled: true
- Global Options:
- Background Color: 48; 48; 48
- Fixed Frame: map
- Frame Rate: 30
- Name: root
- Tools:
- - Class: rviz/Interact
- Hide Inactive Objects: true
- - Class: rviz/MoveCamera
- - Class: rviz/Select
- - Class: rviz/FocusCamera
- - Class: rviz/Measure
- - Class: rviz/SetInitialPose
- Topic: /initialpose
- - Class: rviz/SetGoal
- Topic: /move_base_simple/goal
- - Class: rviz/PublishPoint
- Single click: true
- Topic: /clicked_point
- Value: true
- Views:
- Current:
- Angle: 0
- Class: rviz/TopDownOrtho
- Enable Stereo Rendering:
- Stereo Eye Separation: 0.06
- Stereo Focal Distance: 1
- Swap Stereo Eyes: false
- Value: false
- Name: Current View
- Near Clip Distance: 0.01
- Scale: 66.5168
- Target Frame:
- Value: TopDownOrtho (rviz)
- X: -0.012492
- Y: -0.00523297
- Saved: ~
-Window Geometry:
- Camera:
- collapsed: false
- Displays:
- collapsed: false
- Height: 1050
- Hide Left Dock: false
- Hide Right Dock: true
- Image:
- collapsed: false
- QMainWindow State: 000000ff00000000fd0000000400000000000001bd00000385fc020000000bfb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006800fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c00610079007301000000280000024c000000e600fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000c00430061006d00650072006100000002e2000000cb0000001a00fffffffb0000000a0049006d00610067006500000002e2000000cb0000001a00fffffffb0000000a0049006d006100670065010000027a000001330000001a00ffffff000000010000011300000385fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000002800000385000000be00fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e100000197000000030000072f00000044fc0100000002fb0000000800540069006d006501000000000000072f0000038800fffffffb0000000800540069006d006501000000000000045000000000000000000000056c0000038500000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
- Selection:
- collapsed: false
- Time:
- collapsed: false
- Tool Properties:
- collapsed: false
- Views:
- collapsed: true
- Width: 1839
- X: 81
- Y: 30
diff --git a/launch/slam.launch b/launch/slam.launch
deleted file mode 100755
index 5afa619..0000000
--- a/launch/slam.launch
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/launch/urdf.launch b/launch/urdf.launch
deleted file mode 100755
index aebc98c..0000000
--- a/launch/urdf.launch
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/maps/map.pgm b/maps/map.pgm
deleted file mode 100755
index 7fcce1a..0000000
--- a/maps/map.pgm
+++ /dev/null
@@ -1,5 +0,0 @@
-P5
-# CREATOR: Map_generator.cpp 0.050 m/pix
-1984 1984
-255
-
\ No newline at end of file
diff --git a/maps/map.yaml b/maps/map.yaml
deleted file mode 100755
index 3449505..0000000
--- a/maps/map.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-image: Desktop/map.pgm
-resolution: 0.050000
-origin: [-50.000000, -50.000000, 0.000000]
-negate: 0
-occupied_thresh: 0.65
-free_thresh: 0.196
-
diff --git a/maps/map1.pgm b/maps/map1.pgm
deleted file mode 100755
index c4b297b..0000000
--- a/maps/map1.pgm
+++ /dev/null
@@ -1,5 +0,0 @@
-P5
-# CREATOR: Map_generator.cpp 0.050 m/pix
-1984 1984
-255
-
\ No newline at end of file
diff --git a/maps/map1.yaml b/maps/map1.yaml
deleted file mode 100755
index e30503b..0000000
--- a/maps/map1.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-image: Desktop/map1.pgm
-resolution: 0.050000
-origin: [-50.000000, -50.000000, 0.000000]
-negate: 0
-occupied_thresh: 0.65
-free_thresh: 0.196
-
diff --git a/maps/mymap.pgm b/maps/mymap.pgm
deleted file mode 100755
index 083581d..0000000
--- a/maps/mymap.pgm
+++ /dev/null
@@ -1,5 +0,0 @@
-P5
-# CREATOR: Map_generator.cpp 0.050 m/pix
-1984 1984
-255
-
\ No newline at end of file
diff --git a/maps/mymap.yaml b/maps/mymap.yaml
deleted file mode 100755
index 132d989..0000000
--- a/maps/mymap.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-image: Desktop/mymap.pgm
-resolution: 0.050000
-origin: [-50.000000, -50.000000, 0.000000]
-negate: 0
-occupied_thresh: 0.65
-free_thresh: 0.196
-
diff --git a/mechanisms/mechanisms.ino b/mechanisms/mechanisms.ino
deleted file mode 100755
index d2dcacf..0000000
--- a/mechanisms/mechanisms.ino
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * rosserial Subscriber
- * Gets input and performs the mechanism actions
- */
-
-#include
-#include
-
-#include
-
-Servo myservo; // create servo object to control a servo
-Servo myservo1;
-Servo myservo2;
-
-int pos = 0; // variable to store the servo position
-int sensor_pin = A0;
-int output_value ;
-
-int potpin = 0; // analog pin used to connect the potentiometer
-int val; // variable to read the value from the analog pin
-
-ros::NodeHandle nh;
-
-void messageCb( const std_msgs::String& toggle_msg){
- digitalWrite(13, HIGH-digitalRead(13)); // blink the led
-}
-
-
-void moistCb( const std_msgs::String& moist_msg){
- for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
- // in steps of 1 degree
- myservo.write(pos); // tell servo to go to position in variable 'pos'
- delay(15); // waits 15ms for the servo to reach the position
- }
-
- delay(2000);
-
- output_value= analogRead(sensor_pin);
-
- output_value = map(output_value,550,0,0,100);
-
- Serial.print("Mositure : ");
-
- Serial.print(output_value);
-
- Serial.print("%");
-
- if(output_value<=2)
- Serial.println("extreme stress - irrigate");
- else if(output_value>2 && output_value<=5)
- Serial.println("stress");
- else if(output_value>5 && output_value<=10)
- Serial.println("optimal");
- else if(output_value>10 && output_value<=15)
- Serial.println("excess");
- else
- Serial.println("saturation");
-
- delay(2000);
-
- for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
- myservo.write(pos); // tell servo to go to position in variable 'pos'
- delay(15); // waits 15ms for the servo to reach the position
- }
-}
-
-
-void ploughCb( const std_msgs::String& plough_msg){
- val = 0;
- val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
- myservo1.write(val);
-
- delay(500); // waits for the servo to get there
- val = 1024;
- val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
- myservo1.write(val);
-
- delay(500);
-}
-
-
-void seedCb( const std_msgs::String& seed_msg){
- val = 700;
- val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
- myservo2.write(val);
-
- delay(500); // waits for the servo to get there
- val = 1023;
- val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
- myservo2.write(val);
-
- delay(500);
-}
-
-
-void pumpCb( const std_msgs::String& pump_msg){
- analogWrite(10, pwm);
- delay(3000);
-}
-
-ros::Subscriber sub("toggle_led", &messageCb );
-ros::Subscriber sub("moisture_servo", &moistCb );
-ros::Subscriber sub("plough_servo", &ploughCb );
-ros::Subscriber sub("seed_sow_servo", &seedCb );
-ros::Subscriber sub("fertilizer_pump", &pumpCb );
-
-void setup()
-{
- myservo.attach(10); // attaches the servo on pin 10 to the servo object
- myservo1.attach(11);
- myservo2.attach(9);
-
- pinMode(5, OUTPUT);
-
- Serial.begin(9600);
-
- pinMode(13, OUTPUT);
-
- nh.initNode();
- nh.subscribe(sub);
-}
-
-void loop()
-{
- nh.spinOnce();
- delay(1);
-}
diff --git a/package.xml b/package.xml
deleted file mode 100755
index 75b0cac..0000000
--- a/package.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
- auto_navi_expo
- 1.0.0
- The auto_navi_expo package
-
-
-
-
- nikes
-
-
-
-
-
- TODO
-
-
-
-
-
-
-
-
-
-
-
- Vibashan
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- catkin
- geometry_msgs
- roscpp
- rospy
- std_msgs
- tf
- sensor_msgs
- geometry_msgs
- roscpp
- rospy
- std_msgs
- tf
- sensor_msgs
-
-
-
-
-
-
-
-
diff --git a/param/base_local_planner_params.yaml b/param/base_local_planner_params.yaml
deleted file mode 100755
index da542d8..0000000
--- a/param/base_local_planner_params.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-TrajectoryPlannerROS:
- max_vel_x: 0.3
- min_vel_x: -0.3
- max_vel_y: 0.0
- min_vel_y: 0.0
- max_vel_theta: 0.33
- min_vel_theta: -0.33
- min_in_place_vel_theta: -0.1
- escape_vel: -.01
-
- acc_lim_theta: 0.2
- acc_lim_x: 1.0
- acc_lim_y: 0.0
-
- yaw_goal_tolerance: 0.2
- xy_goal_tolerance: 0.2
-
- sim_time: 5.0
- vx_samples: 20
- vtheta_samples: 30
-
- holonomic_robot: false
-
- meter_scoring: false
- dwa: false
- pdist_scale: 1.0
- gdist_scale: 0.8
- occdist_scale: 0.01
- publish_cost_grid_pc: true
diff --git a/param/costmap_common_params.yaml b/param/costmap_common_params.yaml
deleted file mode 100755
index a05d6ca..0000000
--- a/param/costmap_common_params.yaml
+++ /dev/null
@@ -1,35 +0,0 @@
-#footprint: [[0.275, 0.25], [0.275, -0.25], [-0.275, -0.25], [-0.275, 0.25]]
-robot_radius: 0.275
-
-obstacle_range: 2.5
-raytrace_range: 3.0
-#max_obstacle_height: 0.6
-
-observation_sources: scan
-scan:
- data_type: LaserScan
- topic: scan
- marking: true
- clearing: true
- min_obstacle_height: 0.1
-# max_obstacle_height: 0.35
-
-map_type: costmap
-#obstacle_layer:
-# enabled: true
- #origin_z: 0.0
- #z_resolution: 0.2
- #z_voxels: 2
- #unknown_threshold: 15
- #mark_threshold: 0
- #combination_method: 1
-# track_unknown_space: true #true needed for disabling global path planning through unknown space
-
-#cost_scaling_factor and inflation_radius were now moved to the inflation_layer ns
-#inflation_layer:
-# enabled: true
-# cost_scaling_factor: 10.0 # exponential rate at which the obstacle cost drops off (default: 10)
-inflation_radius: 0.3 # max. distance from an obstacle at which costs are incurred for planning paths.
-
-#static_layer:
-# enabled: true
diff --git a/param/dwa_local_planner_params.yaml b/param/dwa_local_planner_params.yaml
deleted file mode 100755
index 49cea7c..0000000
--- a/param/dwa_local_planner_params.yaml
+++ /dev/null
@@ -1,49 +0,0 @@
-DWAPlannerROS:
-# Robot Configuration Parameters - Kobuki
- max_vel_x: 0.4 # 0.55
- min_vel_x: 0.0
- max_vel_y: 0.0 # diff drive robot
- min_vel_y: 0.0 # diff drive robot
- max_trans_vel: 0.4 # choose slightly less than the base's capability
- min_trans_vel: 0.1 # this is the min trans velocity when there is negligible rotational velocity
- trans_stopped_vel: 0.1
-# Warning!
-# do not set min_trans_vel to 0.0 otherwise dwa will always think translational velocities
-# are non-negligible and small in place rotational velocities will be created.
- max_rot_vel: 0.8 # choose slightly less than the base's capability
- min_rot_vel: 0.8 # this is the min angular velocity when there is negligible translational velocity
- rot_stopped_vel: 0.1
- acc_lim_x: 2.0
- acc_lim_theta: 0.2
- acc_lim_y: 0.0 # diff drive robot
-
-# Goal Tolerance Parameters
- yaw_goal_tolerance: 0.15 # 0.05
- xy_goal_tolerance: 0.15 # 0.10
- # latch_xy_goal_tolerance: false
-
-# Forward Simulation Parameters
- sim_time: 5 # 1.7
- vx_samples: 10 # 3
- vy_samples: 2 # diff drive robot, there is only one sample
- vtheta_samples: 40 # 20
-
-# Trajectory Scoring Parameters
- path_distance_bias: 32.0 # 32.0 - weighting for how much it should stick to the global path plan
- goal_distance_bias: 24.0 # 24.0 - wighting for how much it should attempt to reach its goal
- occdist_scale: 0.5 # 0.01 - weighting for how much the controller should avoid obstacles
- forward_point_distance: 0.325 # 0.325 - how far along to place an additional scoring point
- stop_time_buffer: 0.2 # 0.2 - amount of time a robot must stop in before colliding for a valid traj.
- scaling_speed: 0.25 # 0.25 - absolute velocity at which to start scaling the robot's footprint
- max_scaling_factor: 0.2 # 0.2 - how much to scale the robot's footprint when at speed.
-
-# Oscillation Prevention Parameters
- oscillation_reset_dist: 0.05 # 0.05 - how far to travel before resetting oscillation flags
-
-# Debugging
- publish_traj_pc : true
- publish_cost_grid_pc: true
- global_frame_id: /odom
-
-# Differential-drive robot configuration - necessary?
- holonomic_robot: false
diff --git a/param/global_costmap_params.yaml b/param/global_costmap_params.yaml
deleted file mode 100755
index d722c67..0000000
--- a/param/global_costmap_params.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-global_costmap:
- global_frame: /map
- robot_base_frame: /base_link
- update_frequency: 1.0
- publish_frequency: 0.5
- static_map: true
-
- transform_tolerance: 0.5
-# plugins:
- # - {name: static_layer, type: "costmap_2d::StaticLayer"}
- # - {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}
- # - {name: inflation_layer, type: "costmap_2d::InflationLayer"}
\ No newline at end of file
diff --git a/param/global_planner_params.yaml b/param/global_planner_params.yaml
deleted file mode 100755
index 6eae6b1..0000000
--- a/param/global_planner_params.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-GlobalPlanner: # Also see: http://wiki.ros.org/global_planner
- old_navfn_behavior: false # Exactly mirror behavior of navfn, use defaults for other boolean parameters, default false
- use_quadratic: true # Use the quadratic approximation of the potential. Otherwise, use a simpler calculation, default true
- use_dijkstra: true # Use dijkstra's algorithm. Otherwise, A*, default true
- use_grid_path: false # Create a path that follows the grid boundaries. Otherwise, use a gradient descent method, default false
- allow_unknown: true # Allow planner to plan through unknown space, default true
- #Needs to have track_unknown_space: true in the obstacle / voxel layer (in costmap_commons_param) to work
- planner_window_x: 0.0 # default 0.0
- planner_window_y: 0.0 # default 0.0
- default_tolerance: 0.0 # If goal in obstacle, plan to the closest point in radius default_tolerance, default 0.0
- publish_scale: 100 # Scale by which the published potential gets multiplied, default 100
- planner_costmap_publish_frequency: 0.0 # default 0.0
- lethal_cost: 253 # default 253
- neutral_cost: 50 # default 50
- cost_factor: 3.0 # Factor to multiply each cost from costmap by, default 3.0
- publish_potential: true # Publish Potential Costmap (this is not like the navfn pointcloud2 potential), default true
diff --git a/param/local_costmap_params.yaml b/param/local_costmap_params.yaml
deleted file mode 100755
index 53b7e1d..0000000
--- a/param/local_costmap_params.yaml
+++ /dev/null
@@ -1,14 +0,0 @@
-local_costmap:
- global_frame: /odom
- robot_base_frame: /base_link
- update_frequency: 5.0
- publish_frequency: 5.0
- static_map: false
- rolling_window: true
- width: 4.0
- height: 4.0
- resolution: 0.05
- transform_tolerance: 0.5
- #plugins:
- # - {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}
- # - {name: inflation_layer, type: "costmap_2d::InflationLayer"}
\ No newline at end of file
diff --git a/param/move_base_params.yaml b/param/move_base_params.yaml
deleted file mode 100755
index e2f6e66..0000000
--- a/param/move_base_params.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-# Move base node parameters. For full documentation of the parameters in this file, please see
-#
-# http://www.ros.org/wiki/move_base
-#
-shutdown_costmaps: false
-controller_frequency: 10.0
-controller_patience: 5.0
-
-planner_frequency: 1.0
-planner_patience: 5.0
-
-#oscillation_timeout: 10.0
-#oscillation_distance: 0.2
-
-# local planner - default is trajectory rollout
-base_local_planner: "base_local_planner/TrajectoryPlannerROS"
-base_global_planner: "navfn/NavfnROS" #alternatives: global_planner/GlobalPlanner, carrot_planner/CarrotPlanner
diff --git a/param/navfn_global_planner_params.yaml b/param/navfn_global_planner_params.yaml
deleted file mode 100755
index b4cee95..0000000
--- a/param/navfn_global_planner_params.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-NavfnROS:
- visualize_potential: false #Publish potential for rviz as pointcloud2, not really helpful, default false
- allow_unknown: false #Specifies whether or not to allow navfn to create plans that traverse unknown space, default true
- #Needs to have track_unknown_space: true in the obstacle / voxel layer (in costmap_commons_param) to work
- planner_window_x: 0.0 #Specifies the x size of an optional window to restrict the planner to, default 0.0
- planner_window_y: 0.0 #Specifies the y size of an optional window to restrict the planner to, default 0.0
- default_tolerance: 0.0 #If the goal is in an obstacle, the planer will plan to the nearest point in the radius of default_tolerance, default 0.0
- #The area is always searched, so could be slow for big values
\ No newline at end of file
diff --git a/rosserial/.gitignore b/rosserial/.gitignore
deleted file mode 100755
index 06e82a7..0000000
--- a/rosserial/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.pyc
-rosserial_server/doc/
diff --git a/rosserial/README.md b/rosserial/README.md
deleted file mode 100755
index 5638657..0000000
--- a/rosserial/README.md
+++ /dev/null
@@ -1,41 +0,0 @@
-## rosserial
-
-This repo is ported from https://kforge.ros.org/rosserial/hg. It has been catkinized and updated for ROS Groovy and onward.
-
-### Changes for Indigo
-
-Changes are being tracked on a per-package basis; please see the individual package folders,
-or use the "Changes" link on the right side of the package pages on the ROS wiki.
-
-### Changes for Hydro
-
-0.5.5
- * Add support for Arduino Yum
- * Release rosserial_server
-
-0.5.4
- * Fix a bug in string deserialization where part of length field could be uninitialized
-(issues 74 & 76)
-
-0.5.3
- * Add rosserial_server - a C++ server implementation
- * Fix misc bugs including adding fixes for alignment issues on ARM processors
-0.5.2
- * Wire protocol change to add checksum to message length
- * Support empty requests
- * Re-integrate rosserial_xbee
-
-### Changes for Groovy/Catkin
-
- * Moved to catkin build system
- * Moved rosserial_xbee to experimential stack
- * Created new rosserial metapackage, with depends only on python, client and msgs.
- * Closed, integrated and/or moved all tickets to github.
- * New message generation and workflow:
- * no longer uses roslib.rospack, or roslib.gentools (and is way, WAY faster)
- * messages are no longer built at built-time (yeah, sounds ridiculous, but is true, see below for new workflow)
- * beginnings of easier porting to new platforms (the lookup table is now found in architecture-dependent packages, etc)
-
-### Usage/Workflow
-
-Please see the [rosserial Tutorials on the ROS wiki](http://wiki.ros.org/rosserial_arduino/Tutorials) to get started.
diff --git a/rosserial/rosserial/CHANGELOG.rst b/rosserial/rosserial/CHANGELOG.rst
deleted file mode 100755
index 2dd1ad8..0000000
--- a/rosserial/rosserial/CHANGELOG.rst
+++ /dev/null
@@ -1,61 +0,0 @@
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Changelog for package rosserial
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-0.7.1 (2015-07-06)
-------------------
-
-0.7.0 (2015-04-23)
-------------------
-
-0.6.3 (2014-11-05)
-------------------
-
-0.6.2 (2014-09-10)
-------------------
-
-0.6.1 (2014-06-30)
-------------------
-
-0.6.0 (2014-06-11)
-------------------
-
-0.5.6 (2014-06-11)
-------------------
-
-0.5.5 (2014-01-14)
-------------------
-
-0.5.4 (2013-10-17)
-------------------
-
-0.5.3 (2013-09-21)
-------------------
-
-0.5.2 (2013-07-17)
-------------------
-
-* Fix release version
-
-0.5.1 (2013-07-15)
-------------------
-
-0.4.5 (2013-07-02)
-------------------
-* fixes catkin warnings (`#40 `_)
-
-0.4.4 (2013-03-20)
-------------------
-
-0.4.3 (2013-03-13 14:08)
-------------------------
-
-0.4.2 (2013-03-13 01:15)
-------------------------
-
-0.4.1 (2013-03-09)
-------------------
-
-0.4.0 (2013-03-08)
-------------------
-* make new metapackage
diff --git a/rosserial/rosserial/CMakeLists.txt b/rosserial/rosserial/CMakeLists.txt
deleted file mode 100755
index c2ce65f..0000000
--- a/rosserial/rosserial/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-cmake_minimum_required(VERSION 2.8.3)
-project(rosserial)
-find_package(catkin REQUIRED)
-catkin_metapackage()
diff --git a/rosserial/rosserial/package.xml b/rosserial/rosserial/package.xml
deleted file mode 100755
index 0f3d70a..0000000
--- a/rosserial/rosserial/package.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
- rosserial
- 0.7.1
-
- Metapackage for core of rosserial.
-
- Michael Ferguson
- Paul Bouchier
- Mike Purvis
- BSD
- http://ros.org/wiki/rosserial
-
- catkin
-
- rosserial_msgs
- rosserial_client
- rosserial_python
-
-
-
-
-
diff --git a/rosserial/rosserial_arduino/CHANGELOG.rst b/rosserial/rosserial_arduino/CHANGELOG.rst
deleted file mode 100755
index fb61d64..0000000
--- a/rosserial/rosserial_arduino/CHANGELOG.rst
+++ /dev/null
@@ -1,76 +0,0 @@
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Changelog for package rosserial_arduino
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-0.7.1 (2015-07-06)
-------------------
-
-0.7.0 (2015-04-23)
-------------------
-
-0.6.3 (2014-11-05)
-------------------
-* Fix for Arduino upload path issue.
-* Contributors: Mike Purvis
-
-0.6.2 (2014-09-10)
-------------------
-* Clean up rosserial_arduino/package.xml
-* Generic CMake helpers.
-* Contributors: Mike Purvis
-
-0.6.1 (2014-06-30)
-------------------
-
-0.6.0 (2014-06-11)
-------------------
-
-0.5.6 (2014-06-11)
-------------------
-* Add Mike Purvis as maintainer
-* Updated examples for Arduino 1.+
-* Added Teensy 3.1 support (MK20DX256)
-* Updated ArduinoHardware.h to add Teensy 3.0 support
-* Contributors: Michael Ferguson, Mike Purvis, Moju Zhao, Tony Baltovski, kjanesch
-
-0.5.5 (2014-01-14)
-------------------
-* Leonardo: Use the USB serial port for ROS messages option
-
-
-0.5.3 (2013-09-21)
-------------------
-* add support for leonardo and due
-
-0.5.2 (2013-07-17)
-------------------
-
-* Fix release version
-
-0.5.1 (2013-07-15)
-------------------
-
-0.4.5 (2013-07-02)
-------------------
-* Fixed a bug in ros_lib install logic which took an exception because it copied files to themselves
- Added execute permission to make_libraries.py in rosserial_embeddedlinux
- Moved examples under src in rosserial_embeddedlinux
-* fix package name
-
-0.4.4 (2013-03-20)
-------------------
-
-0.4.3 (2013-03-13 14:08)
-------------------------
-* forgot to remove install directives
-
-0.4.2 (2013-03-13 01:15)
-------------------------
-* fix build issues when in isolation by moving more stuff into make_library
-
-0.4.1 (2013-03-09)
-------------------
-
-0.4.0 (2013-03-08)
-------------------
-* initial catkin version on github
diff --git a/rosserial/rosserial_arduino/CMakeLists.txt b/rosserial/rosserial_arduino/CMakeLists.txt
deleted file mode 100755
index 592c952..0000000
--- a/rosserial/rosserial_arduino/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-cmake_minimum_required(VERSION 2.8.3)
-project(rosserial_arduino)
-
-find_package(catkin REQUIRED COMPONENTS message_generation)
-
-add_message_files(FILES
- Adc.msg
- )
-
-add_service_files(FILES
- Test.srv
- )
-
-generate_messages()
-
-catkin_package(
- CATKIN_DEPENDS message_runtime
- CFG_EXTRAS rosserial_arduino-extras.cmake
-)
-
-install(DIRECTORY src/ros_lib
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/src
-)
-
-install(DIRECTORY arduino-cmake
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
-)
-
-install(PROGRAMS src/rosserial_arduino/make_libraries.py
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
-)
-
-
-
diff --git a/rosserial/rosserial_arduino/arduino-cmake/cmake/ArduinoToolchain.cmake b/rosserial/rosserial_arduino/arduino-cmake/cmake/ArduinoToolchain.cmake
deleted file mode 100755
index f320898..0000000
--- a/rosserial/rosserial_arduino/arduino-cmake/cmake/ArduinoToolchain.cmake
+++ /dev/null
@@ -1,83 +0,0 @@
-#=============================================================================#
-# Author: Tomasz Bogdal (QueezyTheGreat)
-# Home: https://github.com/queezythegreat/arduino-cmake
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this file,
-# You can obtain one at http://mozilla.org/MPL/2.0/.
-#=============================================================================#
-set(CMAKE_SYSTEM_NAME Arduino)
-
-set(CMAKE_C_COMPILER avr-gcc)
-set(CMAKE_CXX_COMPILER avr-g++)
-
-# Add current directory to CMake Module path automatically
-if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/Platform/Arduino.cmake)
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR})
-endif()
-
-#=============================================================================#
-# System Paths #
-#=============================================================================#
-if(UNIX)
- include(Platform/UnixPaths)
- if(APPLE)
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH ~/Applications
- /Applications
- /Developer/Applications
- /sw # Fink
- /opt/local) # MacPorts
- endif()
-elseif(WIN32)
- include(Platform/WindowsPaths)
-endif()
-
-
-#=============================================================================#
-# Detect Arduino SDK #
-#=============================================================================#
-if(NOT ARDUINO_SDK_PATH)
- set(ARDUINO_PATHS)
-
- foreach(DETECT_VERSION_MAJOR 1)
- foreach(DETECT_VERSION_MINOR RANGE 5 0)
- list(APPEND ARDUINO_PATHS arduino-${DETECT_VERSION_MAJOR}.${DETECT_VERSION_MINOR})
- foreach(DETECT_VERSION_PATCH RANGE 3 0)
- list(APPEND ARDUINO_PATHS arduino-${DETECT_VERSION_MAJOR}.${DETECT_VERSION_MINOR}.${DETECT_VERSION_PATCH})
- endforeach()
- endforeach()
- endforeach()
-
- foreach(VERSION RANGE 23 19)
- list(APPEND ARDUINO_PATHS arduino-00${VERSION})
- endforeach()
-
- if(UNIX)
- file(GLOB SDK_PATH_HINTS /usr/share/arduino*
- /opt/local/arduino*
- /opt/arduino*
- /usr/local/share/arduino*)
- elseif(WIN32)
- set(SDK_PATH_HINTS "C:\\Program Files\\Arduino"
- "C:\\Program Files (x86)\\Arduino"
- )
- endif()
- list(SORT SDK_PATH_HINTS)
- list(REVERSE SDK_PATH_HINTS)
-endif()
-
-find_path(ARDUINO_SDK_PATH
- NAMES lib/version.txt
- PATH_SUFFIXES share/arduino
- Arduino.app/Contents/Resources/Java/
- ${ARDUINO_PATHS}
- HINTS ${SDK_PATH_HINTS}
- DOC "Arduino SDK path.")
-
-if(ARDUINO_SDK_PATH)
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${ARDUINO_SDK_PATH}/hardware/tools/avr)
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${ARDUINO_SDK_PATH}/hardware/tools/avr/utils)
-else()
- message(FATAL_ERROR "Could not find Arduino SDK (set ARDUINO_SDK_PATH)!")
-endif()
-
diff --git a/rosserial/rosserial_arduino/arduino-cmake/cmake/Platform/Arduino.cmake b/rosserial/rosserial_arduino/arduino-cmake/cmake/Platform/Arduino.cmake
deleted file mode 100755
index 4f037cc..0000000
--- a/rosserial/rosserial_arduino/arduino-cmake/cmake/Platform/Arduino.cmake
+++ /dev/null
@@ -1,2232 +0,0 @@
-#=============================================================================#
-# generate_arduino_firmware(name
-# [BOARD board_id]
-# [SKETCH sketch_path |
-# SRCS src1 src2 ... srcN]
-# [HDRS hdr1 hdr2 ... hdrN]
-# [LIBS lib1 lib2 ... libN]
-# [PORT port]
-# [SERIAL serial_cmd]
-# [PROGRAMMER programmer_id]
-# [AFLAGS flags]
-# [NO_AUTOLIBS]
-# [MANUAL])
-#
-#=============================================================================#
-#
-# generaters firmware and libraries for Arduino devices
-#
-# The arguments are as follows:
-#
-# name # The name of the firmware target [REQUIRED]
-# BOARD # Board name (such as uno, mega2560, ...) [REQUIRED]
-# SKETCH # Arduino sketch [must have SRCS or SKETCH]
-# SRCS # Sources [must have SRCS or SKETCH]
-# HDRS # Headers
-# LIBS # Libraries to link
-# ARDLIBS # Arduino libraries to link (Wire, Servo, SPI, etc)
-# PORT # Serial port (enables upload support)
-# SERIAL # Serial command for serial target
-# PROGRAMMER # Programmer id (enables programmer support)
-# AFLAGS # Avrdude flags for target
-# NO_AUTOLIBS # Disables Arduino library detection
-# MANUAL # (Advanced) Only use AVR Libc/Includes
-#
-# Here is a short example for a target named test:
-#
-# generate_arduino_firmware(
-# NAME test
-# SRCS test.cpp
-# test2.cpp
-# HDRS test.h test2.h
-# BOARD uno)
-#
-# Alternatively you can specify the option by variables:
-#
-# set(test_SRCS test.cpp test2.cpp)
-# set(test_HDRS test.h test2.h
-# set(test_BOARD uno)
-#
-# generate_arduino_firmware(test)
-#
-# All variables need to be prefixed with the target name (${TARGET_NAME}_${OPTION}).
-#
-#=============================================================================#
-# generate_avr_firmware(name
-# [BOARD board_id]
-# SRCS src1 src2 ... srcN]
-# [HDRS hdr1 hdr2 ... hdrN]
-# [LIBS lib1 lib2 ... libN]
-# [PORT port]
-# [SERIAL serial_cmd]
-# [PROGRAMMER programmer_id]
-# [AFLAGS flags])
-#=============================================================================#
-#
-# generaters firmware and libraries for AVR devices
-# it simply calls generate_arduino_firmware() with NO_AUTOLIBS and MANUAL
-#
-# The arguments are as follows:
-#
-# name # The name of the firmware target [REQUIRED]
-# BOARD # Board name (such as uno, mega2560, ...) [REQUIRED]
-# SRCS # Sources [REQUIRED]
-# HDRS # Headers
-# LIBS # Libraries to link
-# PORT # Serial port (enables upload support)
-# SERIAL # Serial command for serial target
-# PROGRAMMER # Programmer id (enables programmer support)
-# AFLAGS # Avrdude flags for target
-#
-# Here is a short example for a target named test:
-#
-# generate_avr_firmware(
-# NAME test
-# SRCS test.cpp
-# test2.cpp
-# HDRS test.h test2.h
-# BOARD uno)
-#
-# Alternatively you can specify the option by variables:
-#
-# set(test_SRCS test.cpp test2.cpp)
-# set(test_HDRS test.h test2.h
-# set(test_BOARD uno)
-#
-# generate_avr_firmware(test)
-#
-# All variables need to be prefixed with the target name (${TARGET_NAME}_${OPTION}).
-#
-#=============================================================================#
-# generate_arduino_library(name
-# [BOARD board_id]
-# [SRCS src1 src2 ... srcN]
-# [HDRS hdr1 hdr2 ... hdrN]
-# [LIBS lib1 lib2 ... libN]
-# [NO_AUTOLIBS]
-# [MANUAL])
-#=============================================================================#
-# generaters firmware and libraries for Arduino devices
-#
-# The arguments are as follows:
-#
-# name # The name of the firmware target [REQUIRED]
-# BOARD # Board name (such as uno, mega2560, ...) [REQUIRED]
-# SRCS # Sources [REQUIRED]
-# HDRS # Headers
-# LIBS # Libraries to link
-# NO_AUTOLIBS # Disables Arduino library detection
-# MANUAL # (Advanced) Only use AVR Libc/Includes
-#
-# Here is a short example for a target named test:
-#
-# generate_arduino_library(
-# NAME test
-# SRCS test.cpp
-# test2.cpp
-# HDRS test.h test2.h
-# BOARD uno)
-#
-# Alternatively you can specify the option by variables:
-#
-# set(test_SRCS test.cpp test2.cpp)
-# set(test_HDRS test.h test2.h
-# set(test_BOARD uno)
-#
-# generate_arduino_library(test)
-#
-# All variables need to be prefixed with the target name (${TARGET_NAME}_${OPTION}).
-#
-#=============================================================================#
-# generate_avr_library(name
-# [BOARD board_id]
-# [SRCS src1 src2 ... srcN]
-# [HDRS hdr1 hdr2 ... hdrN]
-# [LIBS lib1 lib2 ... libN])
-#=============================================================================#
-# generaters firmware and libraries for AVR devices
-# it simply calls generate_arduino_library() with NO_AUTOLIBS and MANUAL
-#
-# The arguments are as follows:
-#
-# name # The name of the firmware target [REQUIRED]
-# BOARD # Board name (such as uno, mega2560, ...) [REQUIRED]
-# SRCS # Sources [REQUIRED]
-# HDRS # Headers
-# LIBS # Libraries to link
-#
-# Here is a short example for a target named test:
-#
-# generate_avr_library(
-# NAME test
-# SRCS test.cpp
-# test2.cpp
-# HDRS test.h test2.h
-# BOARD uno)
-#
-# Alternatively you can specify the option by variables:
-#
-# set(test_SRCS test.cpp test2.cpp)
-# set(test_HDRS test.h test2.h
-# set(test_BOARD uno)
-#
-# generate_avr_library(test)
-#
-# All variables need to be prefixed with the target name (${TARGET_NAME}_${OPTION}).
-#
-#=============================================================================#
-# generate_arduino_example(name
-# LIBRARY library_name
-# EXAMPLE example_name
-# [BOARD board_id]
-# [PORT port]
-# [SERIAL serial command]
-# [PORGRAMMER programmer_id]
-# [AFLAGS avrdude_flags])
-#=============================================================================#
-#
-# name - The name of the library example [REQUIRED]
-# LIBRARY - Library name [REQUIRED]
-# EXAMPLE - Example name [REQUIRED]
-# BOARD - Board ID
-# PORT - Serial port [optional]
-# SERIAL - Serial command [optional]
-# PROGRAMMER - Programmer id (enables programmer support)
-# AFLAGS - Avrdude flags for target
-#
-# Creates a example from the specified library.
-#
-#
-#=============================================================================#
-# print_board_list()
-#=============================================================================#
-#
-# Print list of detected Arduino Boards.
-#
-#=============================================================================#
-# print_programmer_list()
-#=============================================================================#
-#
-# Print list of detected Programmers.
-#
-#=============================================================================#
-# print_programmer_settings(PROGRAMMER)
-#=============================================================================#
-#
-# PROGRAMMER - programmer id
-#
-# Print the detected Programmer settings.
-#
-#=============================================================================#
-# print_board_settings(ARDUINO_BOARD)
-#=============================================================================#
-#
-# ARDUINO_BOARD - Board id
-#
-# Print the detected Arduino board settings.
-#
-#=============================================================================#
-# register_hardware_platform(HARDWARE_PLATFORM_PATH)
-#=============================================================================#
-#
-# HARDWARE_PLATFORM_PATH - Hardware platform path
-#
-# Registers a Hardware Platform path.
-# See: http://code.google.com/p/arduino/wiki/Platforms
-#
-# This enables you to register new types of hardware platforms such as the
-# Sagnuino, without having to copy the files into your Arduion SDK.
-#
-# A Hardware Platform is a directory containing the following:
-#
-# HARDWARE_PLATFORM_PATH/
-# |-- bootloaders/
-# |-- cores/
-# |-- variants/
-# |-- boards.txt
-# `-- programmers.txt
-#
-# The board.txt describes the target boards and bootloaders. While
-# programmers.txt the programmer defintions.
-#
-# A good example of a Hardware Platform is in the Arduino SDK:
-#
-# ${ARDUINO_SDK_PATH}/hardware/arduino/
-#
-#=============================================================================#
-# Configuration Options
-#=============================================================================#
-#
-# ARDUINO_SDK_PATH - Arduino SDK Path
-# ARDUINO_AVRDUDE_PROGRAM - Full path to avrdude programmer
-# ARDUINO_AVRDUDE_CONFIG_PATH - Full path to avrdude configuration file
-#
-# ARDUINO_C_FLAGS - C compiler flags
-# ARDUINO_CXX_FLAGS - C++ compiler flags
-# ARDUINO_LINKER_FLAGS - Linker flags
-#
-# ARDUINO_DEFAULT_BOARD - Default Arduino Board ID when not specified.
-# ARDUINO_DEFAULT_PORT - Default Arduino port when not specified.
-# ARDUINO_DEFAULT_SERIAL - Default Arduino Serial command when not specified.
-# ARDUINO_DEFAULT_PROGRAMMER - Default Arduino Programmer ID when not specified.
-#
-#
-# ARDUINO_FOUND - Set to True when the Arduino SDK is detected and configured.
-# ARDUINO_SDK_VERSION - Set to the version of the detected Arduino SDK (ex: 1.0)
-
-#=============================================================================#
-# Author: Tomasz Bogdal (QueezyTheGreat)
-# Home: https://github.com/queezythegreat/arduino-cmake
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this file,
-# You can obtain one at http://mozilla.org/MPL/2.0/.
-#=============================================================================#
-cmake_minimum_required(VERSION 2.8.5)
-include(CMakeParseArguments)
-
-
-
-
-
-
-#=============================================================================#
-# User Functions
-#=============================================================================#
-
-#=============================================================================#
-# [PUBLIC/USER]
-#
-# print_board_list()
-#
-# see documentation at top
-#=============================================================================#
-function(PRINT_BOARD_LIST)
- foreach(PLATFORM ${ARDUINO_PLATFORMS})
- if(${PLATFORM}_BOARDS)
- message(STATUS "${PLATFORM} Boards:")
- print_list(${PLATFORM}_BOARDS)
- message(STATUS "")
- endif()
- endforeach()
-endfunction()
-
-#=============================================================================#
-# [PUBLIC/USER]
-#
-# print_programmer_list()
-#
-# see documentation at top
-#=============================================================================#
-function(PRINT_PROGRAMMER_LIST)
- foreach(PLATFORM ${ARDUINO_PLATFORMS})
- if(${PLATFORM}_PROGRAMMERS)
- message(STATUS "${PLATFORM} Programmers:")
- print_list(${PLATFORM}_PROGRAMMERS)
- endif()
- message(STATUS "")
- endforeach()
-endfunction()
-
-#=============================================================================#
-# [PUBLIC/USER]
-#
-# print_programmer_settings(PROGRAMMER)
-#
-# see documentation at top
-#=============================================================================#
-function(PRINT_PROGRAMMER_SETTINGS PROGRAMMER)
- if(${PROGRAMMER}.SETTINGS)
- message(STATUS "Programmer ${PROGRAMMER} Settings:")
- print_settings(${PROGRAMMER})
- endif()
-endfunction()
-
-# [PUBLIC/USER]
-#
-# print_board_settings(ARDUINO_BOARD)
-#
-# see documentation at top
-function(PRINT_BOARD_SETTINGS ARDUINO_BOARD)
- if(${ARDUINO_BOARD}.SETTINGS)
- message(STATUS "Arduino ${ARDUINO_BOARD} Board:")
- print_settings(${ARDUINO_BOARD})
- endif()
-endfunction()
-
-#=============================================================================#
-# [PUBLIC/USER]
-# see documentation at top
-#=============================================================================#
-function(GENERATE_ARDUINO_LIBRARY INPUT_NAME)
- message(STATUS "Generating ${INPUT_NAME}")
- parse_generator_arguments(${INPUT_NAME} INPUT
- "NO_AUTOLIBS;MANUAL" # Options
- "BOARD" # One Value Keywords
- "SRCS;HDRS;LIBS" # Multi Value Keywords
- ${ARGN})
-
- if(NOT INPUT_BOARD)
- set(INPUT_BOARD ${ARDUINO_DEFAULT_BOARD})
- endif()
- if(NOT INPUT_MANUAL)
- set(INPUT_MANUAL FALSE)
- endif()
- required_variables(VARS INPUT_SRCS INPUT_BOARD MSG "must define for target ${INPUT_NAME}")
-
- set(ALL_LIBS)
- set(ALL_SRCS ${INPUT_SRCS} ${INPUT_HDRS})
-
- if(NOT INPUT_MANUAL)
- setup_arduino_core(CORE_LIB ${INPUT_BOARD})
- endif()
-
- find_arduino_libraries(TARGET_LIBS "${ALL_SRCS}" "")
- set(LIB_DEP_INCLUDES)
- foreach(LIB_DEP ${TARGET_LIBS})
- set(LIB_DEP_INCLUDES "${LIB_DEP_INCLUDES} -I\"${LIB_DEP}\"")
- endforeach()
-
- if(NOT ${INPUT_NO_AUTOLIBS})
- setup_arduino_libraries(ALL_LIBS ${INPUT_BOARD} "${ALL_SRCS}" "" "${LIB_DEP_INCLUDES}" "")
- endif()
-
- list(APPEND ALL_LIBS ${CORE_LIB} ${INPUT_LIBS})
-
- add_library(${INPUT_NAME} ${ALL_SRCS})
-
- get_arduino_flags(ARDUINO_COMPILE_FLAGS ARDUINO_LINK_FLAGS ${INPUT_BOARD} ${INPUT_MANUAL})
-
- set_target_properties(${INPUT_NAME} PROPERTIES
- COMPILE_FLAGS "${ARDUINO_COMPILE_FLAGS} ${COMPILE_FLAGS} ${LIB_DEP_INCLUDES}"
- LINK_FLAGS "${ARDUINO_LINK_FLAGS} ${LINK_FLAGS}")
-
- target_link_libraries(${INPUT_NAME} ${ALL_LIBS} "-lc -lm")
-endfunction()
-
-#=============================================================================#
-# [PUBLIC/USER]
-# see documentation at top
-#=============================================================================#
-function(GENERATE_AVR_LIBRARY INPUT_NAME)
- message(STATUS "Generating ${INPUT_NAME}")
- parse_generator_arguments(${INPUT_NAME} INPUT
- "NO_AUTOLIBS;MANUAL" # Options
- "BOARD" # One Value Keywords
- "SRCS;HDRS;LIBS" # Multi Value Keywords
- ${ARGN})
-
- if(NOT INPUT_BOARD)
- set(INPUT_BOARD ${ARDUINO_DEFAULT_BOARD})
- endif()
-
- required_variables(VARS INPUT_SRCS INPUT_BOARD MSG "must define for target ${INPUT_NAME}")
-
- if(INPUT_HDRS)
- set( INPUT_HDRS "SRCS ${INPUT_HDRS}" )
- endif()
- if(INPUT_LIBS)
- set( INPUT_LIBS "LIBS ${INPUT_LIBS}" )
- endif()
-
- if(INPUT_HDRS)
- list(INSERT INPUT_HDRS 0 "HDRS")
- endif()
- if(INPUT_LIBS)
- list(INSERT INPUT_LIBS 0 "LIBS")
- endif()
-
-
- generate_arduino_library( ${INPUT_NAME}
- NO_AUTOLIBS
- MANUAL
- BOARD ${INPUT_BOARD}
- SRCS ${INPUT_SRCS}
- ${INPUT_HDRS}
- ${INPUT_LIBS} )
-
-endfunction()
-
-#=============================================================================#
-# [PUBLIC/USER]
-# see documentation at top
-#=============================================================================#
-function(GENERATE_ARDUINO_FIRMWARE INPUT_NAME)
- message(STATUS "Generating ${INPUT_NAME}")
- parse_generator_arguments(${INPUT_NAME} INPUT
- "NO_AUTOLIBS;MANUAL" # Options
- "BOARD;PORT;SKETCH;PROGRAMMER" # One Value Keywords
- "SERIAL;SRCS;HDRS;LIBS;ARDLIBS;AFLAGS" # Multi Value Keywords
- ${ARGN})
-
- if(NOT INPUT_BOARD)
- set(INPUT_BOARD ${ARDUINO_DEFAULT_BOARD})
- endif()
- if(NOT INPUT_PORT)
- set(INPUT_PORT ${ARDUINO_DEFAULT_PORT})
- endif()
- if(NOT INPUT_SERIAL)
- set(INPUT_SERIAL ${ARDUINO_DEFAULT_SERIAL})
- endif()
- if(NOT INPUT_PROGRAMMER)
- set(INPUT_PROGRAMMER ${ARDUINO_DEFAULT_PROGRAMMER})
- endif()
- if(NOT INPUT_MANUAL)
- set(INPUT_MANUAL FALSE)
- endif()
- required_variables(VARS INPUT_BOARD MSG "must define for target ${INPUT_NAME}")
-
- set(ALL_LIBS)
- set(ALL_SRCS ${INPUT_SRCS} ${INPUT_HDRS})
- set(LIB_DEP_INCLUDES)
-
- if(NOT INPUT_MANUAL)
- setup_arduino_core(CORE_LIB ${INPUT_BOARD})
- endif()
-
- if(NOT "${INPUT_SKETCH}" STREQUAL "")
- get_filename_component(INPUT_SKETCH "${INPUT_SKETCH}" ABSOLUTE)
- setup_arduino_sketch(${INPUT_NAME} ${INPUT_SKETCH} ALL_SRCS)
- if (IS_DIRECTORY "${INPUT_SKETCH}")
- set(LIB_DEP_INCLUDES "${LIB_DEP_INCLUDES} -I\"${INPUT_SKETCH}\"")
- else()
- get_filename_component(INPUT_SKETCH_PATH "${INPUT_SKETCH}" PATH)
- set(LIB_DEP_INCLUDES "${LIB_DEP_INCLUDES} -I\"${INPUT_SKETCH_PATH}\"")
- endif()
- endif()
-
- required_variables(VARS ALL_SRCS MSG "must define SRCS or SKETCH for target ${INPUT_NAME}")
-
- find_arduino_libraries(TARGET_LIBS "${ALL_SRCS}" "${INPUT_ARDLIBS}")
- foreach(LIB_DEP ${TARGET_LIBS})
- arduino_debug_msg("Arduino Library: ${LIB_DEP}")
- set(LIB_DEP_INCLUDES "${LIB_DEP_INCLUDES} -I\"${LIB_DEP}\"")
- endforeach()
-
- if(NOT INPUT_NO_AUTOLIBS)
- setup_arduino_libraries(ALL_LIBS ${INPUT_BOARD} "${ALL_SRCS}" "${INPUT_ARDLIBS}" "${LIB_DEP_INCLUDES}" "")
- foreach(LIB_INCLUDES ${ALL_LIBS_INCLUDES})
- arduino_debug_msg("Arduino Library Includes: ${LIB_INCLUDES}")
- set(LIB_DEP_INCLUDES "${LIB_DEP_INCLUDES} ${LIB_INCLUDES}")
- endforeach()
- endif()
-
- list(APPEND ALL_LIBS ${CORE_LIB} ${INPUT_LIBS})
-
- setup_arduino_target(${INPUT_NAME} ${INPUT_BOARD} "${ALL_SRCS}" "${ALL_LIBS}" "${LIB_DEP_INCLUDES}" "" "${INPUT_MANUAL}")
-
- if(INPUT_PORT)
- setup_arduino_upload(${INPUT_BOARD} ${INPUT_NAME} ${INPUT_PORT} "${INPUT_PROGRAMMER}" "${INPUT_AFLAGS}")
- endif()
-
- if(INPUT_SERIAL)
- setup_serial_target(${INPUT_NAME} "${INPUT_SERIAL}" "${INPUT_PORT}")
- endif()
-
-endfunction()
-
-#=============================================================================#
-# [PUBLIC/USER]
-# see documentation at top
-#=============================================================================#
-function(GENERATE_AVR_FIRMWARE INPUT_NAME)
- # TODO: This is not optimal!!!!
- message(STATUS "Generating ${INPUT_NAME}")
- parse_generator_arguments(${INPUT_NAME} INPUT
- "NO_AUTOLIBS;MANUAL" # Options
- "BOARD;PORT;PROGRAMMER" # One Value Keywords
- "SERIAL;SRCS;HDRS;LIBS;AFLAGS" # Multi Value Keywords
- ${ARGN})
-
- if(NOT INPUT_BOARD)
- set(INPUT_BOARD ${ARDUINO_DEFAULT_BOARD})
- endif()
- if(NOT INPUT_PORT)
- set(INPUT_PORT ${ARDUINO_DEFAULT_PORT})
- endif()
- if(NOT INPUT_SERIAL)
- set(INPUT_SERIAL ${ARDUINO_DEFAULT_SERIAL})
- endif()
- if(NOT INPUT_PROGRAMMER)
- set(INPUT_PROGRAMMER ${ARDUINO_DEFAULT_PROGRAMMER})
- endif()
-
- required_variables(VARS INPUT_BOARD INPUT_SRCS MSG "must define for target ${INPUT_NAME}")
-
- if(INPUT_HDRS)
- list(INSERT INPUT_HDRS 0 "HDRS")
- endif()
- if(INPUT_LIBS)
- list(INSERT INPUT_LIBS 0 "LIBS")
- endif()
- if(INPUT_AFLAGS)
- list(INSERT INPUT_AFLAGS 0 "AFLAGS")
- endif()
-
- generate_arduino_firmware( ${INPUT_NAME}
- NO_AUTOLIBS
- MANUAL
- BOARD ${INPUT_BOARD}
- PORT ${INPUT_PORT}
- PROGRAMMER ${INPUT_PROGRAMMER}
- SERIAL ${INPUT_SERIAL}
- SRCS ${INPUT_SRCS}
- ${INPUT_HDRS}
- ${INPUT_LIBS}
- ${INPUT_AFLAGS} )
-
-endfunction()
-
-#=============================================================================#
-# [PUBLIC/USER]
-# see documentation at top
-#=============================================================================#
-function(GENERATE_ARDUINO_EXAMPLE INPUT_NAME)
- parse_generator_arguments(${INPUT_NAME} INPUT
- "" # Options
- "LIBRARY;EXAMPLE;BOARD;PORT;PROGRAMMER" # One Value Keywords
- "SERIAL;AFLAGS" # Multi Value Keywords
- ${ARGN})
-
-
- if(NOT INPUT_BOARD)
- set(INPUT_BOARD ${ARDUINO_DEFAULT_BOARD})
- endif()
- if(NOT INPUT_PORT)
- set(INPUT_PORT ${ARDUINO_DEFAULT_PORT})
- endif()
- if(NOT INPUT_SERIAL)
- set(INPUT_SERIAL ${ARDUINO_DEFAULT_SERIAL})
- endif()
- if(NOT INPUT_PROGRAMMER)
- set(INPUT_PROGRAMMER ${ARDUINO_DEFAULT_PROGRAMMER})
- endif()
- required_variables(VARS INPUT_LIBRARY INPUT_EXAMPLE INPUT_BOARD
- MSG "must define for target ${INPUT_NAME}")
-
- message(STATUS "Generating ${INPUT_NAME}")
-
- set(ALL_LIBS)
- set(ALL_SRCS)
-
- setup_arduino_core(CORE_LIB ${INPUT_BOARD})
-
- setup_arduino_example("${INPUT_NAME}" "${INPUT_LIBRARY}" "${INPUT_EXAMPLE}" ALL_SRCS)
-
- if(NOT ALL_SRCS)
- message(FATAL_ERROR "Missing sources for example, aborting!")
- endif()
-
- find_arduino_libraries(TARGET_LIBS "${ALL_SRCS}" "")
- set(LIB_DEP_INCLUDES)
- foreach(LIB_DEP ${TARGET_LIBS})
- set(LIB_DEP_INCLUDES "${LIB_DEP_INCLUDES} -I\"${LIB_DEP}\"")
- endforeach()
-
- setup_arduino_libraries(ALL_LIBS ${INPUT_BOARD} "${ALL_SRCS}" "" "${LIB_DEP_INCLUDES}" "")
-
- list(APPEND ALL_LIBS ${CORE_LIB} ${INPUT_LIBS})
-
- setup_arduino_target(${INPUT_NAME} ${INPUT_BOARD} "${ALL_SRCS}" "${ALL_LIBS}" "${LIB_DEP_INCLUDES}" "" FALSE)
-
- if(INPUT_PORT)
- setup_arduino_upload(${INPUT_BOARD} ${INPUT_NAME} ${INPUT_PORT} "${INPUT_PROGRAMMER}" "${INPUT_AFLAGS}")
- endif()
-
- if(INPUT_SERIAL)
- setup_serial_target(${INPUT_NAME} "${INPUT_SERIAL}" "${INPUT_PORT}")
- endif()
-endfunction()
-
-#=============================================================================#
-# [PUBLIC/USER]
-# see documentation at top
-#=============================================================================#
-function(REGISTER_HARDWARE_PLATFORM PLATFORM_PATH)
- string(REGEX REPLACE "/$" "" PLATFORM_PATH ${PLATFORM_PATH})
- GET_FILENAME_COMPONENT(PLATFORM ${PLATFORM_PATH} NAME)
-
- if(PLATFORM)
- string(TOUPPER ${PLATFORM} PLATFORM)
- list(FIND ARDUINO_PLATFORMS ${PLATFORM} platform_exists)
-
- if (platform_exists EQUAL -1)
- set(${PLATFORM}_PLATFORM_PATH ${PLATFORM_PATH} CACHE INTERNAL "The path to ${PLATFORM}")
- set(ARDUINO_PLATFORMS ${ARDUINO_PLATFORMS} ${PLATFORM} CACHE INTERNAL "A list of registered platforms")
-
- find_file(${PLATFORM}_CORES_PATH
- NAMES cores
- PATHS ${PLATFORM_PATH}
- DOC "Path to directory containing the Arduino core sources.")
-
- find_file(${PLATFORM}_VARIANTS_PATH
- NAMES variants
- PATHS ${PLATFORM_PATH}
- DOC "Path to directory containing the Arduino variant sources.")
-
- find_file(${PLATFORM}_BOOTLOADERS_PATH
- NAMES bootloaders
- PATHS ${PLATFORM_PATH}
- DOC "Path to directory containing the Arduino bootloader images and sources.")
-
- find_file(${PLATFORM}_PROGRAMMERS_PATH
- NAMES programmers.txt
- PATHS ${PLATFORM_PATH}
- DOC "Path to Arduino programmers definition file.")
-
- find_file(${PLATFORM}_BOARDS_PATH
- NAMES boards.txt
- PATHS ${PLATFORM_PATH}
- DOC "Path to Arduino boards definition file.")
-
- if(${PLATFORM}_BOARDS_PATH)
- load_arduino_style_settings(${PLATFORM}_BOARDS "${PLATFORM_PATH}/boards.txt")
- endif()
-
- if(${PLATFORM}_PROGRAMMERS_PATH)
- load_arduino_style_settings(${PLATFORM}_PROGRAMMERS "${ARDUINO_PROGRAMMERS_PATH}")
- endif()
-
- if(${PLATFORM}_VARIANTS_PATH)
- file(GLOB sub-dir ${${PLATFORM}_VARIANTS_PATH}/*)
- foreach(dir ${sub-dir})
- if(IS_DIRECTORY ${dir})
- get_filename_component(variant ${dir} NAME)
- set(VARIANTS ${VARIANTS} ${variant} CACHE INTERNAL "A list of registered variant boards")
- set(${variant}.path ${dir} CACHE INTERNAL "The path to the variant ${variant}")
- endif()
- endforeach()
- endif()
-
- if(${PLATFORM}_CORES_PATH)
- file(GLOB sub-dir ${${PLATFORM}_CORES_PATH}/*)
- foreach(dir ${sub-dir})
- if(IS_DIRECTORY ${dir})
- get_filename_component(core ${dir} NAME)
- set(CORES ${CORES} ${core} CACHE INTERNAL "A list of registered cores")
- set(${core}.path ${dir} CACHE INTERNAL "The path to the core ${core}")
- endif()
- endforeach()
- endif()
- endif()
- endif()
-
-endfunction()
-
-#=============================================================================#
-# Internal Functions
-#=============================================================================#
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# parse_generator_arguments(TARGET_NAME PREFIX OPTIONS ARGS MULTI_ARGS [ARG1 ARG2 .. ARGN])
-#
-# PREFIX - Parsed options prefix
-# OPTIONS - List of options
-# ARGS - List of one value keyword arguments
-# MULTI_ARGS - List of multi value keyword arguments
-# [ARG1 ARG2 .. ARGN] - command arguments [optional]
-#
-# Parses generator options from either variables or command arguments
-#
-#=============================================================================#
-macro(PARSE_GENERATOR_ARGUMENTS TARGET_NAME PREFIX OPTIONS ARGS MULTI_ARGS)
- cmake_parse_arguments(${PREFIX} "${OPTIONS}" "${ARGS}" "${MULTI_ARGS}" ${ARGN})
- error_for_unparsed(${PREFIX})
- load_generator_settings(${TARGET_NAME} ${PREFIX} ${OPTIONS} ${ARGS} ${MULTI_ARGS})
-endmacro()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# load_generator_settings(TARGET_NAME PREFIX [SUFFIX_1 SUFFIX_2 .. SUFFIX_N])
-#
-# TARGET_NAME - The base name of the user settings
-# PREFIX - The prefix name used for generator settings
-# SUFFIX_XX - List of suffixes to load
-#
-# Loads a list of user settings into the generators scope. User settings have
-# the following syntax:
-#
-# ${BASE_NAME}${SUFFIX}
-#
-# The BASE_NAME is the target name and the suffix is a specific generator settings.
-#
-# For every user setting found a generator setting is created of the follwoing fromat:
-#
-# ${PREFIX}${SUFFIX}
-#
-# The purpose of loading the settings into the generator is to not modify user settings
-# and to have a generic naming of the settings within the generator.
-#
-#=============================================================================#
-function(LOAD_GENERATOR_SETTINGS TARGET_NAME PREFIX)
- foreach(GEN_SUFFIX ${ARGN})
- if(${TARGET_NAME}_${GEN_SUFFIX} AND NOT ${PREFIX}_${GEN_SUFFIX})
- set(${PREFIX}_${GEN_SUFFIX} ${${TARGET_NAME}_${GEN_SUFFIX}} PARENT_SCOPE)
- endif()
- endforeach()
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# get_arduino_flags(COMPILE_FLAGS LINK_FLAGS BOARD_ID MANUAL)
-#
-# COMPILE_FLAGS_VAR -Variable holding compiler flags
-# LINK_FLAGS_VAR - Variable holding linker flags
-# BOARD_ID - The board id name
-# MANUAL - (Advanced) Only use AVR Libc/Includes
-#
-# Configures the the build settings for the specified Arduino Board.
-#
-#=============================================================================#
-function(get_arduino_flags COMPILE_FLAGS_VAR LINK_FLAGS_VAR BOARD_ID MANUAL)
-
- set(BOARD_CORE ${${BOARD_ID}.build.core})
- if(BOARD_CORE)
- if(ARDUINO_SDK_VERSION MATCHES "([0-9]+)[.]([0-9]+)")
- string(REPLACE "." "" ARDUINO_VERSION_DEFINE "${ARDUINO_SDK_VERSION}") # Normalize version (remove all periods)
- set(ARDUINO_VERSION_DEFINE "")
- if(CMAKE_MATCH_1 GREATER 0)
- set(ARDUINO_VERSION_DEFINE "${CMAKE_MATCH_1}")
- endif()
- if(CMAKE_MATCH_2 GREATER 10)
- set(ARDUINO_VERSION_DEFINE "${ARDUINO_VERSION_DEFINE}${CMAKE_MATCH_2}")
- else()
- set(ARDUINO_VERSION_DEFINE "${ARDUINO_VERSION_DEFINE}0${CMAKE_MATCH_2}")
- endif()
- else()
- message("Invalid Arduino SDK Version (${ARDUINO_SDK_VERSION})")
- endif()
-
- # output
- set(COMPILE_FLAGS "-DF_CPU=${${BOARD_ID}.build.f_cpu} -DARDUINO=${ARDUINO_VERSION_DEFINE} -mmcu=${${BOARD_ID}.build.mcu}")
- if(DEFINED ${BOARD_ID}.build.vid)
- set(COMPILE_FLAGS "${COMPILE_FLAGS} -DUSB_VID=${${BOARD_ID}.build.vid}")
- endif()
- if(DEFINED ${BOARD_ID}.build.pid)
- set(COMPILE_FLAGS "${COMPILE_FLAGS} -DUSB_PID=${${BOARD_ID}.build.pid}")
- endif()
- if(NOT MANUAL)
- set(COMPILE_FLAGS "${COMPILE_FLAGS} -I\"${${BOARD_CORE}.path}\" -I\"${ARDUINO_LIBRARIES_PATH}\"")
- endif()
- set(LINK_FLAGS "-mmcu=${${BOARD_ID}.build.mcu}")
- if(ARDUINO_SDK_VERSION VERSION_GREATER 1.0 OR ARDUINO_SDK_VERSION VERSION_EQUAL 1.0)
- if(NOT MANUAL)
- set(PIN_HEADER ${${${BOARD_ID}.build.variant}.path})
- if(PIN_HEADER)
- set(COMPILE_FLAGS "${COMPILE_FLAGS} -I\"${PIN_HEADER}\"")
- endif()
- endif()
- endif()
-
- # output
- set(${COMPILE_FLAGS_VAR} "${COMPILE_FLAGS}" PARENT_SCOPE)
- set(${LINK_FLAGS_VAR} "${LINK_FLAGS}" PARENT_SCOPE)
-
- else()
- message(FATAL_ERROR "Invalid Arduino board ID (${BOARD_ID}), aborting.")
- endif()
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# setup_arduino_core(VAR_NAME BOARD_ID)
-#
-# VAR_NAME - Variable name that will hold the generated library name
-# BOARD_ID - Arduino board id
-#
-# Creates the Arduino Core library for the specified board,
-# each board gets it's own version of the library.
-#
-#=============================================================================#
-function(setup_arduino_core VAR_NAME BOARD_ID)
- set(CORE_LIB_NAME ${BOARD_ID}_CORE)
- set(BOARD_CORE ${${BOARD_ID}.build.core})
- if(BOARD_CORE)
- if(NOT TARGET ${CORE_LIB_NAME})
- set(BOARD_CORE_PATH ${${BOARD_CORE}.path})
- find_sources(CORE_SRCS ${BOARD_CORE_PATH} True)
- # Debian/Ubuntu fix
- list(REMOVE_ITEM CORE_SRCS "${BOARD_CORE_PATH}/main.cxx")
- add_library(${CORE_LIB_NAME} ${CORE_SRCS})
- get_arduino_flags(ARDUINO_COMPILE_FLAGS ARDUINO_LINK_FLAGS ${BOARD_ID} FALSE)
- set_target_properties(${CORE_LIB_NAME} PROPERTIES
- COMPILE_FLAGS "${ARDUINO_COMPILE_FLAGS}"
- LINK_FLAGS "${ARDUINO_LINK_FLAGS}")
- endif()
- set(${VAR_NAME} ${CORE_LIB_NAME} PARENT_SCOPE)
- endif()
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# find_arduino_libraries(VAR_NAME SRCS ARDLIBS)
-#
-# VAR_NAME - Variable name which will hold the results
-# SRCS - Sources that will be analized
-# ARDLIBS - Arduino libraries identified by name (e.g., Wire, SPI, Servo)
-#
-# returns a list of paths to libraries found.
-#
-# Finds all Arduino type libraries included in sources. Available libraries
-# are ${ARDUINO_SDK_PATH}/libraries and ${CMAKE_CURRENT_SOURCE_DIR}.
-#
-# Also adds Arduino libraries specifically names in ALIBS. We add ".h" to the
-# names and then process them just like the Arduino libraries found in the sources.
-#
-# A Arduino library is a folder that has the same name as the include header.
-# For example, if we have a include "#include " then the following
-# directory structure is considered a Arduino library:
-#
-# LibraryName/
-# |- LibraryName.h
-# `- LibraryName.c
-#
-# If such a directory is found then all sources within that directory are considred
-# to be part of that Arduino library.
-#
-#=============================================================================#
-function(find_arduino_libraries VAR_NAME SRCS ARDLIBS)
- set(ARDUINO_LIBS )
- foreach(SRC ${SRCS})
-
- # Skipping generated files. They are, probably, not exist yet.
- # TODO: Maybe it's possible to skip only really nonexisting files,
- # but then it wiil be less deterministic.
- get_source_file_property(_srcfile_generated ${SRC} GENERATED)
- # Workaround for sketches, which are marked as generated
- get_source_file_property(_sketch_generated ${SRC} GENERATED_SKETCH)
-
- if(NOT ${_srcfile_generated} OR ${_sketch_generated})
- if(NOT (EXISTS ${SRC} OR
- EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SRC} OR
- EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${SRC}))
- message(FATAL_ERROR "Invalid source file: ${SRC}")
- endif()
- file(STRINGS ${SRC} SRC_CONTENTS)
-
- foreach(LIBNAME ${ARDLIBS})
- list(APPEND SRC_CONTENTS "#include <${LIBNAME}.h>")
- endforeach()
-
- foreach(SRC_LINE ${SRC_CONTENTS})
- if("${SRC_LINE}" MATCHES "^ *#include *[<\"](.*)[>\"]")
- get_filename_component(INCLUDE_NAME ${CMAKE_MATCH_1} NAME_WE)
- get_property(LIBRARY_SEARCH_PATH
- DIRECTORY # Property Scope
- PROPERTY LINK_DIRECTORIES)
- foreach(LIB_SEARCH_PATH ${LIBRARY_SEARCH_PATH} ${ARDUINO_LIBRARIES_PATH} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libraries ${ARDUINO_EXTRA_LIBRARIES_PATH})
- if(EXISTS ${LIB_SEARCH_PATH}/${INCLUDE_NAME}/${CMAKE_MATCH_1})
- list(APPEND ARDUINO_LIBS ${LIB_SEARCH_PATH}/${INCLUDE_NAME})
- break()
- endif()
- if(EXISTS ${LIB_SEARCH_PATH}/${CMAKE_MATCH_1})
- list(APPEND ARDUINO_LIBS ${LIB_SEARCH_PATH})
- break()
- endif()
- endforeach()
- endif()
- endforeach()
- endif()
- endforeach()
- if(ARDUINO_LIBS)
- list(REMOVE_DUPLICATES ARDUINO_LIBS)
- endif()
- set(${VAR_NAME} ${ARDUINO_LIBS} PARENT_SCOPE)
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# setup_arduino_library(VAR_NAME BOARD_ID LIB_PATH COMPILE_FLAGS LINK_FLAGS)
-#
-# VAR_NAME - Vairable wich will hold the generated library names
-# BOARD_ID - Board ID
-# LIB_PATH - Path of the library
-# COMPILE_FLAGS - Compile flags
-# LINK_FLAGS - Link flags
-#
-# Creates an Arduino library, with all it's library dependencies.
-#
-# ${LIB_NAME}_RECURSE controls if the library will recurse
-# when looking for source files.
-#
-#=============================================================================#
-
-# For known libraries can list recurse here
-set(Wire_RECURSE True)
-set(Ethernet_RECURSE True)
-set(SD_RECURSE True)
-function(setup_arduino_library VAR_NAME BOARD_ID LIB_PATH COMPILE_FLAGS LINK_FLAGS)
- set(LIB_TARGETS)
- set(LIB_INCLUDES)
-
- get_filename_component(LIB_NAME ${LIB_PATH} NAME)
- set(TARGET_LIB_NAME ${BOARD_ID}_${LIB_NAME})
- if(NOT TARGET ${TARGET_LIB_NAME})
- string(REGEX REPLACE ".*/" "" LIB_SHORT_NAME ${LIB_NAME})
-
- # Detect if recursion is needed
- if (NOT DEFINED ${LIB_SHORT_NAME}_RECURSE)
- set(${LIB_SHORT_NAME}_RECURSE False)
- endif()
-
- find_sources(LIB_SRCS ${LIB_PATH} ${${LIB_SHORT_NAME}_RECURSE})
- if(LIB_SRCS)
-
- arduino_debug_msg("Generating Arduino ${LIB_NAME} library")
- add_library(${TARGET_LIB_NAME} STATIC ${LIB_SRCS})
-
- get_arduino_flags(ARDUINO_COMPILE_FLAGS ARDUINO_LINK_FLAGS ${BOARD_ID} FALSE)
-
- find_arduino_libraries(LIB_DEPS "${LIB_SRCS}" "")
-
- foreach(LIB_DEP ${LIB_DEPS})
- setup_arduino_library(DEP_LIB_SRCS ${BOARD_ID} ${LIB_DEP} "${COMPILE_FLAGS}" "${LINK_FLAGS}")
- list(APPEND LIB_TARGETS ${DEP_LIB_SRCS})
- list(APPEND LIB_INCLUDES ${DEP_LIB_SRCS_INCLUDES})
- endforeach()
-
- if (LIB_INCLUDES)
- string(REPLACE ";" " " LIB_INCLUDES "${LIB_INCLUDES}")
- endif()
-
- set_target_properties(${TARGET_LIB_NAME} PROPERTIES
- COMPILE_FLAGS "${ARDUINO_COMPILE_FLAGS} ${LIB_INCLUDES} -I\"${LIB_PATH}\" -I\"${LIB_PATH}/utility\" ${COMPILE_FLAGS}"
- LINK_FLAGS "${ARDUINO_LINK_FLAGS} ${LINK_FLAGS}")
- list(APPEND LIB_INCLUDES "-I\"${LIB_PATH}\" -I\"${LIB_PATH}/utility\"")
-
- target_link_libraries(${TARGET_LIB_NAME} ${BOARD_ID}_CORE ${LIB_TARGETS})
- list(APPEND LIB_TARGETS ${TARGET_LIB_NAME})
-
- endif()
- else()
- # Target already exists, skiping creating
- list(APPEND LIB_TARGETS ${TARGET_LIB_NAME})
- endif()
- if(LIB_TARGETS)
- list(REMOVE_DUPLICATES LIB_TARGETS)
- endif()
- set(${VAR_NAME} ${LIB_TARGETS} PARENT_SCOPE)
- set(${VAR_NAME}_INCLUDES ${LIB_INCLUDES} PARENT_SCOPE)
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# setup_arduino_libraries(VAR_NAME BOARD_ID SRCS COMPILE_FLAGS LINK_FLAGS)
-#
-# VAR_NAME - Vairable wich will hold the generated library names
-# BOARD_ID - Board ID
-# SRCS - source files
-# COMPILE_FLAGS - Compile flags
-# LINK_FLAGS - Linker flags
-#
-# Finds and creates all dependency libraries based on sources.
-#
-#=============================================================================#
-function(setup_arduino_libraries VAR_NAME BOARD_ID SRCS ARDLIBS COMPILE_FLAGS LINK_FLAGS)
- set(LIB_TARGETS)
- set(LIB_INCLUDES)
-
- find_arduino_libraries(TARGET_LIBS "${SRCS}" ARDLIBS)
- foreach(TARGET_LIB ${TARGET_LIBS})
- # Create static library instead of returning sources
- setup_arduino_library(LIB_DEPS ${BOARD_ID} ${TARGET_LIB} "${COMPILE_FLAGS}" "${LINK_FLAGS}")
- list(APPEND LIB_TARGETS ${LIB_DEPS})
- list(APPEND LIB_INCLUDES ${LIB_DEPS_INCLUDES})
- endforeach()
-
- set(${VAR_NAME} ${LIB_TARGETS} PARENT_SCOPE)
- set(${VAR_NAME}_INCLUDES ${LIB_INCLUDES} PARENT_SCOPE)
-endfunction()
-
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# setup_arduino_target(TARGET_NAME ALL_SRCS ALL_LIBS COMPILE_FLAGS LINK_FLAGS MANUAL)
-#
-# TARGET_NAME - Target name
-# BOARD_ID - Arduino board ID
-# ALL_SRCS - All sources
-# ALL_LIBS - All libraries
-# COMPILE_FLAGS - Compile flags
-# LINK_FLAGS - Linker flags
-# MANUAL - (Advanced) Only use AVR Libc/Includes
-#
-# Creates an Arduino firmware target.
-#
-#=============================================================================#
-function(setup_arduino_target TARGET_NAME BOARD_ID ALL_SRCS ALL_LIBS COMPILE_FLAGS LINK_FLAGS MANUAL)
-
- add_executable(${TARGET_NAME} ${ALL_SRCS})
- set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".elf")
-
- get_arduino_flags(ARDUINO_COMPILE_FLAGS ARDUINO_LINK_FLAGS ${BOARD_ID} ${MANUAL})
-
- set_target_properties(${TARGET_NAME} PROPERTIES
- COMPILE_FLAGS "${ARDUINO_COMPILE_FLAGS} ${COMPILE_FLAGS}"
- LINK_FLAGS "${ARDUINO_LINK_FLAGS} ${LINK_FLAGS}")
- target_link_libraries(${TARGET_NAME} ${ALL_LIBS} "-lc -lm")
-
- if(NOT EXECUTABLE_OUTPUT_PATH)
- set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
- endif()
- set(TARGET_PATH ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME})
- add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
- COMMAND ${CMAKE_OBJCOPY}
- ARGS ${ARDUINO_OBJCOPY_EEP_FLAGS}
- ${TARGET_PATH}.elf
- ${TARGET_PATH}.eep
- COMMENT "Generating EEP image"
- VERBATIM)
-
- # Convert firmware image to ASCII HEX format
- add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
- COMMAND ${CMAKE_OBJCOPY}
- ARGS ${ARDUINO_OBJCOPY_HEX_FLAGS}
- ${TARGET_PATH}.elf
- ${TARGET_PATH}.hex
- COMMENT "Generating HEX image"
- VERBATIM)
-
- # Display target size
- add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -DFIRMWARE_IMAGE=${TARGET_PATH}.elf
- -DMCU=${${BOARD_ID}.build.mcu}
- -DEEPROM_IMAGE=${TARGET_PATH}.eep
- -P ${ARDUINO_SIZE_SCRIPT}
- COMMENT "Calculating image size"
- VERBATIM)
-
- # Create ${TARGET_NAME}-size target
- add_custom_target(${TARGET_NAME}-size
- COMMAND ${CMAKE_COMMAND}
- -DFIRMWARE_IMAGE=${TARGET_PATH}.elf
- -DMCU=${${BOARD_ID}.build.mcu}
- -DEEPROM_IMAGE=${TARGET_PATH}.eep
- -P ${ARDUINO_SIZE_SCRIPT}
- DEPENDS ${TARGET_NAME}
- COMMENT "Calculating ${TARGET_NAME} image size")
-
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# setup_arduino_upload(BOARD_ID TARGET_NAME PORT)
-#
-# BOARD_ID - Arduino board id
-# TARGET_NAME - Target name
-# PORT - Serial port for upload
-# PROGRAMMER_ID - Programmer ID
-# AVRDUDE_FLAGS - avrdude flags
-#
-# Create an upload target (${TARGET_NAME}-upload) for the specified Arduino target.
-#
-#=============================================================================#
-function(setup_arduino_upload BOARD_ID TARGET_NAME PORT PROGRAMMER_ID AVRDUDE_FLAGS)
- setup_arduino_bootloader_upload(${TARGET_NAME} ${BOARD_ID} ${PORT} "${AVRDUDE_FLAGS}")
-
- # Add programmer support if defined
- if(PROGRAMMER_ID AND ${PROGRAMMER_ID}.protocol)
- setup_arduino_programmer_burn(${TARGET_NAME} ${BOARD_ID} ${PROGRAMMER_ID} ${PORT} "${AVRDUDE_FLAGS}")
- setup_arduino_bootloader_burn(${TARGET_NAME} ${BOARD_ID} ${PROGRAMMER_ID} ${PORT} "${AVRDUDE_FLAGS}")
- endif()
-endfunction()
-
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# setup_arduino_bootloader_upload(TARGET_NAME BOARD_ID PORT)
-#
-# TARGET_NAME - target name
-# BOARD_ID - board id
-# PORT - serial port
-# AVRDUDE_FLAGS - avrdude flags (override)
-#
-# Set up target for upload firmware via the bootloader.
-#
-# The target for uploading the firmware is ${TARGET_NAME}-upload .
-#
-#=============================================================================#
-function(setup_arduino_bootloader_upload TARGET_NAME BOARD_ID PORT AVRDUDE_FLAGS)
- set(UPLOAD_TARGET ${TARGET_NAME}-upload)
- set(AVRDUDE_ARGS)
-
- setup_arduino_bootloader_args(${BOARD_ID} ${TARGET_NAME} ${PORT} "${AVRDUDE_FLAGS}" AVRDUDE_ARGS)
-
- if(NOT AVRDUDE_ARGS)
- message("Could not generate default avrdude bootloader args, aborting!")
- return()
- endif()
-
- if(NOT EXECUTABLE_OUTPUT_PATH)
- set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
- endif()
- set(TARGET_PATH ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME})
-
- list(APPEND AVRDUDE_ARGS "-Uflash:w:${TARGET_PATH}.hex")
- list(APPEND AVRDUDE_ARGS "-Ueeprom:w:${TARGET_PATH}.eep:i")
- add_custom_target(${UPLOAD_TARGET}
- ${ARDUINO_AVRDUDE_PROGRAM}
- ${AVRDUDE_ARGS}
- DEPENDS ${TARGET_NAME})
-
- # Global upload target
- if(NOT TARGET upload)
- add_custom_target(upload)
- endif()
-
- add_dependencies(upload ${UPLOAD_TARGET})
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# setup_arduino_programmer_burn(TARGET_NAME BOARD_ID PROGRAMMER PORT AVRDUDE_FLAGS)
-#
-# TARGET_NAME - name of target to burn
-# BOARD_ID - board id
-# PROGRAMMER - programmer id
-# PORT - serial port
-# AVRDUDE_FLAGS - avrdude flags (override)
-#
-# Sets up target for burning firmware via a programmer.
-#
-# The target for burning the firmware is ${TARGET_NAME}-burn .
-#
-#=============================================================================#
-function(setup_arduino_programmer_burn TARGET_NAME BOARD_ID PROGRAMMER PORT AVRDUDE_FLAGS)
- set(PROGRAMMER_TARGET ${TARGET_NAME}-burn)
-
- set(AVRDUDE_ARGS)
-
- setup_arduino_programmer_args(${BOARD_ID} ${PROGRAMMER} ${TARGET_NAME} ${PORT} "${AVRDUDE_FLAGS}" AVRDUDE_ARGS)
-
- if(NOT AVRDUDE_ARGS)
- message("Could not generate default avrdude programmer args, aborting!")
- return()
- endif()
-
- if(NOT EXECUTABLE_OUTPUT_PATH)
- set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
- endif()
- set(TARGET_PATH ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME})
-
- list(APPEND AVRDUDE_ARGS "-Uflash:w:${TARGET_PATH}.hex")
-
- add_custom_target(${PROGRAMMER_TARGET}
- ${ARDUINO_AVRDUDE_PROGRAM}
- ${AVRDUDE_ARGS}
- DEPENDS ${TARGET_NAME})
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# setup_arduino_bootloader_burn(TARGET_NAME BOARD_ID PROGRAMMER PORT AVRDUDE_FLAGS)
-#
-# TARGET_NAME - name of target to burn
-# BOARD_ID - board id
-# PROGRAMMER - programmer id
-# PORT - serial port
-# AVRDUDE_FLAGS - avrdude flags (override)
-#
-# Create a target for burning a bootloader via a programmer.
-#
-# The target for burning the bootloader is ${TARGET_NAME}-burn-bootloader
-#
-#=============================================================================#
-function(setup_arduino_bootloader_burn TARGET_NAME BOARD_ID PROGRAMMER PORT AVRDUDE_FLAGS)
- set(BOOTLOADER_TARGET ${TARGET_NAME}-burn-bootloader)
-
- set(AVRDUDE_ARGS)
-
- setup_arduino_programmer_args(${BOARD_ID} ${PROGRAMMER} ${TARGET_NAME} ${PORT} "${AVRDUDE_FLAGS}" AVRDUDE_ARGS)
-
- if(NOT AVRDUDE_ARGS)
- message("Could not generate default avrdude programmer args, aborting!")
- return()
- endif()
-
- foreach( ITEM unlock_bits high_fuses low_fuses path file)
- if(NOT ${BOARD_ID}.bootloader.${ITEM})
- message("Missing ${BOARD_ID}.bootloader.${ITEM}, not creating bootloader burn target ${BOOTLOADER_TARGET}.")
- return()
- endif()
- endforeach()
-
- if(NOT EXISTS "${ARDUINO_BOOTLOADERS_PATH}/${${BOARD_ID}.bootloader.path}/${${BOARD_ID}.bootloader.file}")
- message("${ARDUINO_BOOTLOADERS_PATH}/${${BOARD_ID}.bootloader.path}/${${BOARD_ID}.bootloader.file}")
- message("Missing bootloader image, not creating bootloader burn target ${BOOTLOADER_TARGET}.")
- return()
- endif()
-
- # Erase the chip
- list(APPEND AVRDUDE_ARGS "-e")
-
- # Set unlock bits and fuses (because chip is going to be erased)
- list(APPEND AVRDUDE_ARGS "-Ulock:w:${${BOARD_ID}.bootloader.unlock_bits}:m")
- if(${BOARD_ID}.bootloader.extended_fuses)
- list(APPEND AVRDUDE_ARGS "-Uefuse:w:${${BOARD_ID}.bootloader.extended_fuses}:m")
- endif()
- list(APPEND AVRDUDE_ARGS
- "-Uhfuse:w:${${BOARD_ID}.bootloader.high_fuses}:m"
- "-Ulfuse:w:${${BOARD_ID}.bootloader.low_fuses}:m")
-
- # Set bootloader image
- list(APPEND AVRDUDE_ARGS "-Uflash:w:${${BOARD_ID}.bootloader.file}:i")
-
- # Set lockbits
- list(APPEND AVRDUDE_ARGS "-Ulock:w:${${BOARD_ID}.bootloader.lock_bits}:m")
-
- # Create burn bootloader target
- add_custom_target(${BOOTLOADER_TARGET}
- ${ARDUINO_AVRDUDE_PROGRAM}
- ${AVRDUDE_ARGS}
- WORKING_DIRECTORY ${ARDUINO_BOOTLOADERS_PATH}/${${BOARD_ID}.bootloader.path}
- DEPENDS ${TARGET_NAME})
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# setup_arduino_programmer_args(BOARD_ID PROGRAMMER TARGET_NAME PORT AVRDUDE_FLAGS OUTPUT_VAR)
-#
-# BOARD_ID - board id
-# PROGRAMMER - programmer id
-# TARGET_NAME - target name
-# PORT - serial port
-# AVRDUDE_FLAGS - avrdude flags (override)
-# OUTPUT_VAR - name of output variable for result
-#
-# Sets up default avrdude settings for burning firmware via a programmer.
-#=============================================================================#
-function(setup_arduino_programmer_args BOARD_ID PROGRAMMER TARGET_NAME PORT AVRDUDE_FLAGS OUTPUT_VAR)
- set(AVRDUDE_ARGS ${${OUTPUT_VAR}})
-
- if(NOT AVRDUDE_FLAGS)
- set(AVRDUDE_FLAGS ${ARDUINO_AVRDUDE_FLAGS})
- endif()
-
- list(APPEND AVRDUDE_ARGS "-C${ARDUINO_AVRDUDE_CONFIG_PATH}")
-
- #TODO: Check mandatory settings before continuing
- if(NOT ${PROGRAMMER}.protocol)
- message(FATAL_ERROR "Missing ${PROGRAMMER}.protocol, aborting!")
- endif()
-
- list(APPEND AVRDUDE_ARGS "-c${${PROGRAMMER}.protocol}") # Set programmer
-
- if(${PROGRAMMER}.communication STREQUAL "usb")
- list(APPEND AVRDUDE_ARGS "-Pusb") # Set USB as port
- elseif(${PROGRAMMER}.communication STREQUAL "serial")
- list(APPEND AVRDUDE_ARGS "-P${PORT}") # Set port
- if(${PROGRAMMER}.speed)
- list(APPEND AVRDUDE_ARGS "-b${${PROGRAMMER}.speed}") # Set baud rate
- endif()
- endif()
-
- if(${PROGRAMMER}.force)
- list(APPEND AVRDUDE_ARGS "-F") # Set force
- endif()
-
- if(${PROGRAMMER}.delay)
- list(APPEND AVRDUDE_ARGS "-i${${PROGRAMMER}.delay}") # Set delay
- endif()
-
- list(APPEND AVRDUDE_ARGS "-p${${BOARD_ID}.build.mcu}") # MCU Type
-
- list(APPEND AVRDUDE_ARGS ${AVRDUDE_FLAGS})
-
- set(${OUTPUT_VAR} ${AVRDUDE_ARGS} PARENT_SCOPE)
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# setup_arduino_bootloader_args(BOARD_ID TARGET_NAME PORT AVRDUDE_FLAGS OUTPUT_VAR)
-#
-# BOARD_ID - board id
-# TARGET_NAME - target name
-# PORT - serial port
-# AVRDUDE_FLAGS - avrdude flags (override)
-# OUTPUT_VAR - name of output variable for result
-#
-# Sets up default avrdude settings for uploading firmware via the bootloader.
-#=============================================================================#
-function(setup_arduino_bootloader_args BOARD_ID TARGET_NAME PORT AVRDUDE_FLAGS OUTPUT_VAR)
- set(AVRDUDE_ARGS ${${OUTPUT_VAR}})
-
- if(NOT AVRDUDE_FLAGS)
- set(AVRDUDE_FLAGS ${ARDUINO_AVRDUDE_FLAGS})
- endif()
-
- list(APPEND AVRDUDE_ARGS
- "-C${ARDUINO_AVRDUDE_CONFIG_PATH}" # avrdude config
- "-p${${BOARD_ID}.build.mcu}" # MCU Type
- )
-
- # Programmer
- if(NOT ${BOARD_ID}.upload.protocol OR ${BOARD_ID}.upload.protocol STREQUAL "stk500")
- list(APPEND AVRDUDE_ARGS "-cstk500v1")
- else()
- list(APPEND AVRDUDE_ARGS "-c${${BOARD_ID}.upload.protocol}")
- endif()
-
- set(UPLOAD_SPEED "19200")
- if(${BOARD_ID}.upload.speed)
- set(UPLOAD_SPEED ${${BOARD_ID}.upload.speed})
- endif()
-
- list(APPEND AVRDUDE_ARGS
- "-b${UPLOAD_SPEED}" # Baud rate
- "-P${PORT}" # Serial port
- "-D" # Dont erase
- )
-
- list(APPEND AVRDUDE_ARGS ${AVRDUDE_FLAGS})
-
- set(${OUTPUT_VAR} ${AVRDUDE_ARGS} PARENT_SCOPE)
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# find_sources(VAR_NAME LIB_PATH RECURSE)
-#
-# VAR_NAME - Variable name that will hold the detected sources
-# LIB_PATH - The base path
-# RECURSE - Whether or not to recurse
-#
-# Finds all C/C++ sources located at the specified path.
-#
-#=============================================================================#
-function(find_sources VAR_NAME LIB_PATH RECURSE)
- set(FILE_SEARCH_LIST
- ${LIB_PATH}/*.cpp
- ${LIB_PATH}/*.c
- ${LIB_PATH}/*.cc
- ${LIB_PATH}/*.cxx
- ${LIB_PATH}/*.h
- ${LIB_PATH}/*.hh
- ${LIB_PATH}/*.hxx)
-
- if(RECURSE)
- file(GLOB_RECURSE LIB_FILES ${FILE_SEARCH_LIST})
- else()
- file(GLOB LIB_FILES ${FILE_SEARCH_LIST})
- endif()
-
- if(LIB_FILES)
- set(${VAR_NAME} ${LIB_FILES} PARENT_SCOPE)
- endif()
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# setup_serial_target(TARGET_NAME CMD)
-#
-# TARGET_NAME - Target name
-# CMD - Serial terminal command
-#
-# Creates a target (${TARGET_NAME}-serial) for launching the serial termnial.
-#
-#=============================================================================#
-function(setup_serial_target TARGET_NAME CMD SERIAL_PORT)
- string(CONFIGURE "${CMD}" FULL_CMD @ONLY)
- add_custom_target(${TARGET_NAME}-serial
- COMMAND ${FULL_CMD})
-endfunction()
-
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# detect_arduino_version(VAR_NAME)
-#
-# VAR_NAME - Variable name where the detected version will be saved
-#
-# Detects the Arduino SDK Version based on the revisions.txt file. The
-# following variables will be generated:
-#
-# ${VAR_NAME} -> the full version (major.minor.patch)
-# ${VAR_NAME}_MAJOR -> the major version
-# ${VAR_NAME}_MINOR -> the minor version
-# ${VAR_NAME}_PATCH -> the patch version
-#
-#=============================================================================#
-function(detect_arduino_version VAR_NAME)
- if(ARDUINO_VERSION_PATH)
- file(READ ${ARDUINO_VERSION_PATH} RAW_VERSION)
- if("${RAW_VERSION}" MATCHES " *[0]+([0-9]+)")
- set(PARSED_VERSION 0.${CMAKE_MATCH_1}.0)
- elseif("${RAW_VERSION}" MATCHES "[ ]*([0-9]+[.][0-9]+[.][0-9]+)")
- set(PARSED_VERSION ${CMAKE_MATCH_1})
- elseif("${RAW_VERSION}" MATCHES "[ ]*([0-9]+[.][0-9]+)")
- set(PARSED_VERSION ${CMAKE_MATCH_1}.0)
- endif()
-
- if(NOT PARSED_VERSION STREQUAL "")
- string(REPLACE "." ";" SPLIT_VERSION ${PARSED_VERSION})
- list(GET SPLIT_VERSION 0 SPLIT_VERSION_MAJOR)
- list(GET SPLIT_VERSION 1 SPLIT_VERSION_MINOR)
- list(GET SPLIT_VERSION 2 SPLIT_VERSION_PATCH)
-
- set(${VAR_NAME} "${PARSED_VERSION}" PARENT_SCOPE)
- set(${VAR_NAME}_MAJOR "${SPLIT_VERSION_MAJOR}" PARENT_SCOPE)
- set(${VAR_NAME}_MINOR "${SPLIT_VERSION_MINOR}" PARENT_SCOPE)
- set(${VAR_NAME}_PATCH "${SPLIT_VERSION_PATCH}" PARENT_SCOPE)
- endif()
- endif()
-endfunction()
-
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# load_arduino_style_settings(SETTINGS_LIST SETTINGS_PATH)
-#
-# SETTINGS_LIST - Variable name of settings list
-# SETTINGS_PATH - File path of settings file to load.
-#
-# Load a Arduino style settings file into the cache.
-#
-# Examples of this type of settings file is the boards.txt and
-# programmers.txt files located in ${ARDUINO_SDK}/hardware/arduino.
-#
-# Settings have to following format:
-#
-# entry.setting[.subsetting] = value
-#
-# where [.subsetting] is optional
-#
-# For example, the following settings:
-#
-# uno.name=Arduino Uno
-# uno.upload.protocol=stk500
-# uno.upload.maximum_size=32256
-# uno.build.mcu=atmega328p
-# uno.build.core=arduino
-#
-# will generate the follwoing equivalent CMake variables:
-#
-# set(uno.name "Arduino Uno")
-# set(uno.upload.protocol "stk500")
-# set(uno.upload.maximum_size "32256")
-# set(uno.build.mcu "atmega328p")
-# set(uno.build.core "arduino")
-#
-# set(uno.SETTINGS name upload build) # List of settings for uno
-# set(uno.upload.SUBSETTINGS protocol maximum_size) # List of sub-settings for uno.upload
-# set(uno.build.SUBSETTINGS mcu core) # List of sub-settings for uno.build
-#
-# The ${ENTRY_NAME}.SETTINGS variable lists all settings for the entry, while
-# ${ENTRY_NAME}.SUBSETTINGS variables lists all settings for a sub-setting of
-# a entry setting pair.
-#
-# These variables are generated in order to be able to programatically traverse
-# all settings (for a example see print_board_settings() function).
-#
-#=============================================================================#
-function(LOAD_ARDUINO_STYLE_SETTINGS SETTINGS_LIST SETTINGS_PATH)
-
- if(NOT ${SETTINGS_LIST} AND EXISTS ${SETTINGS_PATH})
- file(STRINGS ${SETTINGS_PATH} FILE_ENTRIES) # Settings file split into lines
-
- foreach(FILE_ENTRY ${FILE_ENTRIES})
- if("${FILE_ENTRY}" MATCHES "^[^#]+=.*")
- string(REGEX MATCH "^[^=]+" SETTING_NAME ${FILE_ENTRY})
- string(REGEX MATCH "[^=]+$" SETTING_VALUE ${FILE_ENTRY})
- string(REPLACE "." ";" ENTRY_NAME_TOKENS ${SETTING_NAME})
- string(STRIP "${SETTING_VALUE}" SETTING_VALUE)
-
- list(LENGTH ENTRY_NAME_TOKENS ENTRY_NAME_TOKENS_LEN)
-
- # Add entry to settings list if it does not exist
- list(GET ENTRY_NAME_TOKENS 0 ENTRY_NAME)
- list(FIND ${SETTINGS_LIST} ${ENTRY_NAME} ENTRY_NAME_INDEX)
- if(ENTRY_NAME_INDEX LESS 0)
- # Add entry to main list
- list(APPEND ${SETTINGS_LIST} ${ENTRY_NAME})
- endif()
-
- # Add entry setting to entry settings list if it does not exist
- set(ENTRY_SETTING_LIST ${ENTRY_NAME}.SETTINGS)
- list(GET ENTRY_NAME_TOKENS 1 ENTRY_SETTING)
- list(FIND ${ENTRY_SETTING_LIST} ${ENTRY_SETTING} ENTRY_SETTING_INDEX)
- if(ENTRY_SETTING_INDEX LESS 0)
- # Add setting to entry
- list(APPEND ${ENTRY_SETTING_LIST} ${ENTRY_SETTING})
- set(${ENTRY_SETTING_LIST} ${${ENTRY_SETTING_LIST}}
- CACHE INTERNAL "Arduino ${ENTRY_NAME} Board settings list")
- endif()
-
- set(FULL_SETTING_NAME ${ENTRY_NAME}.${ENTRY_SETTING})
-
- # Add entry sub-setting to entry sub-settings list if it does not exists
- if(ENTRY_NAME_TOKENS_LEN GREATER 2)
- set(ENTRY_SUBSETTING_LIST ${ENTRY_NAME}.${ENTRY_SETTING}.SUBSETTINGS)
- list(GET ENTRY_NAME_TOKENS 2 ENTRY_SUBSETTING)
- list(FIND ${ENTRY_SUBSETTING_LIST} ${ENTRY_SUBSETTING} ENTRY_SUBSETTING_INDEX)
- if(ENTRY_SUBSETTING_INDEX LESS 0)
- list(APPEND ${ENTRY_SUBSETTING_LIST} ${ENTRY_SUBSETTING})
- set(${ENTRY_SUBSETTING_LIST} ${${ENTRY_SUBSETTING_LIST}}
- CACHE INTERNAL "Arduino ${ENTRY_NAME} Board sub-settings list")
- endif()
- set(FULL_SETTING_NAME ${FULL_SETTING_NAME}.${ENTRY_SUBSETTING})
- endif()
-
- # Save setting value
- set(${FULL_SETTING_NAME} ${SETTING_VALUE}
- CACHE INTERNAL "Arduino ${ENTRY_NAME} Board setting")
-
-
- endif()
- endforeach()
- set(${SETTINGS_LIST} ${${SETTINGS_LIST}}
- CACHE STRING "List of detected Arduino Board configurations")
- mark_as_advanced(${SETTINGS_LIST})
- endif()
-endfunction()
-
-#=============================================================================#
-# print_settings(ENTRY_NAME)
-#
-# ENTRY_NAME - name of entry
-#
-# Print the entry settings (see load_arduino_syle_settings()).
-#
-#=============================================================================#
-function(PRINT_SETTINGS ENTRY_NAME)
- if(${ENTRY_NAME}.SETTINGS)
-
- foreach(ENTRY_SETTING ${${ENTRY_NAME}.SETTINGS})
- if(${ENTRY_NAME}.${ENTRY_SETTING})
- message(STATUS " ${ENTRY_NAME}.${ENTRY_SETTING}=${${ENTRY_NAME}.${ENTRY_SETTING}}")
- endif()
- if(${ENTRY_NAME}.${ENTRY_SETTING}.SUBSETTINGS)
- foreach(ENTRY_SUBSETTING ${${ENTRY_NAME}.${ENTRY_SETTING}.SUBSETTINGS})
- if(${ENTRY_NAME}.${ENTRY_SETTING}.${ENTRY_SUBSETTING})
- message(STATUS " ${ENTRY_NAME}.${ENTRY_SETTING}.${ENTRY_SUBSETTING}=${${ENTRY_NAME}.${ENTRY_SETTING}.${ENTRY_SUBSETTING}}")
- endif()
- endforeach()
- endif()
- message(STATUS "")
- endforeach()
- endif()
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# print_list(SETTINGS_LIST)
-#
-# SETTINGS_LIST - Variables name of settings list
-#
-# Print list settings and names (see load_arduino_syle_settings()).
-#=============================================================================#
-function(PRINT_LIST SETTINGS_LIST)
- if(${SETTINGS_LIST})
- set(MAX_LENGTH 0)
- foreach(ENTRY_NAME ${${SETTINGS_LIST}})
- string(LENGTH "${ENTRY_NAME}" CURRENT_LENGTH)
- if(CURRENT_LENGTH GREATER MAX_LENGTH)
- set(MAX_LENGTH ${CURRENT_LENGTH})
- endif()
- endforeach()
- foreach(ENTRY_NAME ${${SETTINGS_LIST}})
- string(LENGTH "${ENTRY_NAME}" CURRENT_LENGTH)
- math(EXPR PADDING_LENGTH "${MAX_LENGTH}-${CURRENT_LENGTH}")
- set(PADDING "")
- foreach(X RANGE ${PADDING_LENGTH})
- set(PADDING "${PADDING} ")
- endforeach()
- message(STATUS " ${PADDING}${ENTRY_NAME}: ${${ENTRY_NAME}.name}")
- endforeach()
- endif()
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# setup_arduino_example(TARGET_NAME LIBRARY_NAME EXAMPLE_NAME OUTPUT_VAR)
-#
-# TARGET_NAME - Target name
-# LIBRARY_NAME - Library name
-# EXAMPLE_NAME - Example name
-# OUTPUT_VAR - Variable name to save sketch path.
-#
-# Creates a Arduino example from a the specified library.
-#=============================================================================#
-function(SETUP_ARDUINO_EXAMPLE TARGET_NAME LIBRARY_NAME EXAMPLE_NAME OUTPUT_VAR)
- set(EXAMPLE_SKETCH_PATH )
-
- get_property(LIBRARY_SEARCH_PATH
- DIRECTORY # Property Scope
- PROPERTY LINK_DIRECTORIES)
- foreach(LIB_SEARCH_PATH ${LIBRARY_SEARCH_PATH} ${ARDUINO_LIBRARIES_PATH} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libraries)
- if(EXISTS "${LIB_SEARCH_PATH}/${LIBRARY_NAME}/examples/${EXAMPLE_NAME}")
- set(EXAMPLE_SKETCH_PATH "${LIB_SEARCH_PATH}/${LIBRARY_NAME}/examples/${EXAMPLE_NAME}")
- break()
- endif()
- endforeach()
-
- if(EXAMPLE_SKETCH_PATH)
- setup_arduino_sketch(${TARGET_NAME} ${EXAMPLE_SKETCH_PATH} SKETCH_CPP)
- set("${OUTPUT_VAR}" ${${OUTPUT_VAR}} ${SKETCH_CPP} PARENT_SCOPE)
- else()
- message(FATAL_ERROR "Could not find example ${EXAMPLE_NAME} from library ${LIBRARY_NAME}")
- endif()
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# setup_arduino_sketch(TARGET_NAME SKETCH_PATH OUTPUT_VAR)
-#
-# TARGET_NAME - Target name
-# SKETCH_PATH - Path to sketch directory
-# OUTPUT_VAR - Variable name where to save generated sketch source
-#
-# Generates C++ sources from Arduino Sketch.
-#=============================================================================#
-function(SETUP_ARDUINO_SKETCH TARGET_NAME SKETCH_PATH OUTPUT_VAR)
- get_filename_component(SKETCH_NAME "${SKETCH_PATH}" NAME)
- get_filename_component(SKETCH_PATH "${SKETCH_PATH}" ABSOLUTE)
-
- if(EXISTS "${SKETCH_PATH}")
- set(SKETCH_CPP ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}_${SKETCH_NAME}.cpp)
-
- if (IS_DIRECTORY "${SKETCH_PATH}")
- # Sketch directory specified, try to find main sketch...
- set(MAIN_SKETCH ${SKETCH_PATH}/${SKETCH_NAME})
-
- if(EXISTS "${MAIN_SKETCH}.pde")
- set(MAIN_SKETCH "${MAIN_SKETCH}.pde")
- elseif(EXISTS "${MAIN_SKETCH}.ino")
- set(MAIN_SKETCH "${MAIN_SKETCH}.ino")
- else()
- message(FATAL_ERROR "Could not find main sketch (${SKETCH_NAME}.pde or ${SKETCH_NAME}.ino) at ${SKETCH_PATH}! Please specify the main sketch file path instead of directory.")
- endif()
- else()
- # Sektch file specified, assuming parent directory as sketch directory
- set(MAIN_SKETCH ${SKETCH_PATH})
- get_filename_component(SKETCH_PATH "${SKETCH_PATH}" PATH)
- endif()
- arduino_debug_msg("sketch: ${MAIN_SKETCH}")
-
- # Find all sketch files
- file(GLOB SKETCH_SOURCES ${SKETCH_PATH}/*.pde ${SKETCH_PATH}/*.ino)
- list(REMOVE_ITEM SKETCH_SOURCES ${MAIN_SKETCH})
- list(SORT SKETCH_SOURCES)
-
- generate_cpp_from_sketch("${MAIN_SKETCH}" "${SKETCH_SOURCES}" "${SKETCH_CPP}")
-
- # Regenerate build system if sketch changes
- add_custom_command(OUTPUT ${SKETCH_CPP}
- COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR}
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- DEPENDS ${MAIN_SKETCH} ${SKETCH_SOURCES}
- COMMENT "Regnerating ${SKETCH_NAME} Sketch")
- set_source_files_properties(${SKETCH_CPP} PROPERTIES GENERATED TRUE)
- # Mark file that it exists for find_file
- set_source_files_properties(${SKETCH_CPP} PROPERTIES GENERATED_SKETCH TRUE)
-
- set("${OUTPUT_VAR}" ${${OUTPUT_VAR}} ${SKETCH_CPP} PARENT_SCOPE)
- else()
- message(FATAL_ERROR "Sketch does not exist: ${SKETCH_PATH}")
- endif()
-endfunction()
-
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# generate_cpp_from_sketch(MAIN_SKETCH_PATH SKETCH_SOURCES SKETCH_CPP)
-#
-# MAIN_SKETCH_PATH - Main sketch file path
-# SKETCH_SOURCES - Setch source paths
-# SKETCH_CPP - Name of file to generate
-#
-# Generate C++ source file from Arduino sketch files.
-#=============================================================================#
-function(GENERATE_CPP_FROM_SKETCH MAIN_SKETCH_PATH SKETCH_SOURCES SKETCH_CPP)
- file(WRITE ${SKETCH_CPP} "// automatically generated by arduino-cmake\n")
- file(READ ${MAIN_SKETCH_PATH} MAIN_SKETCH)
-
- # remove comments
- remove_comments(MAIN_SKETCH MAIN_SKETCH_NO_COMMENTS)
-
- # find first statement
- string(REGEX MATCH "[\n][_a-zA-Z0-9]+[^\n]*" FIRST_STATEMENT "${MAIN_SKETCH_NO_COMMENTS}")
- string(FIND "${MAIN_SKETCH}" "${FIRST_STATEMENT}" HEAD_LENGTH)
- if ("${HEAD_LENGTH}" STREQUAL "-1")
- set(HEAD_LENGTH 0)
- endif()
- #message(STATUS "FIRST STATEMENT: ${FIRST_STATEMENT}")
- #message(STATUS "FIRST STATEMENT POSITION: ${HEAD_LENGTH}")
- string(LENGTH "${MAIN_SKETCH}" MAIN_SKETCH_LENGTH)
-
- string(SUBSTRING "${MAIN_SKETCH}" 0 ${HEAD_LENGTH} SKETCH_HEAD)
- #arduino_debug_msg("SKETCH_HEAD:\n${SKETCH_HEAD}")
-
- # find the body of the main pde
- math(EXPR BODY_LENGTH "${MAIN_SKETCH_LENGTH}-${HEAD_LENGTH}")
- string(SUBSTRING "${MAIN_SKETCH}" "${HEAD_LENGTH}+1" "${BODY_LENGTH}-1" SKETCH_BODY)
- #arduino_debug_msg("BODY:\n${SKETCH_BODY}")
-
- # write the file head
- file(APPEND ${SKETCH_CPP} "#line 1 \"${MAIN_SKETCH_PATH}\"\n${SKETCH_HEAD}")
-
- # Count head line offset (for GCC error reporting)
- file(STRINGS ${SKETCH_CPP} SKETCH_HEAD_LINES)
- list(LENGTH SKETCH_HEAD_LINES SKETCH_HEAD_LINES_COUNT)
- math(EXPR SKETCH_HEAD_OFFSET "${SKETCH_HEAD_LINES_COUNT}+2")
-
- # add arduino include header
- #file(APPEND ${SKETCH_CPP} "\n#line 1 \"autogenerated\"\n")
- file(APPEND ${SKETCH_CPP} "\n#line ${SKETCH_HEAD_OFFSET} \"${SKETCH_CPP}\"\n")
- if(ARDUINO_SDK_VERSION VERSION_LESS 1.0)
- file(APPEND ${SKETCH_CPP} "#include \"WProgram.h\"\n")
- else()
- file(APPEND ${SKETCH_CPP} "#include \"Arduino.h\"\n")
- endif()
-
- # add function prototypes
- foreach(SKETCH_SOURCE_PATH ${SKETCH_SOURCES} ${MAIN_SKETCH_PATH})
- arduino_debug_msg("Sketch: ${SKETCH_SOURCE_PATH}")
- file(READ ${SKETCH_SOURCE_PATH} SKETCH_SOURCE)
- remove_comments(SKETCH_SOURCE SKETCH_SOURCE)
-
- set(ALPHA "a-zA-Z")
- set(NUM "0-9")
- set(ALPHANUM "${ALPHA}${NUM}")
- set(WORD "_${ALPHANUM}")
- set(LINE_START "(^|[\n])")
- set(QUALIFIERS "[ \t]*([${ALPHA}]+[ ])*")
- set(TYPE "[${WORD}]+([ ]*[\n][\t]*|[ ])+")
- set(FNAME "[${WORD}]+[ ]?[\n]?[\t]*[ ]*")
- set(FARGS "[(]([\t]*[ ]*[*&]?[ ]?[${WORD}](\\[([${NUM}]+)?\\])*[,]?[ ]*[\n]?)*([,]?[ ]*[\n]?)?[)]")
- set(BODY_START "([ ]*[\n][\t]*|[ ]|[\n])*{")
- set(PROTOTYPE_PATTERN "${LINE_START}${QUALIFIERS}${TYPE}${FNAME}${FARGS}${BODY_START}")
-
- string(REGEX MATCHALL "${PROTOTYPE_PATTERN}" SKETCH_PROTOTYPES "${SKETCH_SOURCE}")
-
- # Write function prototypes
- file(APPEND ${SKETCH_CPP} "\n//=== START Forward: ${SKETCH_SOURCE_PATH}\n")
- foreach(SKETCH_PROTOTYPE ${SKETCH_PROTOTYPES})
- string(REPLACE "\n" " " SKETCH_PROTOTYPE "${SKETCH_PROTOTYPE}")
- string(REPLACE "{" "" SKETCH_PROTOTYPE "${SKETCH_PROTOTYPE}")
- arduino_debug_msg("\tprototype: ${SKETCH_PROTOTYPE};")
- # " else if(var == other) {" shoudn't be listed as prototype
- if(NOT SKETCH_PROTOTYPE MATCHES "(if[ ]?[\n]?[\t]*[ ]*[)])")
- file(APPEND ${SKETCH_CPP} "${SKETCH_PROTOTYPE};\n")
- else()
- arduino_debug_msg("\trejected prototype: ${SKETCH_PROTOTYPE};")
- endif()
- file(APPEND ${SKETCH_CPP} "${SKETCH_PROTOTYPE};\n")
- endforeach()
- file(APPEND ${SKETCH_CPP} "//=== END Forward: ${SKETCH_SOURCE_PATH}\n")
- endforeach()
-
- # Write Sketch CPP source
- get_num_lines("${SKETCH_HEAD}" HEAD_NUM_LINES)
- file(APPEND ${SKETCH_CPP} "#line ${HEAD_NUM_LINES} \"${MAIN_SKETCH_PATH}\"\n")
- file(APPEND ${SKETCH_CPP} "\n${SKETCH_BODY}")
- foreach (SKETCH_SOURCE_PATH ${SKETCH_SOURCES})
- file(READ ${SKETCH_SOURCE_PATH} SKETCH_SOURCE)
- file(APPEND ${SKETCH_CPP} "\n//=== START : ${SKETCH_SOURCE_PATH}\n")
- file(APPEND ${SKETCH_CPP} "#line 1 \"${SKETCH_SOURCE_PATH}\"\n")
- file(APPEND ${SKETCH_CPP} "${SKETCH_SOURCE}")
- file(APPEND ${SKETCH_CPP} "\n//=== END : ${SKETCH_SOURCE_PATH}\n")
- endforeach()
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# setup_arduino_size_script(OUTPUT_VAR)
-#
-# OUTPUT_VAR - Output variable that will contain the script path
-#
-# Generates script used to display the firmware size.
-#=============================================================================#
-function(SETUP_ARDUINO_SIZE_SCRIPT OUTPUT_VAR)
- set(ARDUINO_SIZE_SCRIPT_PATH ${CMAKE_BINARY_DIR}/CMakeFiles/FirmwareSize.cmake)
-
- file(WRITE ${ARDUINO_SIZE_SCRIPT_PATH} "
- set(AVRSIZE_PROGRAM ${AVRSIZE_PROGRAM})
- set(AVRSIZE_FLAGS -C --mcu=\${MCU})
-
- execute_process(COMMAND \${AVRSIZE_PROGRAM} \${AVRSIZE_FLAGS} \${FIRMWARE_IMAGE} \${EEPROM_IMAGE}
- OUTPUT_VARIABLE SIZE_OUTPUT)
-
-
- string(STRIP \"\${SIZE_OUTPUT}\" RAW_SIZE_OUTPUT)
-
- # Convert lines into a list
- string(REPLACE \"\\n\" \";\" SIZE_OUTPUT_LIST \"\${SIZE_OUTPUT}\")
-
- set(SIZE_OUTPUT_LINES)
- foreach(LINE \${SIZE_OUTPUT_LIST})
- if(NOT \"\${LINE}\" STREQUAL \"\")
- list(APPEND SIZE_OUTPUT_LINES \"\${LINE}\")
- endif()
- endforeach()
-
- function(EXTRACT LIST_NAME INDEX VARIABLE)
- list(GET \"\${LIST_NAME}\" \${INDEX} RAW_VALUE)
- string(STRIP \"\${RAW_VALUE}\" VALUE)
-
- set(\${VARIABLE} \"\${VALUE}\" PARENT_SCOPE)
- endfunction()
- function(PARSE INPUT VARIABLE_PREFIX)
- if(\${INPUT} MATCHES \"([^:]+):[ \\t]*([0-9]+)[ \\t]*([^ \\t]+)[ \\t]*[(]([0-9.]+)%.*\")
- set(ENTRY_NAME \${CMAKE_MATCH_1})
- set(ENTRY_SIZE \${CMAKE_MATCH_2})
- set(ENTRY_SIZE_TYPE \${CMAKE_MATCH_3})
- set(ENTRY_PERCENT \${CMAKE_MATCH_4})
- endif()
-
- set(\${VARIABLE_PREFIX}_NAME \${ENTRY_NAME} PARENT_SCOPE)
- set(\${VARIABLE_PREFIX}_SIZE \${ENTRY_SIZE} PARENT_SCOPE)
- set(\${VARIABLE_PREFIX}_SIZE_TYPE \${ENTRY_SIZE_TYPE} PARENT_SCOPE)
- set(\${VARIABLE_PREFIX}_PERCENT \${ENTRY_PERCENT} PARENT_SCOPE)
- endfunction()
-
- list(LENGTH SIZE_OUTPUT_LINES SIZE_OUTPUT_LENGTH)
- #message(\"\${SIZE_OUTPUT_LINES}\")
- #message(\"\${SIZE_OUTPUT_LENGTH}\")
- if (\${SIZE_OUTPUT_LENGTH} STREQUAL 14)
- EXTRACT(SIZE_OUTPUT_LINES 3 FIRMWARE_PROGRAM_SIZE_ROW)
- EXTRACT(SIZE_OUTPUT_LINES 5 FIRMWARE_DATA_SIZE_ROW)
- PARSE(FIRMWARE_PROGRAM_SIZE_ROW FIRMWARE_PROGRAM)
- PARSE(FIRMWARE_DATA_SIZE_ROW FIRMWARE_DATA)
-
- set(FIRMWARE_STATUS \"Firmware Size: \")
- set(FIRMWARE_STATUS \"\${FIRMWARE_STATUS} [\${FIRMWARE_PROGRAM_NAME}: \${FIRMWARE_PROGRAM_SIZE} \${FIRMWARE_PROGRAM_SIZE_TYPE} (\${FIRMWARE_PROGRAM_PERCENT}%)] \")
- set(FIRMWARE_STATUS \"\${FIRMWARE_STATUS} [\${FIRMWARE_DATA_NAME}: \${FIRMWARE_DATA_SIZE} \${FIRMWARE_DATA_SIZE_TYPE} (\${FIRMWARE_DATA_PERCENT}%)]\")
- set(FIRMWARE_STATUS \"\${FIRMWARE_STATUS} on \${MCU}\")
-
- EXTRACT(SIZE_OUTPUT_LINES 10 EEPROM_PROGRAM_SIZE_ROW)
- EXTRACT(SIZE_OUTPUT_LINES 12 EEPROM_DATA_SIZE_ROW)
- PARSE(EEPROM_PROGRAM_SIZE_ROW EEPROM_PROGRAM)
- PARSE(EEPROM_DATA_SIZE_ROW EEPROM_DATA)
-
- set(EEPROM_STATUS \"EEPROM Size: \")
- set(EEPROM_STATUS \"\${EEPROM_STATUS} [\${EEPROM_PROGRAM_NAME}: \${EEPROM_PROGRAM_SIZE} \${EEPROM_PROGRAM_SIZE_TYPE} (\${EEPROM_PROGRAM_PERCENT}%)] \")
- set(EEPROM_STATUS \"\${EEPROM_STATUS} [\${EEPROM_DATA_NAME}: \${EEPROM_DATA_SIZE} \${EEPROM_DATA_SIZE_TYPE} (\${EEPROM_DATA_PERCENT}%)]\")
- set(EEPROM_STATUS \"\${EEPROM_STATUS} on \${MCU}\")
-
- message(\"\${FIRMWARE_STATUS}\")
- message(\"\${EEPROM_STATUS}\\n\")
-
- if(\$ENV{VERBOSE})
- message(\"\${RAW_SIZE_OUTPUT}\\n\")
- elseif(\$ENV{VERBOSE_SIZE})
- message(\"\${RAW_SIZE_OUTPUT}\\n\")
- endif()
- else()
- message(\"\${RAW_SIZE_OUTPUT}\")
- endif()
- ")
-
- set(${OUTPUT_VAR} ${ARDUINO_SIZE_SCRIPT_PATH} PARENT_SCOPE)
-endfunction()
-
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# arduino_debug_on()
-#
-# Enables Arduino module debugging.
-#=============================================================================#
-function(ARDUINO_DEBUG_ON)
- set(ARDUINO_DEBUG True PARENT_SCOPE)
-endfunction()
-
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# arduino_debug_off()
-#
-# Disables Arduino module debugging.
-#=============================================================================#
-function(ARDUINO_DEBUG_OFF)
- set(ARDUINO_DEBUG False PARENT_SCOPE)
-endfunction()
-
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# arduino_debug_msg(MSG)
-#
-# MSG - Message to print
-#
-# Print Arduino debugging information. In order to enable printing
-# use arduino_debug_on() and to disable use arduino_debug_off().
-#=============================================================================#
-function(ARDUINO_DEBUG_MSG MSG)
- if(ARDUINO_DEBUG)
- message("## ${MSG}")
- endif()
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# remove_comments(SRC_VAR OUT_VAR)
-#
-# SRC_VAR - variable holding sources
-# OUT_VAR - variable holding sources with no comments
-#
-# Removes all comments from the source code.
-#=============================================================================#
-function(REMOVE_COMMENTS SRC_VAR OUT_VAR)
- string(REGEX REPLACE "[\\./\\\\]" "_" FILE "${NAME}")
-
- set(SRC ${${SRC_VAR}})
-
- #message(STATUS "removing comments from: ${FILE}")
- #file(WRITE "${CMAKE_BINARY_DIR}/${FILE}_pre_remove_comments.txt" ${SRC})
- #message(STATUS "\n${SRC}")
-
- # remove all comments
- string(REGEX REPLACE "([/][/][^\n]*)|([/][\\*]([^\\*]|([\\*]+[^/\\*]))*[\\*]+[/])" "" OUT "${SRC}")
-
- #file(WRITE "${CMAKE_BINARY_DIR}/${FILE}_post_remove_comments.txt" ${SRC})
- #message(STATUS "\n${SRC}")
-
- set(${OUT_VAR} ${OUT} PARENT_SCOPE)
-
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# get_num_lines(DOCUMENT OUTPUT_VAR)
-#
-# DOCUMENT - Document contents
-# OUTPUT_VAR - Variable which will hold the line number count
-#
-# Counts the line number of the document.
-#=============================================================================#
-function(GET_NUM_LINES DOCUMENT OUTPUT_VAR)
- string(REGEX MATCHALL "[\n]" MATCH_LIST "${DOCUMENT}")
- list(LENGTH MATCH_LIST NUM)
- set(${OUTPUT_VAR} ${NUM} PARENT_SCOPE)
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# required_variables(MSG msg VARS var1 var2 .. varN)
-#
-# MSG - Message to be displayed in case of error
-# VARS - List of variables names to check
-#
-# Ensure the specified variables are not empty, otherwise a fatal error is emmited.
-#=============================================================================#
-function(REQUIRED_VARIABLES)
- cmake_parse_arguments(INPUT "" "MSG" "VARS" ${ARGN})
- error_for_unparsed(INPUT)
- foreach(VAR ${INPUT_VARS})
- if ("${${VAR}}" STREQUAL "")
- message(FATAL_ERROR "${VAR} not set: ${INPUT_MSG}")
- endif()
- endforeach()
-endfunction()
-
-#=============================================================================#
-# [PRIVATE/INTERNAL]
-#
-# error_for_unparsed(PREFIX)
-#
-# PREFIX - Prefix name
-#
-# Emit fatal error if there are unparsed argument from cmake_parse_arguments().
-#=============================================================================#
-function(ERROR_FOR_UNPARSED PREFIX)
- set(ARGS "${${PREFIX}_UNPARSED_ARGUMENTS}")
- if (NOT ( "${ARGS}" STREQUAL "") )
- message(FATAL_ERROR "unparsed argument: ${ARGS}")
- endif()
-endfunction()
-
-
-
-
-
-
-#=============================================================================#
-# C Flags
-#=============================================================================#
-if (NOT DEFINED ARDUINO_C_FLAGS)
- set(ARDUINO_C_FLAGS "-mcall-prologues -ffunction-sections -fdata-sections")
-endif (NOT DEFINED ARDUINO_C_FLAGS)
-set(CMAKE_C_FLAGS "-g -Os ${ARDUINO_C_FLAGS}" CACHE STRING "")
-set(CMAKE_C_FLAGS_DEBUG "-g ${ARDUINO_C_FLAGS}" CACHE STRING "")
-set(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG ${ARDUINO_C_FLAGS}" CACHE STRING "")
-set(CMAKE_C_FLAGS_RELEASE "-Os -DNDEBUG -w ${ARDUINO_C_FLAGS}" CACHE STRING "")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os -g -w ${ARDUINO_C_FLAGS}" CACHE STRING "")
-
-#=============================================================================#
-# C++ Flags
-#=============================================================================#
-if (NOT DEFINED ARDUINO_CXX_FLAGS)
- set(ARDUINO_CXX_FLAGS "${ARDUINO_C_FLAGS} -fno-exceptions")
-endif (NOT DEFINED ARDUINO_CXX_FLAGS)
-set(CMAKE_CXX_FLAGS "-g -Os ${ARDUINO_CXX_FLAGS}" CACHE STRING "")
-set(CMAKE_CXX_FLAGS_DEBUG "-g ${ARDUINO_CXX_FLAGS}" CACHE STRING "")
-set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG ${ARDUINO_CXX_FLAGS}" CACHE STRING "")
-set(CMAKE_CXX_FLAGS_RELEASE "-Os -DNDEBUG ${ARDUINO_CXX_FLAGS}" CACHE STRING "")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Os -g ${ARDUINO_CXX_FLAGS}" CACHE STRING "")
-
-#=============================================================================#
-# Executable Linker Flags #
-#=============================================================================#
-set(ARDUINO_LINKER_FLAGS "-Wl,--gc-sections -lm")
-set(CMAKE_EXE_LINKER_FLAGS "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-
-#=============================================================================#
-#=============================================================================#
-# Shared Lbrary Linker Flags #
-#=============================================================================#
-set(CMAKE_SHARED_LINKER_FLAGS "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-
-set(CMAKE_MODULE_LINKER_FLAGS "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${ARDUINO_LINKER_FLAGS}" CACHE STRING "")
-
-
-#=============================================================================#
-# Arduino Settings
-#=============================================================================#
-set(ARDUINO_OBJCOPY_EEP_FLAGS -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load
- --no-change-warnings --change-section-lma .eeprom=0 CACHE STRING "")
-set(ARDUINO_OBJCOPY_HEX_FLAGS -O ihex -R .eeprom CACHE STRING "")
-set(ARDUINO_AVRDUDE_FLAGS -V CACHE STRING "")
-
-#=============================================================================#
-# Initialization
-#=============================================================================#
-if(NOT ARDUINO_FOUND AND ARDUINO_SDK_PATH)
- register_hardware_platform(${ARDUINO_SDK_PATH}/hardware/arduino/)
-
- find_file(ARDUINO_LIBRARIES_PATH
- NAMES libraries
- PATHS ${ARDUINO_SDK_PATH}
- DOC "Path to directory containing the Arduino libraries.")
-
- find_file(ARDUINO_VERSION_PATH
- NAMES lib/version.txt
- PATHS ${ARDUINO_SDK_PATH}
- DOC "Path to Arduino version file.")
-
- find_program(ARDUINO_AVRDUDE_PROGRAM
- NAMES avrdude
- PATHS ${ARDUINO_SDK_PATH}
- PATH_SUFFIXES hardware/tools
- NO_DEFAULT_PATH)
-
- find_program(ARDUINO_AVRDUDE_PROGRAM
- NAMES avrdude
- DOC "Path to avrdude programmer binary.")
-
- find_program(AVRSIZE_PROGRAM
- NAMES avr-size)
-
- find_file(ARDUINO_AVRDUDE_CONFIG_PATH
- NAMES avrdude.conf
- PATHS ${ARDUINO_SDK_PATH} /etc/avrdude
- PATH_SUFFIXES hardware/tools
- hardware/tools/avr/etc
- DOC "Path to avrdude programmer configuration file.")
-
- if(NOT CMAKE_OBJCOPY)
- find_program(AVROBJCOPY_PROGRAM
- avr-objcopy)
- set(ADDITIONAL_REQUIRED_VARS AVROBJCOPY_PROGRAM)
- set(CMAKE_OBJCOPY ${AVROBJCOPY_PROGRAM})
- endif(NOT CMAKE_OBJCOPY)
-
- set(ARDUINO_DEFAULT_BOARD uno CACHE STRING "Default Arduino Board ID when not specified.")
- set(ARDUINO_DEFAULT_PORT CACHE STRING "Default Arduino port when not specified.")
- set(ARDUINO_DEFAULT_SERIAL CACHE STRING "Default Arduino Serial command when not specified.")
- set(ARDUINO_DEFAULT_PROGRAMMER CACHE STRING "Default Arduino Programmer ID when not specified.")
-
- # Ensure that all required paths are found
- required_variables(VARS
- ARDUINO_PLATFORMS
- ARDUINO_CORES_PATH
- ARDUINO_BOOTLOADERS_PATH
- ARDUINO_LIBRARIES_PATH
- ARDUINO_BOARDS_PATH
- ARDUINO_PROGRAMMERS_PATH
- ARDUINO_VERSION_PATH
- ARDUINO_AVRDUDE_FLAGS
- ARDUINO_AVRDUDE_PROGRAM
- ARDUINO_AVRDUDE_CONFIG_PATH
- AVRSIZE_PROGRAM
- ${ADDITIONAL_REQUIRED_VARS}
- MSG "Invalid Arduino SDK path (${ARDUINO_SDK_PATH}).\n")
-
- detect_arduino_version(ARDUINO_SDK_VERSION)
- set(ARDUINO_SDK_VERSION ${ARDUINO_SDK_VERSION} CACHE STRING "Arduino SDK Version")
- set(ARDUINO_SDK_VERSION_MAJOR ${ARDUINO_SDK_VERSION_MAJOR} CACHE STRING "Arduino SDK Major Version")
- set(ARDUINO_SDK_VERSION_MINOR ${ARDUINO_SDK_VERSION_MINOR} CACHE STRING "Arduino SDK Minor Version")
- set(ARDUINO_SDK_VERSION_PATCH ${ARDUINO_SDK_VERSION_PATCH} CACHE STRING "Arduino SDK Patch Version")
-
- if(ARDUINO_SDK_VERSION VERSION_LESS 0.19)
- message(FATAL_ERROR "Unsupported Arduino SDK (require verion 0.19 or higher)")
- endif()
-
- message(STATUS "Arduino SDK version ${ARDUINO_SDK_VERSION}: ${ARDUINO_SDK_PATH}")
-
- setup_arduino_size_script(ARDUINO_SIZE_SCRIPT)
- set(ARDUINO_SIZE_SCRIPT ${ARDUINO_SIZE_SCRIPT} CACHE INTERNAL "Arduino Size Script")
-
- #print_board_list()
- #print_programmer_list()
-
- set(ARDUINO_FOUND True CACHE INTERNAL "Arduino Found")
- mark_as_advanced(
- ARDUINO_CORES_PATH
- ARDUINO_VARIANTS_PATH
- ARDUINO_BOOTLOADERS_PATH
- ARDUINO_LIBRARIES_PATH
- ARDUINO_BOARDS_PATH
- ARDUINO_PROGRAMMERS_PATH
- ARDUINO_VERSION_PATH
- ARDUINO_AVRDUDE_FLAGS
- ARDUINO_AVRDUDE_PROGRAM
- ARDUINO_AVRDUDE_CONFIG_PATH
- ARDUINO_OBJCOPY_EEP_FLAGS
- ARDUINO_OBJCOPY_HEX_FLAGS
- AVRSIZE_PROGRAM)
-endif()
-
diff --git a/rosserial/rosserial_arduino/cmake/rosserial_arduino-extras.cmake.em b/rosserial/rosserial_arduino/cmake/rosserial_arduino-extras.cmake.em
deleted file mode 100755
index 7764689..0000000
--- a/rosserial/rosserial_arduino/cmake/rosserial_arduino-extras.cmake.em
+++ /dev/null
@@ -1,8 +0,0 @@
-cmake_minimum_required(VERSION 2.8.3)
-
-@[if DEVELSPACE]@
-set(ROSSERIAL_ARDUINO_TOOLCHAIN "@(CMAKE_CURRENT_SOURCE_DIR)/arduino-cmake/cmake/ArduinoToolchain.cmake")
-@[else]@
-set(ROSSERIAL_ARDUINO_TOOLCHAIN "${rosserial_arduino_DIR}/../arduino-cmake/cmake/ArduinoToolchain.cmake")
-@[end if]@
-
diff --git a/rosserial/rosserial_arduino/msg/Adc.msg b/rosserial/rosserial_arduino/msg/Adc.msg
deleted file mode 100755
index ee748bf..0000000
--- a/rosserial/rosserial_arduino/msg/Adc.msg
+++ /dev/null
@@ -1,6 +0,0 @@
-uint16 adc0
-uint16 adc1
-uint16 adc2
-uint16 adc3
-uint16 adc4
-uint16 adc5
diff --git a/rosserial/rosserial_arduino/package.xml b/rosserial/rosserial_arduino/package.xml
deleted file mode 100755
index 81b68ba..0000000
--- a/rosserial/rosserial_arduino/package.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
- rosserial_arduino
- 0.7.1
-
- Libraries and examples for ROSserial usage on Arduino/AVR Platforms.
-
- Michael Ferguson
- Adam Stambler
- Paul Bouchier
- Mike Purvis
- BSD
- http://ros.org/wiki/rosserial_arduino
-
- catkin
-
- message_generation
-
- arduino-core
- rospy
- rosserial_msgs
- rosserial_client
- message_runtime
-
-
-
diff --git a/rosserial/rosserial_arduino/src/ros_lib/ArduinoHardware.h b/rosserial/rosserial_arduino/src/ros_lib/ArduinoHardware.h
deleted file mode 100755
index 0f7ff6b..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/ArduinoHardware.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2011, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote prducts derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ROS_ARDUINO_HARDWARE_H_
-#define ROS_ARDUINO_HARDWARE_H_
-
-#if ARDUINO>=100
- #include // Arduino 1.0
-#else
- #include // Arduino 0022
-#endif
-
-#if defined(__MK20DX128__) || defined(__MK20DX256__)
- #include // Teensy 3.0 and 3.1
- #define SERIAL_CLASS usb_serial_class
-#elif defined(_SAM3XA_)
- #include // Arduino Due
- #define SERIAL_CLASS UARTClass
-#elif defined(USE_USBCON)
- // Arduino Leonardo USB Serial Port
- #define SERIAL_CLASS Serial_
-#else
- #include // Arduino AVR
- #define SERIAL_CLASS HardwareSerial
-#endif
-
-class ArduinoHardware {
- public:
- ArduinoHardware(SERIAL_CLASS* io , long baud= 57600){
- iostream = io;
- baud_ = baud;
- }
- ArduinoHardware()
- {
-#if defined(USBCON) and !(defined(USE_USBCON))
- /* Leonardo support */
- iostream = &Serial1;
-#else
- iostream = &Serial;
-#endif
- baud_ = 57600;
- }
- ArduinoHardware(ArduinoHardware& h){
- this->iostream = iostream;
- this->baud_ = h.baud_;
- }
-
- void setBaud(long baud){
- this->baud_= baud;
- }
-
- int getBaud(){return baud_;}
-
- void init(){
-#if defined(USE_USBCON)
- // Startup delay as a fail-safe to upload a new sketch
- delay(3000);
-#endif
- iostream->begin(baud_);
- }
-
- int read(){return iostream->read();};
- void write(uint8_t* data, int length){
- for(int i=0; iwrite(data[i]);
- }
-
- unsigned long time(){return millis();}
-
- protected:
- SERIAL_CLASS* iostream;
- long baud_;
-};
-
-#endif
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/ADC/ADC.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/ADC/ADC.pde
deleted file mode 100755
index a6cabe9..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/ADC/ADC.pde
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * rosserial ADC Example
- *
- * This is a poor man's Oscilloscope. It does not have the sampling
- * rate or accuracy of a commerical scope, but it is great to get
- * an analog value into ROS in a pinch.
- */
-
-#if (ARDUINO >= 100)
- #include
-#else
- #include
-#endif
-#include
-#include
-
-ros::NodeHandle nh;
-
-rosserial_arduino::Adc adc_msg;
-ros::Publisher p("adc", &adc_msg);
-
-void setup()
-{
- pinMode(13, OUTPUT);
- nh.initNode();
-
- nh.advertise(p);
-}
-
-//We average the analog reading to elminate some of the noise
-int averageAnalog(int pin){
- int v=0;
- for(int i=0; i<4; i++) v+= analogRead(pin);
- return v/4;
-}
-
-long adc_timer;
-
-void loop()
-{
- adc_msg.adc0 = averageAnalog(0);
- adc_msg.adc1 = averageAnalog(1);
- adc_msg.adc2 = averageAnalog(2);
- adc_msg.adc3 = averageAnalog(3);
- adc_msg.adc4 = averageAnalog(4);
- adc_msg.adc5 = averageAnalog(5);
-
- p.publish(&adc_msg);
-
- nh.spinOnce();
-}
-
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/Blink/Blink.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/Blink/Blink.pde
deleted file mode 100755
index 4e9e185..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/Blink/Blink.pde
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * rosserial Subscriber Example
- * Blinks an LED on callback
- */
-
-#include
-#include
-
-ros::NodeHandle nh;
-
-void messageCb( const std_msgs::Empty& toggle_msg){
- digitalWrite(13, HIGH-digitalRead(13)); // blink the led
-}
-
-ros::Subscriber sub("toggle_led", &messageCb );
-
-void setup()
-{
- pinMode(13, OUTPUT);
- nh.initNode();
- nh.subscribe(sub);
-}
-
-void loop()
-{
- nh.spinOnce();
- delay(1);
-}
-
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/BlinkM/BlinkM.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/BlinkM/BlinkM.pde
deleted file mode 100755
index f54ea28..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/BlinkM/BlinkM.pde
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
-* RosSerial BlinkM Example
-* This program shows how to control a blinkm
-* from an arduino using RosSerial
-*/
-
-#include
-
-
-#include
-#include
-
-
-//include Wire/ twi for the BlinkM
-#include
-extern "C" {
-#include "utility/twi.h"
-}
-
-#include "BlinkM_funcs.h"
-const byte blinkm_addr = 0x09; //default blinkm address
-
-
-void setLED( bool solid, char color)
-{
-
- if (solid)
- {
- switch (color)
- {
-
- case 'w': // white
- BlinkM_stopScript( blinkm_addr );
- BlinkM_fadeToRGB( blinkm_addr, 0xff,0xff,0xff);
- break;
-
- case 'r': //RED
- BlinkM_stopScript( blinkm_addr );
- BlinkM_fadeToRGB( blinkm_addr, 0xff,0,0);
- break;
-
- case 'g':// Green
- BlinkM_stopScript( blinkm_addr );
- BlinkM_fadeToRGB( blinkm_addr, 0,0xff,0);
- break;
-
- case 'b':// Blue
- BlinkM_stopScript( blinkm_addr );
- BlinkM_fadeToRGB( blinkm_addr, 0,0,0xff);
- break;
-
- case 'c':// Cyan
- BlinkM_stopScript( blinkm_addr );
- BlinkM_fadeToRGB( blinkm_addr, 0,0xff,0xff);
- break;
-
- case 'm': // Magenta
- BlinkM_stopScript( blinkm_addr );
- BlinkM_fadeToRGB( blinkm_addr, 0xff,0,0xff);
- break;
-
- case 'y': // yellow
- BlinkM_stopScript( blinkm_addr );
- BlinkM_fadeToRGB( blinkm_addr, 0xff,0xff,0);
- break;
-
- default: // Black
- BlinkM_stopScript( blinkm_addr );
- BlinkM_fadeToRGB( blinkm_addr, 0,0,0);
- break;
- }
- }
-
-
- else
- {
- switch (color)
- {
- case 'r': // Blink Red
- BlinkM_stopScript( blinkm_addr );
- BlinkM_playScript( blinkm_addr, 3,0,0 );
- break;
- case 'w': // Blink white
- BlinkM_stopScript( blinkm_addr );
- BlinkM_playScript( blinkm_addr, 2,0,0 );
- break;
- case 'g': // Blink Green
- BlinkM_stopScript( blinkm_addr );
- BlinkM_playScript( blinkm_addr, 4,0,0 );
- break;
-
- case 'b': // Blink Blue
- BlinkM_stopScript( blinkm_addr );
- BlinkM_playScript( blinkm_addr, 5,0,0 );
- break;
-
- case 'c': //Blink Cyan
- BlinkM_stopScript( blinkm_addr );
- BlinkM_playScript( blinkm_addr, 6,0,0 );
- break;
-
- case 'm': //Blink Magenta
- BlinkM_stopScript( blinkm_addr );
- BlinkM_playScript( blinkm_addr, 7,0,0 );
- break;
-
- case 'y': //Blink Yellow
- BlinkM_stopScript( blinkm_addr );
- BlinkM_playScript( blinkm_addr, 8,0,0 );
- break;
-
- default: //OFF
- BlinkM_stopScript( blinkm_addr );
- BlinkM_playScript( blinkm_addr, 9,0,0 );
- break;
- }
-
- }
-}
-
-void light_cb( const std_msgs::String& light_cmd){
- bool solid =false;
- char color;
- if (strlen( (const char* ) light_cmd.data) ==2 ){
- solid = (light_cmd.data[0] == 'S') || (light_cmd.data[0] == 's');
- color = light_cmd.data[1];
- }
- else{
- solid= false;
- color = light_cmd.data[0];
- }
-
- setLED(solid, color);
-}
-
-
-
-ros::NodeHandle nh;
-ros::Subscriber sub("blinkm" , light_cb);
-
-
-void setup()
-{
-
- pinMode(13, OUTPUT); //set up the LED
-
- BlinkM_beginWithPower();
- delay(100);
- BlinkM_stopScript(blinkm_addr); // turn off startup script
- setLED(false, 0); //turn off the led
-
- nh.initNode();
- nh.subscribe(sub);
-
-}
-
-void loop()
-{
- nh.spinOnce();
- delay(1);
-}
-
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/BlinkM/BlinkM_funcs.h b/rosserial/rosserial_arduino/src/ros_lib/examples/BlinkM/BlinkM_funcs.h
deleted file mode 100755
index 94cabeb..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/BlinkM/BlinkM_funcs.h
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- * BlinkM_funcs.h -- Arduino 'library' to control BlinkM
- * --------------
- *
- *
- * Note: original version of this file lives with the BlinkMTester sketch
- *
- * Note: all the functions are declared 'static' because
- * it saves about 1.5 kbyte in code space in final compiled sketch.
- * A C++ library of this costs a 1kB more.
- *
- * 2007-8, Tod E. Kurt, ThingM, http://thingm.com/
- *
- * version: 20081101
- *
- * history:
- * 20080101 - initial release
- * 20080203 - added setStartupParam(), bugfix receiveBytes() from Dan Julio
- * 20081101 - fixed to work with Arduino-0012, added MaxM commands,
- * added test script read/write functions, cleaned up some functions
- * 20090121 - added I2C bus scan functions, has dependencies on private
- * functions inside Wire library, so might break in the future
- * 20100420 - added BlinkM_startPower and _stopPower
- *
- */
-
-#include
-
-extern "C" {
-#include "utility/twi.h" // from Wire library, so we can do bus scanning
-}
-
-
-// format of light script lines: duration, command, arg1,arg2,arg3
-typedef struct _blinkm_script_line {
- uint8_t dur;
- uint8_t cmd[4]; // cmd,arg1,arg2,arg3
-} blinkm_script_line;
-
-
-// Call this first (when powering BlinkM from a power supply)
-static void BlinkM_begin()
-{
- Wire.begin(); // join i2c bus (address optional for master)
-}
-
-/*
- * actually can't do this either, because twi_init() has THREE callocs in it too
- *
-static void BlinkM_reset()
-{
- twi_init(); // can't just call Wire.begin() again because of calloc()s there
-}
-*/
-
-//
-// each call to twi_writeTo() should return 0 if device is there
-// or other value (usually 2) if nothing is at that address
-//
-static void BlinkM_scanI2CBus(byte from, byte to,
- void(*callback)(byte add, byte result) )
-{
- byte rc;
- byte data = 0; // not used, just an address to feed to twi_writeTo()
- for( byte addr = from; addr <= to; addr++ ) {
- rc = twi_writeTo(addr, &data, 0, 1, 1);
- callback( addr, rc );
- }
-}
-
-//
-//
-static int8_t BlinkM_findFirstI2CDevice()
-{
- byte rc;
- byte data = 0; // not used, just an address to feed to twi_writeTo()
- for( byte addr=1; addr < 120; addr++ ) { // only scan addrs 1-120
- rc = twi_writeTo(addr, &data, 0, 1, 1);
- if( rc == 0 ) return addr; // found an address
- }
- return -1; // no device found in range given
-}
-
-// FIXME: make this more Arduino-like
-static void BlinkM_startPowerWithPins(byte pwrpin, byte gndpin)
-{
- DDRC |= _BV(pwrpin) | _BV(gndpin); // make outputs
- PORTC &=~ _BV(gndpin);
- PORTC |= _BV(pwrpin);
-}
-
-// FIXME: make this more Arduino-like
-static void BlinkM_stopPowerWithPins(byte pwrpin, byte gndpin)
-{
- DDRC &=~ (_BV(pwrpin) | _BV(gndpin));
-}
-
-//
-static void BlinkM_startPower()
-{
- BlinkM_startPowerWithPins( PORTC3, PORTC2 );
-}
-
-//
-static void BlinkM_stopPower()
-{
- BlinkM_stopPowerWithPins( PORTC3, PORTC2 );
-}
-
-// General version of BlinkM_beginWithPower().
-// Call this first when BlinkM is plugged directly into Arduino
-static void BlinkM_beginWithPowerPins(byte pwrpin, byte gndpin)
-{
- BlinkM_startPowerWithPins(pwrpin,gndpin);
- delay(100); // wait for things to stabilize
- Wire.begin();
-}
-
-// Call this first when BlinkM is plugged directly into Arduino
-// FIXME: make this more Arduino-like
-static void BlinkM_beginWithPower()
-{
- BlinkM_beginWithPowerPins( PORTC3, PORTC2 );
-}
-
-// sends a generic command
-static void BlinkM_sendCmd(byte addr, byte* cmd, int cmdlen)
-{
- Wire.beginTransmission(addr);
- for( byte i=0; idur = Wire.read();
- script_line->cmd[0] = Wire.read();
- script_line->cmd[1] = Wire.read();
- script_line->cmd[2] = Wire.read();
- script_line->cmd[3] = Wire.read();
-}
-
-//
-static void BlinkM_writeScriptLine(byte addr, byte script_id,
- byte pos, byte dur,
- byte cmd, byte arg1, byte arg2, byte arg3)
-{
-#ifdef BLINKM_FUNCS_DEBUG
- Serial.print("writing line:"); Serial.print(pos,DEC);
- Serial.print(" with cmd:"); Serial.print(cmd);
- Serial.print(" arg1:"); Serial.println(arg1,HEX);
-#endif
- Wire.beginTransmission(addr);
- Wire.write('W');
- Wire.write(script_id);
- Wire.write(pos);
- Wire.write(dur);
- Wire.write(cmd);
- Wire.write(arg1);
- Wire.write(arg2);
- Wire.write(arg3);
- Wire.endTransmission();
-
-}
-
-//
-static void BlinkM_writeScript(byte addr, byte script_id,
- byte len, byte reps,
- blinkm_script_line* lines)
-{
-#ifdef BLINKM_FUNCS_DEBUG
- Serial.print("writing script to addr:"); Serial.print(addr,DEC);
- Serial.print(", script_id:"); Serial.println(script_id,DEC);
-#endif
- for(byte i=0; i < len; i++) {
- blinkm_script_line l = lines[i];
- BlinkM_writeScriptLine( addr, script_id, i, l.dur,
- l.cmd[0], l.cmd[1], l.cmd[2], l.cmd[3]);
- delay(20); // must wait for EEPROM to be programmed
- }
- BlinkM_setScriptLengthReps(addr, script_id, len, reps);
-}
-
-//
-static void BlinkM_setStartupParams(byte addr, byte mode, byte script_id,
- byte reps, byte fadespeed, byte timeadj)
-{
- Wire.beginTransmission(addr);
- Wire.write('B');
- Wire.write(mode); // default 0x01 == Play script
- Wire.write(script_id); // default 0x00 == script #0
- Wire.write(reps); // default 0x00 == repeat infinitely
- Wire.write(fadespeed); // default 0x08 == usually overridden by sketch
- Wire.write(timeadj); // default 0x00 == sometimes overridden by sketch
- Wire.endTransmission();
-}
-
-
-// Gets digital inputs of the BlinkM
-// returns -1 on failure
-static int BlinkM_getInputsO(byte addr)
-{
- Wire.beginTransmission(addr);
- Wire.write('i');
- Wire.endTransmission();
- Wire.requestFrom(addr, (byte)1);
- if( Wire.available() ) {
- byte b = Wire.read();
- return b;
- }
- return -1;
-}
-
-// Gets digital inputs of the BlinkM
-// stores them in passed in array
-// returns -1 on failure
-static int BlinkM_getInputs(byte addr, byte inputs[])
-{
- Wire.beginTransmission(addr);
- Wire.write('i');
- Wire.endTransmission();
- Wire.requestFrom(addr, (byte)4);
- while( Wire.available() < 4 ) ; // FIXME: wait until we get 4 bytes
-
- inputs[0] = Wire.read();
- inputs[1] = Wire.read();
- inputs[2] = Wire.read();
- inputs[3] = Wire.read();
-
- return 0;
-}
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/Clapper/Clapper.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/Clapper/Clapper.pde
deleted file mode 100755
index 712b6f9..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/Clapper/Clapper.pde
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * rosserial Clapper Example
- *
- * This code is a very simple example of the kinds of
- * custom sensors that you can easily set up with rosserial
- * and Arduino. This code uses a microphone attached to
- * analog pin 5 detect two claps (2 loud sounds).
- * You can use this clapper, for example, to command a robot
- * in the area to come do your bidding.
- */
-
-#if (ARDUINO >= 100)
- #include
-#else
- #include
-#endif
-#include
-#include
-
-ros::NodeHandle nh;
-
-std_msgs::Empty clap_msg;
-ros::Publisher p("clap", &clap_msg);
-
-enum clapper_state { clap1, clap_one_waiting, pause, clap2};
-clapper_state clap;
-
-int volume_thresh = 200; //a clap sound needs to be:
- //abs(clap_volume) > average noise + volume_thresh
-int mic_pin = 5;
-int adc_ave=0;
-
-void setup()
-{
- pinMode(13, OUTPUT);
- nh.initNode();
-
- nh.advertise(p);
-
- //measure the average volume of the noise in the area
- for (int i =0; i<10;i++) adc_ave += analogRead(mic_pin);
- adc_ave /= 10;
-}
-
-long event_timer;
-
-void loop()
-{
- int mic_val = 0;
- for(int i=0; i<4; i++) mic_val += analogRead(mic_pin);
-
- mic_val = mic_val/4-adc_ave;
-
- switch(clap){
- case clap1:
- if (abs(mic_val) > volume_thresh){
- clap = clap_one_waiting;
- event_timer = millis();
- }
- break;
- case clap_one_waiting:
- if ( (abs(mic_val) < 30) && ( (millis() - event_timer) > 20 ) )
- {
- clap= pause;
- event_timer = millis();
-
- }
- break;
- case pause: // make sure there is a pause between
- // the loud sounds
- if ( mic_val > volume_thresh)
- {
- clap = clap1;
-
- }
- else if ( (millis()-event_timer)> 60) {
- clap = clap2;
- event_timer = millis();
-
- }
- break;
- case clap2:
- if (abs(mic_val) > volume_thresh){ //we have got a double clap!
- clap = clap1;
- p.publish(&clap_msg);
- }
- else if ( (millis()-event_timer)> 200) {
- clap= clap1; // no clap detected, reset state machine
- }
-
- break;
- }
- nh.spinOnce();
-}
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/HelloWorld/HelloWorld.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/HelloWorld/HelloWorld.pde
deleted file mode 100755
index 2474413..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/HelloWorld/HelloWorld.pde
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * rosserial Publisher Example
- * Prints "hello world!"
- */
-
-#include
-#include
-
-ros::NodeHandle nh;
-
-std_msgs::String str_msg;
-ros::Publisher chatter("chatter", &str_msg);
-
-char hello[13] = "hello world!";
-
-void setup()
-{
- nh.initNode();
- nh.advertise(chatter);
-}
-
-void loop()
-{
- str_msg.data = hello;
- chatter.publish( &str_msg );
- nh.spinOnce();
- delay(1000);
-}
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/IrRanger/IrRanger.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/IrRanger/IrRanger.pde
deleted file mode 100755
index 240b5a1..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/IrRanger/IrRanger.pde
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * rosserial IR Ranger Example
- *
- * This example is calibrated for the Sharp GP2D120XJ00F.
- */
-
-#include
-#include
-#include
-
-ros::NodeHandle nh;
-
-
-sensor_msgs::Range range_msg;
-ros::Publisher pub_range( "range_data", &range_msg);
-
-const int analog_pin = 0;
-unsigned long range_timer;
-
-/*
- * getRange() - samples the analog input from the ranger
- * and converts it into meters.
- */
-float getRange(int pin_num){
- int sample;
- // Get data
- sample = analogRead(pin_num)/4;
- // if the ADC reading is too low,
- // then we are really far away from anything
- if(sample < 10)
- return 254; // max range
- // Magic numbers to get cm
- sample= 1309/(sample-3);
- return (sample - 1)/100; //convert to meters
-}
-
-char frameid[] = "/ir_ranger";
-
-void setup()
-{
- nh.initNode();
- nh.advertise(pub_range);
-
- range_msg.radiation_type = sensor_msgs::Range::INFRARED;
- range_msg.header.frame_id = frameid;
- range_msg.field_of_view = 0.01;
- range_msg.min_range = 0.03;
- range_msg.max_range = 0.4;
-
-}
-
-void loop()
-{
- // publish the range value every 50 milliseconds
- // since it takes that long for the sensor to stabilize
- if ( (millis()-range_timer) > 50){
- range_msg.range = getRange(analog_pin);
- range_msg.header.stamp = nh.now();
- pub_range.publish(&range_msg);
- range_timer = millis() + 50;
- }
- nh.spinOnce();
-}
-
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/Logging/Logging.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/Logging/Logging.pde
deleted file mode 100755
index 400a9cd..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/Logging/Logging.pde
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * rosserial PubSub Example
- * Prints "hello world!" and toggles led
- */
-
-#include
-#include
-#include
-
-ros::NodeHandle nh;
-
-
-std_msgs::String str_msg;
-ros::Publisher chatter("chatter", &str_msg);
-
-char hello[13] = "hello world!";
-
-
-char debug[]= "debug statements";
-char info[] = "infos";
-char warn[] = "warnings";
-char error[] = "errors";
-char fatal[] = "fatalities";
-
-void setup()
-{
- pinMode(13, OUTPUT);
- nh.initNode();
- nh.advertise(chatter);
-}
-
-void loop()
-{
- str_msg.data = hello;
- chatter.publish( &str_msg );
-
- nh.logdebug(debug);
- nh.loginfo(info);
- nh.logwarn(warn);
- nh.logerror(error);
- nh.logfatal(fatal);
-
- nh.spinOnce();
- delay(500);
-}
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/Odom/Odom.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/Odom/Odom.pde
deleted file mode 100755
index 5841020..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/Odom/Odom.pde
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * rosserial Planar Odometry Example
- */
-
-#include
-#include
-#include
-#include
-
-ros::NodeHandle nh;
-
-geometry_msgs::TransformStamped t;
-tf::TransformBroadcaster broadcaster;
-
-double x = 1.0;
-double y = 0.0;
-double theta = 1.57;
-
-char base_link[] = "/base_link";
-char odom[] = "/odom";
-
-void setup()
-{
- nh.initNode();
- broadcaster.init(nh);
-}
-
-void loop()
-{
- // drive in a circle
- double dx = 0.2;
- double dtheta = 0.18;
- x += cos(theta)*dx*0.1;
- y += sin(theta)*dx*0.1;
- theta += dtheta*0.1;
- if(theta > 3.14)
- theta=-3.14;
-
- // tf odom->base_link
- t.header.frame_id = odom;
- t.child_frame_id = base_link;
-
- t.transform.translation.x = x;
- t.transform.translation.y = y;
-
- t.transform.rotation = tf::createQuaternionFromYaw(theta);
- t.header.stamp = nh.now();
-
- broadcaster.sendTransform(t);
- nh.spinOnce();
-
- delay(10);
-}
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/ServiceClient/ServiceClient.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/ServiceClient/ServiceClient.pde
deleted file mode 100755
index 75093a9..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/ServiceClient/ServiceClient.pde
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * rosserial Service Client
- */
-
-#include
-#include
-#include
-
-ros::NodeHandle nh;
-using rosserial_arduino::Test;
-
-ros::ServiceClient client("test_srv");
-
-std_msgs::String str_msg;
-ros::Publisher chatter("chatter", &str_msg);
-
-char hello[13] = "hello world!";
-
-void setup()
-{
- nh.initNode();
- nh.serviceClient(client);
- nh.advertise(chatter);
- while(!nh.connected()) nh.spinOnce();
- nh.loginfo("Startup complete");
-}
-
-void loop()
-{
- Test::Request req;
- Test::Response res;
- req.input = hello;
- client.call(req, res);
- str_msg.data = res.output;
- chatter.publish( &str_msg );
- nh.spinOnce();
- delay(100);
-}
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/ServiceClient/client.py b/rosserial/rosserial_arduino/src/ros_lib/examples/ServiceClient/client.py
deleted file mode 100755
index 3b27bd5..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/ServiceClient/client.py
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Sample code to use with ServiceClient.pde
-"""
-
-import roslib; roslib.load_manifest("rosserial_arduino")
-import rospy
-
-from rosserial_arduino.srv import *
-
-def callback(req):
- print "The arduino is calling! Please send it a message:"
- t = TestResponse()
- t.output = raw_input()
- return t
-
-rospy.init_node("service_client_test")
-rospy.Service("test_srv", Test, callback)
-rospy.spin()
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/ServiceServer/ServiceServer.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/ServiceServer/ServiceServer.pde
deleted file mode 100755
index 2d3fd70..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/ServiceServer/ServiceServer.pde
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * rosserial Service Server
- */
-
-#include
-#include
-#include
-
-ros::NodeHandle nh;
-using rosserial_arduino::Test;
-
-int i;
-void callback(const Test::Request & req, Test::Response & res){
- if((i++)%2)
- res.output = "hello";
- else
- res.output = "world";
-}
-
-ros::ServiceServer server("test_srv",&callback);
-
-std_msgs::String str_msg;
-ros::Publisher chatter("chatter", &str_msg);
-
-char hello[13] = "hello world!";
-
-void setup()
-{
- nh.initNode();
- nh.advertiseService(server);
- nh.advertise(chatter);
-}
-
-void loop()
-{
- str_msg.data = hello;
- chatter.publish( &str_msg );
- nh.spinOnce();
- delay(10);
-}
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/ServoControl/ServoControl.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/ServoControl/ServoControl.pde
deleted file mode 100755
index 24db409..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/ServoControl/ServoControl.pde
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * rosserial Servo Control Example
- *
- * This sketch demonstrates the control of hobby R/C servos
- * using ROS and the arduiono
- *
- * For the full tutorial write up, visit
- * www.ros.org/wiki/rosserial_arduino_demos
- *
- * For more information on the Arduino Servo Library
- * Checkout :
- * http://www.arduino.cc/en/Reference/Servo
- */
-
-#if (ARDUINO >= 100)
- #include
-#else
- #include
-#endif
-
-#include
-#include
-#include
-
-ros::NodeHandle nh;
-
-Servo servo;
-
-void servo_cb( const std_msgs::UInt16& cmd_msg){
- servo.write(cmd_msg.data); //set servo angle, should be from 0-180
- digitalWrite(13, HIGH-digitalRead(13)); //toggle led
-}
-
-
-ros::Subscriber sub("servo", servo_cb);
-
-void setup(){
- pinMode(13, OUTPUT);
-
- nh.initNode();
- nh.subscribe(sub);
-
- servo.attach(9); //attach it to pin 9
-}
-
-void loop(){
- nh.spinOnce();
- delay(1);
-}
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/Temperature/Temperature.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/Temperature/Temperature.pde
deleted file mode 100755
index 2c2f865..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/Temperature/Temperature.pde
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * rosserial Temperature Sensor Example
- *
- * This tutorial demonstrates the usage of the
- * Sparkfun TMP102 Digital Temperature Breakout board
- * http://www.sparkfun.com/products/9418
- *
- * Source Code Based off of:
- * http://wiring.org.co/learning/libraries/tmp102sparkfun.html
- */
-
-#include
-#include
-#include
-
-ros::NodeHandle nh;
-
-
-std_msgs::Float32 temp_msg;
-ros::Publisher pub_temp("temperature", &temp_msg);
-
-
-// From the datasheet the BMP module address LSB distinguishes
-// between read (1) and write (0) operations, corresponding to
-// address 0x91 (read) and 0x90 (write).
-// shift the address 1 bit right (0x91 or 0x90), the Wire library only needs the 7
-// most significant bits for the address 0x91 >> 1 = 0x48
-// 0x90 >> 1 = 0x48 (72)
-
-int sensorAddress = 0x91 >> 1; // From datasheet sensor address is 0x91
- // shift the address 1 bit right, the Wire library only needs the 7
- // most significant bits for the address
-
-
-void setup()
-{
- Wire.begin(); // join i2c bus (address optional for master)
-
- nh.initNode();
- nh.advertise(pub_temp);
-
-}
-
-long publisher_timer;
-
-void loop()
-{
-
- if (millis() > publisher_timer) {
- // step 1: request reading from sensor
- Wire.requestFrom(sensorAddress,2);
- delay(10);
- if (2 <= Wire.available()) // if two bytes were received
- {
- byte msb;
- byte lsb;
- int temperature;
-
- msb = Wire.read(); // receive high byte (full degrees)
- lsb = Wire.read(); // receive low byte (fraction degrees)
- temperature = ((msb) << 4); // MSB
- temperature |= (lsb >> 4); // LSB
-
- temp_msg.data = temperature*0.0625;
- pub_temp.publish(&temp_msg);
- }
-
- publisher_timer = millis() + 1000;
- }
-
- nh.spinOnce();
-}
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/TimeTF/TimeTF.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/TimeTF/TimeTF.pde
deleted file mode 100755
index 16fbb70..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/TimeTF/TimeTF.pde
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * rosserial Time and TF Example
- * Publishes a transform at current time
- */
-
-#include
-#include
-#include
-
-ros::NodeHandle nh;
-
-geometry_msgs::TransformStamped t;
-tf::TransformBroadcaster broadcaster;
-
-char base_link[] = "/base_link";
-char odom[] = "/odom";
-
-void setup()
-{
- nh.initNode();
- broadcaster.init(nh);
-}
-
-void loop()
-{
- t.header.frame_id = odom;
- t.child_frame_id = base_link;
- t.transform.translation.x = 1.0;
- t.transform.rotation.x = 0.0;
- t.transform.rotation.y = 0.0;
- t.transform.rotation.z = 0.0;
- t.transform.rotation.w = 1.0;
- t.header.stamp = nh.now();
- broadcaster.sendTransform(t);
- nh.spinOnce();
- delay(10);
-}
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/Ultrasound/Ultrasound.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/Ultrasound/Ultrasound.pde
deleted file mode 100755
index d5870cb..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/Ultrasound/Ultrasound.pde
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * rosserial Ultrasound Example
- *
- * This example is for the Maxbotix Ultrasound rangers.
- */
-
-#include
-#include
-#include
-
-ros::NodeHandle nh;
-
-sensor_msgs::Range range_msg;
-ros::Publisher pub_range( "/ultrasound", &range_msg);
-
-const int adc_pin = 0;
-
-char frameid[] = "/ultrasound";
-
-float getRange_Ultrasound(int pin_num){
- int val = 0;
- for(int i=0; i<4; i++) val += analogRead(pin_num);
- float range = val;
- return range /322.519685; // (0.0124023437 /4) ; //cvt to meters
-}
-
-void setup()
-{
- nh.initNode();
- nh.advertise(pub_range);
-
-
- range_msg.radiation_type = sensor_msgs::Range::ULTRASOUND;
- range_msg.header.frame_id = frameid;
- range_msg.field_of_view = 0.1; // fake
- range_msg.min_range = 0.0;
- range_msg.max_range = 6.47;
-
- pinMode(8,OUTPUT);
- digitalWrite(8, LOW);
-}
-
-
-long range_time;
-
-void loop()
-{
-
- //publish the adc value every 50 milliseconds
- //since it takes that long for the sensor to stablize
- if ( millis() >= range_time ){
- int r =0;
-
- range_msg.range = getRange_Ultrasound(5);
- range_msg.header.stamp = nh.now();
- pub_range.publish(&range_msg);
- range_time = millis() + 50;
- }
-
- nh.spinOnce();
-}
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/button_example/button_example.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/button_example/button_example.pde
deleted file mode 100755
index 0404542..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/button_example/button_example.pde
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Button Example for Rosserial
- */
-
-#include
-#include
-
-
-ros::NodeHandle nh;
-
-std_msgs::Bool pushed_msg;
-ros::Publisher pub_button("pushed", &pushed_msg);
-
-const int button_pin = 7;
-const int led_pin = 13;
-
-bool last_reading;
-long last_debounce_time=0;
-long debounce_delay=50;
-bool published = true;
-
-void setup()
-{
- nh.initNode();
- nh.advertise(pub_button);
-
- //initialize an LED output pin
- //and a input pin for our push button
- pinMode(led_pin, OUTPUT);
- pinMode(button_pin, INPUT);
-
- //Enable the pullup resistor on the button
- digitalWrite(button_pin, HIGH);
-
- //The button is a normally button
- last_reading = ! digitalRead(button_pin);
-
-}
-
-void loop()
-{
-
- bool reading = ! digitalRead(button_pin);
-
- if (last_reading!= reading){
- last_debounce_time = millis();
- published = false;
- }
-
- //if the button value has not changed for the debounce delay, we know its stable
- if ( !published && (millis() - last_debounce_time) > debounce_delay) {
- digitalWrite(led_pin, reading);
- pushed_msg.data = reading;
- pub_button.publish(&pushed_msg);
- published = true;
- }
-
- last_reading = reading;
-
- nh.spinOnce();
-}
diff --git a/rosserial/rosserial_arduino/src/ros_lib/examples/pubsub/pubsub.pde b/rosserial/rosserial_arduino/src/ros_lib/examples/pubsub/pubsub.pde
deleted file mode 100755
index 753d8ed..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/examples/pubsub/pubsub.pde
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * rosserial PubSub Example
- * Prints "hello world!" and toggles led
- */
-
-#include
-#include
-#include
-
-ros::NodeHandle nh;
-
-
-void messageCb( const std_msgs::Empty& toggle_msg){
- digitalWrite(13, HIGH-digitalRead(13)); // blink the led
-}
-
-ros::Subscriber sub("toggle_led", messageCb );
-
-
-
-std_msgs::String str_msg;
-ros::Publisher chatter("chatter", &str_msg);
-
-char hello[13] = "hello world!";
-
-void setup()
-{
- pinMode(13, OUTPUT);
- nh.initNode();
- nh.advertise(chatter);
- nh.subscribe(sub);
-}
-
-void loop()
-{
- str_msg.data = hello;
- chatter.publish( &str_msg );
- nh.spinOnce();
- delay(500);
-}
diff --git a/rosserial/rosserial_arduino/src/ros_lib/ros.h b/rosserial/rosserial_arduino/src/ros_lib/ros.h
deleted file mode 100755
index 447cf32..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/ros.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2011, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote prducts derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ROS_H_
-#define _ROS_H_
-
-#include "ros/node_handle.h"
-#include "ArduinoHardware.h"
-
-namespace ros
-{
-#if defined(__AVR_ATmega8__) || defined(__AVR_ATmega168__)
- /* downsize our buffers */
- typedef NodeHandle_ NodeHandle;
-
-#elif defined(__AVR_ATmega328P__)
-
- typedef NodeHandle_ NodeHandle;
-
-#else
-
- typedef NodeHandle_ NodeHandle;
-
-#endif
-}
-
-#endif
diff --git a/rosserial/rosserial_arduino/src/ros_lib/tests/array_test/array_test.pde b/rosserial/rosserial_arduino/src/ros_lib/tests/array_test/array_test.pde
deleted file mode 100755
index 8aa72de..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/tests/array_test/array_test.pde
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * rosserial::geometry_msgs::PoseArray Test
- * Sums an array, publishes sum
- */
-
-#include
-#include
-#include
-
-
-ros::NodeHandle nh;
-
-
-bool set_;
-
-
-geometry_msgs::Pose sum_msg;
-ros::Publisher p("sum", &sum_msg);
-
-void messageCb(const geometry_msgs::PoseArray& msg){
- sum_msg.position.x = 0;
- sum_msg.position.y = 0;
- sum_msg.position.z = 0;
- for(int i = 0; i < msg.poses_length; i++)
- {
- sum_msg.position.x += msg.poses[i].position.x;
- sum_msg.position.y += msg.poses[i].position.y;
- sum_msg.position.z += msg.poses[i].position.z;
- }
- digitalWrite(13, HIGH-digitalRead(13)); // blink the led
-}
-
-ros::Subscriber s("poses",messageCb);
-
-void setup()
-{
- pinMode(13, OUTPUT);
- nh.initNode();
- nh.subscribe(s);
- nh.advertise(p);
-}
-
-void loop()
-{
- p.publish(&sum_msg);
- nh.spinOnce();
- delay(10);
-}
-
diff --git a/rosserial/rosserial_arduino/src/ros_lib/tests/float64_test/float64_test.pde b/rosserial/rosserial_arduino/src/ros_lib/tests/float64_test/float64_test.pde
deleted file mode 100755
index 41a6f4a..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/tests/float64_test/float64_test.pde
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * rosserial::std_msgs::Float64 Test
- * Receives a Float64 input, subtracts 1.0, and publishes it
- */
-
-#include
-#include
-
-
-ros::NodeHandle nh;
-
-float x;
-
-void messageCb( const std_msgs::Float64& msg){
- x = msg.data - 1.0;
- digitalWrite(13, HIGH-digitalRead(13)); // blink the led
-}
-
-std_msgs::Float64 test;
-ros::Subscriber s("your_topic", &messageCb);
-ros::Publisher p("my_topic", &test);
-
-void setup()
-{
- pinMode(13, OUTPUT);
- nh.initNode();
- nh.advertise(p);
- nh.subscribe(s);
-}
-
-void loop()
-{
- test.data = x;
- p.publish( &test );
- nh.spinOnce();
- delay(10);
-}
-
diff --git a/rosserial/rosserial_arduino/src/ros_lib/tests/time_test/time_test.pde b/rosserial/rosserial_arduino/src/ros_lib/tests/time_test/time_test.pde
deleted file mode 100755
index c5fa739..0000000
--- a/rosserial/rosserial_arduino/src/ros_lib/tests/time_test/time_test.pde
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * rosserial::std_msgs::Time Test
- * Publishes current time
- */
-
-#include
-#include
-#include
-
-
-ros::NodeHandle nh;
-
-std_msgs::Time test;
-ros::Publisher p("my_topic", &test);
-
-void setup()
-{
- pinMode(13, OUTPUT);
- nh.initNode();
- nh.advertise(p);
-}
-
-void loop()
-{
- test.data = nh.now();
- p.publish( &test );
- nh.spinOnce();
- delay(10);
-}
-
diff --git a/rosserial/rosserial_arduino/src/rosserial_arduino/make_libraries.py b/rosserial/rosserial_arduino/src/rosserial_arduino/make_libraries.py
deleted file mode 100755
index 21eb1af..0000000
--- a/rosserial/rosserial_arduino/src/rosserial_arduino/make_libraries.py
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/env python
-
-#####################################################################
-# Software License Agreement (BSD License)
-#
-# Copyright (c) 2013, Willow Garage, Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-# * Neither the name of Willow Garage, Inc. nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-THIS_PACKAGE = "rosserial_arduino"
-
-__usage__ = """
-make_libraries.py generates the Arduino rosserial library files. It
-requires the location of your Arduino sketchbook/libraries folder.
-
-rosrun rosserial_arduino make_libraries.py
-"""
-
-import rospkg
-import rosserial_client
-from rosserial_client.make_library import *
-
-# for copying files
-import shutil
-
-ROS_TO_EMBEDDED_TYPES = {
- 'bool' : ('bool', 1, PrimitiveDataType, []),
- 'byte' : ('int8_t', 1, PrimitiveDataType, []),
- 'int8' : ('int8_t', 1, PrimitiveDataType, []),
- 'char' : ('uint8_t', 1, PrimitiveDataType, []),
- 'uint8' : ('uint8_t', 1, PrimitiveDataType, []),
- 'int16' : ('int16_t', 2, PrimitiveDataType, []),
- 'uint16' : ('uint16_t', 2, PrimitiveDataType, []),
- 'int32' : ('int32_t', 4, PrimitiveDataType, []),
- 'uint32' : ('uint32_t', 4, PrimitiveDataType, []),
- 'int64' : ('int64_t', 8, PrimitiveDataType, []),
- 'uint64' : ('uint64_t', 4, PrimitiveDataType, []),
- 'float32' : ('float', 4, PrimitiveDataType, []),
- 'float64' : ('float', 4, AVR_Float64DataType, []),
- 'time' : ('ros::Time', 8, TimeDataType, ['ros/time']),
- 'duration': ('ros::Duration', 8, TimeDataType, ['ros/duration']),
- 'string' : ('char*', 0, StringDataType, []),
- 'Header' : ('std_msgs::Header', 0, MessageDataType, ['std_msgs/Header'])
-}
-
-# need correct inputs
-if (len(sys.argv) < 2):
- print __usage__
- exit()
-
-# get output path
-path = sys.argv[1]
-if path[-1] == "/":
- path = path[0:-1]
-print "\nExporting to %s" % path
-
-rospack = rospkg.RosPack()
-
-# copy ros_lib stuff in
-rosserial_arduino_dir = rospack.get_path(THIS_PACKAGE)
-shutil.copytree(rosserial_arduino_dir+"/src/ros_lib", path+"/ros_lib")
-rosserial_client_copy_files(rospack, path+"/ros_lib/")
-
-# generate messages
-rosserial_generate(rospack, path+"/ros_lib", ROS_TO_EMBEDDED_TYPES)
-
diff --git a/rosserial/rosserial_arduino/srv/Test.srv b/rosserial/rosserial_arduino/srv/Test.srv
deleted file mode 100755
index 27de772..0000000
--- a/rosserial/rosserial_arduino/srv/Test.srv
+++ /dev/null
@@ -1,3 +0,0 @@
-string input
----
-string output
diff --git a/rosserial/rosserial_client/CHANGELOG.rst b/rosserial/rosserial_client/CHANGELOG.rst
deleted file mode 100755
index a0065e4..0000000
--- a/rosserial/rosserial_client/CHANGELOG.rst
+++ /dev/null
@@ -1,109 +0,0 @@
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Changelog for package rosserial_client
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-0.7.1 (2015-07-06)
-------------------
-* Provide option to pass through CMake arguments in the CMAKE_COMMAND
- invocation. The use-case is primarily specifying additional paths to
- modules, for separately-packaged libraries.
-* Contributors: Mike Purvis
-
-0.7.0 (2015-04-23)
-------------------
-* Initial release for Jade.
-* Make message generating error message more verbose.
-* Fix initializer for fixed-length arrays.
-* Generate constructors for messages.
-* Switch to stdint integers. This allows the client to run on 64-bit systems.
-* Contributors: Mickaël, Mike Purvis, Mitchell Wills, chuck-h
-
-0.6.3 (2014-11-05)
-------------------
-* Move avr serialization logic to Msg class, add gtest to exercise it.
-* Fixed the deserialization of avr64bit in order to support negative numbers.
-* Contributors: Martin Gerdzhev, Mike Purvis
-
-0.6.2 (2014-09-10)
-------------------
-* Generic CMake helpers for ros_lib generation and in-package firmwares.
-* Fix output of make_library when package has only messages
-* Added time out to the state machine
-* Contributors: Jason Scatena, Michael Ferguson, Mike Purvis
-
-0.6.1 (2014-06-30)
-------------------
-* Remove ID_TX_STOP define
-* Fix ID_TX_STOP in the client lib.
-* Contributors: Mike Purvis
-
-0.6.0 (2014-06-11)
-------------------
-* Remove include of ros.h from time.cpp
-* No xx_val pointers for fixed-length arrays of messages.
-* Use const char* instead of char* for strings in messages.
-* Contributors: Mike Purvis
-
-0.5.6 (2014-06-11)
-------------------
-* Add Mike Purvis as maintainer
-* make tf topic absolute instead of relative to prevent remapping with tag
-* fix: msg id serialization
-* fix: wrong message lenght, if message size more than 255
-* fix odometry deserialization error http://answers.ros.org/question/73807/rosserial-deserialization-error/
-* add better debugging information when packages are missing dependencies
-* remove ID_TX_STOP from rosserial_msgs/msg/TopicInfo.msg, using hardcode modification.
-* fix the dupilcated registration problem of subscriber
-* Contributors: Michael Ferguson, Mike Purvis, Moju Zhao, agentx3r, denis
-
-0.5.5 (2014-01-14)
-------------------
-
-0.5.4 (2013-10-17)
-------------------
-* fix an uninitialized data bug on arduino
-
-0.5.3 (2013-09-21)
-------------------
-* Added some missing return values
-* Fixed uninitialized arrays that would cause random segfaults on spinOnce
-and advertise. Fixed other ininitialized variables.
-* fixed misalignment for 32 bit architectures
-
-0.5.2 (2013-07-17)
-------------------
-
-* Fix release version
-
-0.5.1 (2013-07-15)
-------------------
-* Modified the return value of publish()
-* Modified the frame structure for serial communication, particularly add the checksum for msg_len
- * Associated protocol version ID in message and version mismatch handling
-
-0.4.5 (2013-07-02)
-------------------
-* fail gently when messages/packages are corrupt. update print statements while at it
-* Fixed a bug in ros_lib install logic which took an exception because it copied files to themselves
- Added execute permission to make_libraries.py in rosserial_embeddedlinux
- Moved examples under src in rosserial_embeddedlinux
-
-0.4.4 (2013-03-20)
-------------------
-
-0.4.3 (2013-03-13 14:08)
-------------------------
-
-0.4.2 (2013-03-13 01:15)
-------------------------
-* fix build issues when in isolation by moving more stuff into make_library
-
-0.4.1 (2013-03-09)
-------------------
-
-0.4.0 (2013-03-08)
-------------------
-* initial catkin version on github
-* Temporary patch for `#30 `_
-* Added missing math.h include.
-* Changed DEBUG log level to ROSDEBUG.
diff --git a/rosserial/rosserial_client/CMakeLists.txt b/rosserial/rosserial_client/CMakeLists.txt
deleted file mode 100755
index 5541635..0000000
--- a/rosserial/rosserial_client/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-cmake_minimum_required(VERSION 2.8.3)
-project(rosserial_client)
-
-find_package(catkin REQUIRED)
-catkin_package(
- CFG_EXTRAS rosserial_client-extras.cmake
-)
-
-catkin_python_setup()
-
-install(DIRECTORY src/ros_lib
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/src
-)
-install(PROGRAMS scripts/make_libraries
- DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
-)
-
-if(CATKIN_ENABLE_TESTING)
- include_directories(src)
- catkin_add_gtest(float64_test test/float64_test.cpp)
-endif()
diff --git a/rosserial/rosserial_client/cmake/rosserial_client-extras.cmake b/rosserial/rosserial_client/cmake/rosserial_client-extras.cmake
deleted file mode 100755
index e43c98f..0000000
--- a/rosserial/rosserial_client/cmake/rosserial_client-extras.cmake
+++ /dev/null
@@ -1,89 +0,0 @@
-cmake_minimum_required(VERSION 2.8.3)
-
-#
-# Generate a rosserial_client ros_lib folder using the make_libraries
-# script supplied by a particular package. The default is to fall back
-# on the generic script in rosserial_client itself.
-#
-# :param PACKAGE: name of package to look in for lib generating script.
-# :type PACKAGE: string
-# :param SCRIPT: name of script, for example `make_libraries.py`.
-# :type SCRIPT: string
-#
-# @public
-#
-function(rosserial_generate_ros_lib)
- cmake_parse_arguments(make_libraries "" "PACKAGE;SCRIPT" "" ${ARGN})
- if(NOT make_libraries_PACKAGE)
- set(make_libraries_PACKAGE rosserial_client)
- endif()
- if(NOT make_libraries_SCRIPT)
- set(make_libraries_SCRIPT make_libraries)
- endif()
-
- message(STATUS "Using ${make_libraries_PACKAGE}/${make_libraries_SCRIPT} to make rosserial client library.")
-
- add_custom_command(
- OUTPUT ${PROJECT_BINARY_DIR}/ros_lib
- COMMAND ${CATKIN_ENV} rosrun ${make_libraries_PACKAGE} ${make_libraries_SCRIPT} ${PROJECT_BINARY_DIR}
- )
- add_custom_target(${PROJECT_NAME}_ros_lib DEPENDS ${PROJECT_BINARY_DIR}/ros_lib)
- add_dependencies(${PROJECT_NAME}_ros_lib rosserial_msgs_genpy std_msgs_genpy)
- set(${PROJECT_NAME}_ROS_LIB_DIR "${PROJECT_BINARY_DIR}/ros_lib" PARENT_SCOPE)
-endfunction()
-
-#
-# Configure a CMake project located in a subfolder of a catkin project,
-# optionally specifying a CMake toolchain to use in the build of the
-# subproject.
-#
-# :param DIRECTORY: subdirectory of current package to configure.
-# :type DIRECTORY: string
-# :param TOOLCHAIN_FILE: full path to toolchain file.
-# :type TOOLCHAIN_FILE: string
-#
-# @public
-#
-function(rosserial_configure_client)
- cmake_parse_arguments(client "" "DIRECTORY;TOOLCHAIN_FILE" "CMAKE_ARGUMENTS" ${ARGN})
- if(NOT client_DIRECTORY)
- message(SEND_ERROR "rosserial_client_add_client called without DIRECTORY argument.")
- endif()
-
- if(client_TOOLCHAIN_FILE)
- set(DTOOLCHAIN_FILE -DCMAKE_TOOLCHAIN_FILE=${client_TOOLCHAIN_FILE})
- endif()
-
- # Create a build tree directory for configuring the client's CMake project.
- file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${client_DIRECTORY})
- add_custom_target(${PROJECT_NAME}_${client_DIRECTORY}
- WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${client_DIRECTORY}
- COMMAND ${CMAKE_COMMAND} ${PROJECT_SOURCE_DIR}/${client_DIRECTORY}
- -DROS_LIB_DIR=${${PROJECT_NAME}_ROS_LIB_DIR}
- -DEXECUTABLE_OUTPUT_PATH=${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}
- ${client_CMAKE_ARGUMENTS}
- ${DTOOLCHAIN_FILE}
- )
- add_dependencies(${PROJECT_NAME}_${client_DIRECTORY} ${PROJECT_NAME}_ros_lib)
-endfunction()
-
-#
-# Create a catkin target which builds a target in the subproject.
-#
-# :param client_directory: subdirectory of current package with subproject.
-# :type client_directory: string
-# :param client_target: name of target in subproject to build.
-# :type client_target: string
-# :param ARGN: additional arguments for target (eg, ALL).
-# :type ARGN: list of strings
-#
-# @public
-#
-function(rosserial_add_client_target client_directory client_target)
- add_custom_target(${PROJECT_NAME}_${client_directory}_${client_target} ${ARGN}
- WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${client_directory}
- COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/${client_directory} -- ${client_target}
- )
- add_dependencies(${PROJECT_NAME}_${client_directory}_${client_target}
- ${PROJECT_NAME}_${client_directory})
-endfunction()
diff --git a/rosserial/rosserial_client/package.xml b/rosserial/rosserial_client/package.xml
deleted file mode 100755
index c3fb5b8..0000000
--- a/rosserial/rosserial_client/package.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
- rosserial_client
- 0.7.1
-
- Generalized client side source for rosserial.
-
- Michael Ferguson
- Adam Stambler
- Paul Bouchier
- Mike Purvis
- BSD
- http://ros.org/wiki/rosserial_client
-
- catkin
-
- std_msgs
- rosserial_msgs
- rospy
- tf
-
diff --git a/rosserial/rosserial_client/scripts/make_libraries b/rosserial/rosserial_client/scripts/make_libraries
deleted file mode 100755
index f493cb3..0000000
--- a/rosserial/rosserial_client/scripts/make_libraries
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env python
-
-#####################################################################
-# Software License Agreement (BSD License)
-#
-# Copyright (c) 2013, Willow Garage
-# Copyright (c) 2014, Mike Purvis
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-# * Neither the name of Willow Garage, Inc. nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-THIS_PACKAGE = "rosserial_client"
-
-__usage__ = """
-This generic make_libraries generates the non-platform specific part of a
-rosserial client library, including messages. It assumes the target platform
-has native float64 support, and is therefore unsuitable for use with AVR.
-To generate messages for AVR, use the make_libraries script in
-rosserial_arduino.
-
-This script also does not provide the ros.h file or other hardware
-abstraction. This will need to be supplied by the user.
-
-rosrun rosserial_client make_libraries
-"""
-
-import rospkg
-
-import rosserial_client
-from rosserial_client.make_library import *
-
-# for copying files
-import shutil
-
-ROS_TO_EMBEDDED_TYPES = {
- 'bool' : ('bool', 1, PrimitiveDataType, []),
- 'byte' : ('int8_t', 1, PrimitiveDataType, []),
- 'int8' : ('int8_t', 1, PrimitiveDataType, []),
- 'char' : ('uint8_t', 1, PrimitiveDataType, []),
- 'uint8' : ('uint8_t', 1, PrimitiveDataType, []),
- 'int16' : ('int16_t', 2, PrimitiveDataType, []),
- 'uint16' : ('uint16_t', 2, PrimitiveDataType, []),
- 'int32' : ('int32_t', 4, PrimitiveDataType, []),
- 'uint32' : ('uint32_t', 4, PrimitiveDataType, []),
- 'int64' : ('int64_t', 8, PrimitiveDataType, []),
- 'uint64' : ('uint64_t', 8, PrimitiveDataType, []),
- 'float32' : ('float', 4, PrimitiveDataType, []),
- 'float64' : ('double', 8, PrimitiveDataType, []),
- 'time' : ('ros::Time', 8, TimeDataType, ['ros/time']),
- 'duration': ('ros::Duration', 8, TimeDataType, ['ros/duration']),
- 'string' : ('char*', 0, StringDataType, []),
- 'Header' : ('std_msgs::Header', 0, MessageDataType, ['std_msgs/Header'])
-}
-
-# Enforce correct inputs
-if (len(sys.argv) < 2):
- print(__usage__)
- exit(1)
-
-# Sanitize output path
-path = sys.argv[1]
-if path[-1] == "/":
- path = path[0:-1]
-print "\nExporting to %s" % path
-
-rospack = rospkg.RosPack()
-rosserial_client_copy_files(rospack, path+"/ros_lib/")
-rosserial_generate(rospack, path+"/ros_lib", ROS_TO_EMBEDDED_TYPES)
diff --git a/rosserial/rosserial_client/setup.py b/rosserial/rosserial_client/setup.py
deleted file mode 100755
index 726bfa9..0000000
--- a/rosserial/rosserial_client/setup.py
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env python
-
-from distutils.core import setup
-from catkin_pkg.python_setup import generate_distutils_setup
-
-d = generate_distutils_setup(
- packages=['rosserial_client'],
- package_dir={'': 'src'},
- )
-
-setup(**d)
diff --git a/rosserial/rosserial_client/src/ros_lib/duration.cpp b/rosserial/rosserial_client/src/ros_lib/duration.cpp
deleted file mode 100755
index f471c33..0000000
--- a/rosserial/rosserial_client/src/ros_lib/duration.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2011, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote prducts derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include
-#include "ros/duration.h"
-
-namespace ros
-{
- void normalizeSecNSecSigned(int32_t &sec, int32_t &nsec)
- {
- int32_t nsec_part = nsec;
- int32_t sec_part = sec;
-
- while (nsec_part > 1000000000L)
- {
- nsec_part -= 1000000000L;
- ++sec_part;
- }
- while (nsec_part < 0)
- {
- nsec_part += 1000000000L;
- --sec_part;
- }
- sec = sec_part;
- nsec = nsec_part;
- }
-
- Duration& Duration::operator+=(const Duration &rhs)
- {
- sec += rhs.sec;
- nsec += rhs.nsec;
- normalizeSecNSecSigned(sec, nsec);
- return *this;
- }
-
- Duration& Duration::operator-=(const Duration &rhs){
- sec += -rhs.sec;
- nsec += -rhs.nsec;
- normalizeSecNSecSigned(sec, nsec);
- return *this;
- }
-
- Duration& Duration::operator*=(double scale){
- sec *= scale;
- nsec *= scale;
- normalizeSecNSecSigned(sec, nsec);
- return *this;
- }
-
-}
diff --git a/rosserial/rosserial_client/src/ros_lib/ros/duration.h b/rosserial/rosserial_client/src/ros_lib/ros/duration.h
deleted file mode 100755
index ab889cd..0000000
--- a/rosserial/rosserial_client/src/ros_lib/ros/duration.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2011, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote prducts derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ROS_DURATION_H_
-#define _ROS_DURATION_H_
-
-#include
-#include
-
-namespace ros {
-
- void normalizeSecNSecSigned(int32_t& sec, int32_t& nsec);
-
- class Duration
- {
- public:
- int32_t sec, nsec;
-
- Duration() : sec(0), nsec(0) {}
- Duration(int32_t _sec, int32_t _nsec) : sec(_sec), nsec(_nsec)
- {
- normalizeSecNSecSigned(sec, nsec);
- }
-
- double toSec() const { return (double)sec + 1e-9*(double)nsec; };
- void fromSec(double t) { sec = (uint32_t) floor(t); nsec = (uint32_t) round((t-sec) * 1e9); };
-
- Duration& operator+=(const Duration &rhs);
- Duration& operator-=(const Duration &rhs);
- Duration& operator*=(double scale);
- };
-
-}
-
-#endif
-
diff --git a/rosserial/rosserial_client/src/ros_lib/ros/msg.h b/rosserial/rosserial_client/src/ros_lib/ros/msg.h
deleted file mode 100755
index 87f2e5c..0000000
--- a/rosserial/rosserial_client/src/ros_lib/ros/msg.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2011, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote prducts derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ROS_MSG_H_
-#define _ROS_MSG_H_
-
-#include
-
-namespace ros {
-
-/* Base Message Type */
-class Msg
-{
-public:
- virtual int serialize(unsigned char *outbuffer) const = 0;
- virtual int deserialize(unsigned char *data) = 0;
- virtual const char * getType() = 0;
- virtual const char * getMD5() = 0;
-
- /**
- * @brief This tricky function handles promoting a 32bit float to a 64bit
- * double, so that AVR can publish messages containing float64
- * fields, despite AVV having no native support for double.
- *
- * @param[out] outbuffer pointer for buffer to serialize to.
- * @param[in] f value to serialize.
- *
- * @return number of bytes to advance the buffer pointer.
- *
- */
- static int serializeAvrFloat64(unsigned char* outbuffer, const float f)
- {
- const int32_t* val = (int32_t*) &f;
- int32_t exp = ((*val >> 23) & 255);
- if (exp != 0)
- {
- exp += 1023 - 127;
- }
-
- int32_t sig = *val;
- *(outbuffer++) = 0;
- *(outbuffer++) = 0;
- *(outbuffer++) = 0;
- *(outbuffer++) = (sig << 5) & 0xff;
- *(outbuffer++) = (sig >> 3) & 0xff;
- *(outbuffer++) = (sig >> 11) & 0xff;
- *(outbuffer++) = ((exp << 4) & 0xF0) | ((sig >> 19) & 0x0F);
- *(outbuffer++) = (exp >> 4) & 0x7F;
-
- // Mark negative bit as necessary.
- if (f < 0)
- {
- *(outbuffer - 1) |= 0x80;
- }
-
- return 8;
- }
-
- /**
- * @brief This tricky function handles demoting a 64bit double to a
- * 32bit float, so that AVR can understand messages containing
- * float64 fields, despite AVR having no native support for double.
- *
- * @param[in] inbuffer pointer for buffer to deserialize from.
- * @param[out] f pointer to place the deserialized value in.
- *
- * @return number of bytes to advance the buffer pointer.
- */
- static int deserializeAvrFloat64(const unsigned char* inbuffer, float* f)
- {
- uint32_t* val = (uint32_t*)f;
- inbuffer += 3;
-
- // Copy truncated mantissa.
- *val = ((uint32_t)(*(inbuffer++)) >> 5 & 0x07);
- *val |= ((uint32_t)(*(inbuffer++)) & 0xff) << 3;
- *val |= ((uint32_t)(*(inbuffer++)) & 0xff) << 11;
- *val |= ((uint32_t)(*inbuffer) & 0x0f) << 19;
-
- // Copy truncated exponent.
- uint32_t exp = ((uint32_t)(*(inbuffer++)) & 0xf0)>>4;
- exp |= ((uint32_t)(*inbuffer) & 0x7f) << 4;
- if (exp != 0)
- {
- *val |= ((exp) - 1023 + 127) << 23;
- }
-
- // Copy negative sign.
- *val |= ((uint32_t)(*(inbuffer++)) & 0x80) << 24;
-
- return 8;
- }
-
-};
-
-} // namespace ros
-
-#endif
diff --git a/rosserial/rosserial_client/src/ros_lib/ros/node_handle.h b/rosserial/rosserial_client/src/ros_lib/ros/node_handle.h
deleted file mode 100755
index 9babaff..0000000
--- a/rosserial/rosserial_client/src/ros_lib/ros/node_handle.h
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2011, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote prducts derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ROS_NODE_HANDLE_H_
-#define ROS_NODE_HANDLE_H_
-
-#include
-
-#include "std_msgs/Time.h"
-#include "rosserial_msgs/TopicInfo.h"
-#include "rosserial_msgs/Log.h"
-#include "rosserial_msgs/RequestParam.h"
-
-#define SYNC_SECONDS 5
-
-#define MODE_FIRST_FF 0
-/*
- * The second sync byte is a protocol version. It's value is 0xff for the first
- * version of the rosserial protocol (used up to hydro), 0xfe for the second version
- * (introduced in hydro), 0xfd for the next, and so on. Its purpose is to enable
- * detection of mismatched protocol versions (e.g. hydro rosserial_python with groovy
- * rosserial_arduino. It must be changed in both this file and in
- * rosserial_python/src/rosserial_python/SerialClient.py
- */
-#define MODE_PROTOCOL_VER 1
-#define PROTOCOL_VER1 0xff // through groovy
-#define PROTOCOL_VER2 0xfe // in hydro
-#define PROTOCOL_VER PROTOCOL_VER2
-#define MODE_SIZE_L 2
-#define MODE_SIZE_H 3
-#define MODE_SIZE_CHECKSUM 4 // checksum for msg size received from size L and H
-#define MODE_TOPIC_L 5 // waiting for topic id
-#define MODE_TOPIC_H 6
-#define MODE_MESSAGE 7
-#define MODE_MSG_CHECKSUM 8 // checksum for msg and topic id
-
-
-#define MSG_TIMEOUT 20 //20 milliseconds to recieve all of message data
-
-#include "msg.h"
-
-namespace ros {
-
- class NodeHandleBase_{
- public:
- virtual int publish(int id, const Msg* msg)=0;
- virtual int spinOnce()=0;
- virtual bool connected()=0;
- };
-}
-
-#include "publisher.h"
-#include "subscriber.h"
-#include "service_server.h"
-#include "service_client.h"
-
-namespace ros {
-
- using rosserial_msgs::TopicInfo;
-
- /* Node Handle */
- template
- class NodeHandle_ : public NodeHandleBase_
- {
- protected:
- Hardware hardware_;
-
- /* time used for syncing */
- uint32_t rt_time;
-
- /* used for computing current time */
- uint32_t sec_offset, nsec_offset;
-
- uint8_t message_in[INPUT_SIZE];
- uint8_t message_out[OUTPUT_SIZE];
-
- Publisher * publishers[MAX_PUBLISHERS];
- Subscriber_ * subscribers[MAX_SUBSCRIBERS];
-
- /*
- * Setup Functions
- */
- public:
- NodeHandle_() : configured_(false) {
-
- for(unsigned int i=0; i< MAX_PUBLISHERS; i++)
- publishers[i] = 0;
-
- for(unsigned int i=0; i< MAX_SUBSCRIBERS; i++)
- subscribers[i] = 0;
-
- for(unsigned int i=0; i< INPUT_SIZE; i++)
- message_in[i] = 0;
-
- for(unsigned int i=0; i< OUTPUT_SIZE; i++)
- message_out[i] = 0;
-
- req_param_resp.ints_length = 0;
- req_param_resp.ints = NULL;
- req_param_resp.floats_length = 0;
- req_param_resp.floats = NULL;
- req_param_resp.ints_length = 0;
- req_param_resp.ints = NULL;
- }
-
- Hardware* getHardware(){
- return &hardware_;
- }
-
- /* Start serial, initialize buffers */
- void initNode(){
- hardware_.init();
- mode_ = 0;
- bytes_ = 0;
- index_ = 0;
- topic_ = 0;
- };
-
- /* Start a named port, which may be network server IP, initialize buffers */
- void initNode(char *portName){
- hardware_.init(portName);
- mode_ = 0;
- bytes_ = 0;
- index_ = 0;
- topic_ = 0;
- };
-
- protected:
- //State machine variables for spinOnce
- int mode_;
- int bytes_;
- int topic_;
- int index_;
- int checksum_;
-
- bool configured_;
-
- /* used for syncing the time */
- uint32_t last_sync_time;
- uint32_t last_sync_receive_time;
- uint32_t last_msg_timeout_time;
-
- public:
- /* This function goes in your loop() function, it handles
- * serial input and callbacks for subscribers.
- */
-
-
- virtual int spinOnce(){
-
- /* restart if timed out */
- uint32_t c_time = hardware_.time();
- if( (c_time - last_sync_receive_time) > (SYNC_SECONDS*2200) ){
- configured_ = false;
- }
-
- /* reset if message has timed out */
- if ( mode_ != MODE_FIRST_FF){
- if (c_time > last_msg_timeout_time){
- mode_ = MODE_FIRST_FF;
- }
- }
-
- /* while available buffer, read data */
- while( true )
- {
- int data = hardware_.read();
- if( data < 0 )
- break;
- checksum_ += data;
- if( mode_ == MODE_MESSAGE ){ /* message data being recieved */
- message_in[index_++] = data;
- bytes_--;
- if(bytes_ == 0) /* is message complete? if so, checksum */
- mode_ = MODE_MSG_CHECKSUM;
- }else if( mode_ == MODE_FIRST_FF ){
- if(data == 0xff){
- mode_++;
- last_msg_timeout_time = c_time + MSG_TIMEOUT;
- }
- else if( hardware_.time() - c_time > (SYNC_SECONDS)){
- /* We have been stuck in spinOnce too long, return error */
- configured_=false;
- return -2;
- }
- }else if( mode_ == MODE_PROTOCOL_VER ){
- if(data == PROTOCOL_VER){
- mode_++;
- }else{
- mode_ = MODE_FIRST_FF;
- if (configured_ == false)
- requestSyncTime(); /* send a msg back showing our protocol version */
- }
- }else if( mode_ == MODE_SIZE_L ){ /* bottom half of message size */
- bytes_ = data;
- index_ = 0;
- mode_++;
- checksum_ = data; /* first byte for calculating size checksum */
- }else if( mode_ == MODE_SIZE_H ){ /* top half of message size */
- bytes_ += data<<8;
- mode_++;
- }else if( mode_ == MODE_SIZE_CHECKSUM ){
- if( (checksum_%256) == 255)
- mode_++;
- else
- mode_ = MODE_FIRST_FF; /* Abandon the frame if the msg len is wrong */
- }else if( mode_ == MODE_TOPIC_L ){ /* bottom half of topic id */
- topic_ = data;
- mode_++;
- checksum_ = data; /* first byte included in checksum */
- }else if( mode_ == MODE_TOPIC_H ){ /* top half of topic id */
- topic_ += data<<8;
- mode_ = MODE_MESSAGE;
- if(bytes_ == 0)
- mode_ = MODE_MSG_CHECKSUM;
- }else if( mode_ == MODE_MSG_CHECKSUM ){ /* do checksum */
- mode_ = MODE_FIRST_FF;
- if( (checksum_%256) == 255){
- if(topic_ == TopicInfo::ID_PUBLISHER){
- requestSyncTime();
- negotiateTopics();
- last_sync_time = c_time;
- last_sync_receive_time = c_time;
- return -1;
- }else if(topic_ == TopicInfo::ID_TIME){
- syncTime(message_in);
- }else if (topic_ == TopicInfo::ID_PARAMETER_REQUEST){
- req_param_resp.deserialize(message_in);
- param_recieved= true;
- }else if(topic_ == TopicInfo::ID_TX_STOP){
- configured_ = false;
- }else{
- if(subscribers[topic_-100])
- subscribers[topic_-100]->callback( message_in );
- }
- }
- }
- }
-
- /* occasionally sync time */
- if( configured_ && ((c_time-last_sync_time) > (SYNC_SECONDS*500) )){
- requestSyncTime();
- last_sync_time = c_time;
- }
-
- return 0;
- }
-
-
- /* Are we connected to the PC? */
- virtual bool connected() {
- return configured_;
- };
-
- /********************************************************************
- * Time functions
- */
-
- void requestSyncTime()
- {
- std_msgs::Time t;
- publish(TopicInfo::ID_TIME, &t);
- rt_time = hardware_.time();
- }
-
- void syncTime(uint8_t * data)
- {
- std_msgs::Time t;
- uint32_t offset = hardware_.time() - rt_time;
-
- t.deserialize(data);
- t.data.sec += offset/1000;
- t.data.nsec += (offset%1000)*1000000UL;
-
- this->setNow(t.data);
- last_sync_receive_time = hardware_.time();
- }
-
- Time now()
- {
- uint32_t ms = hardware_.time();
- Time current_time;
- current_time.sec = ms/1000 + sec_offset;
- current_time.nsec = (ms%1000)*1000000UL + nsec_offset;
- normalizeSecNSec(current_time.sec, current_time.nsec);
- return current_time;
- }
-
- void setNow( Time & new_now )
- {
- uint32_t ms = hardware_.time();
- sec_offset = new_now.sec - ms/1000 - 1;
- nsec_offset = new_now.nsec - (ms%1000)*1000000UL + 1000000000UL;
- normalizeSecNSec(sec_offset, nsec_offset);
- }
-
- /********************************************************************
- * Topic Management
- */
-
- /* Register a new publisher */
- bool advertise(Publisher & p)
- {
- for(int i = 0; i < MAX_PUBLISHERS; i++){
- if(publishers[i] == 0){ // empty slot
- publishers[i] = &p;
- p.id_ = i+100+MAX_SUBSCRIBERS;
- p.nh_ = this;
- return true;
- }
- }
- return false;
- }
-
- /* Register a new subscriber */
- template
- bool subscribe(Subscriber< MsgT> & s){
- for(int i = 0; i < MAX_SUBSCRIBERS; i++){
- if(subscribers[i] == 0){ // empty slot
- subscribers[i] = (Subscriber_*) &s;
- s.id_ = i+100;
- return true;
- }
- }
- return false;
- }
-
- /* Register a new Service Server */
- template
- bool advertiseService(ServiceServer& srv){
- bool v = advertise(srv.pub);
- for(int i = 0; i < MAX_SUBSCRIBERS; i++){
- if(subscribers[i] == 0){ // empty slot
- subscribers[i] = (Subscriber_*) &srv;
- srv.id_ = i+100;
- return v;
- }
- }
- return false;
- }
-
- /* Register a new Service Client */
- template
- bool serviceClient(ServiceClient& srv){
- bool v = advertise(srv.pub);
- for(int i = 0; i < MAX_SUBSCRIBERS; i++){
- if(subscribers[i] == 0){ // empty slot
- subscribers[i] = (Subscriber_*) &srv;
- srv.id_ = i+100;
- return v;
- }
- }
- return false;
- }
-
- void negotiateTopics()
- {
- rosserial_msgs::TopicInfo ti;
- int i;
- for(i = 0; i < MAX_PUBLISHERS; i++)
- {
- if(publishers[i] != 0) // non-empty slot
- {
- ti.topic_id = publishers[i]->id_;
- ti.topic_name = (char *) publishers[i]->topic_;
- ti.message_type = (char *) publishers[i]->msg_->getType();
- ti.md5sum = (char *) publishers[i]->msg_->getMD5();
- ti.buffer_size = OUTPUT_SIZE;
- publish( publishers[i]->getEndpointType(), &ti );
- }
- }
- for(i = 0; i < MAX_SUBSCRIBERS; i++)
- {
- if(subscribers[i] != 0) // non-empty slot
- {
- ti.topic_id = subscribers[i]->id_;
- ti.topic_name = (char *) subscribers[i]->topic_;
- ti.message_type = (char *) subscribers[i]->getMsgType();
- ti.md5sum = (char *) subscribers[i]->getMsgMD5();
- ti.buffer_size = INPUT_SIZE;
- publish( subscribers[i]->getEndpointType(), &ti );
- }
- }
- configured_ = true;
- }
-
- virtual int publish(int id, const Msg * msg)
- {
- if(id >= 100 && !configured_)
- return 0;
-
- /* serialize message */
- uint16_t l = msg->serialize(message_out+7);
-
- /* setup the header */
- message_out[0] = 0xff;
- message_out[1] = PROTOCOL_VER;
- message_out[2] = (uint8_t) ((uint16_t)l&255);
- message_out[3] = (uint8_t) ((uint16_t)l>>8);
- message_out[4] = 255 - ((message_out[2] + message_out[3])%256);
- message_out[5] = (uint8_t) ((int16_t)id&255);
- message_out[6] = (uint8_t) ((int16_t)id>>8);
-
- /* calculate checksum */
- int chk = 0;
- for(int i =5; i end_time) return false;
- }
- return true;
- }
-
- public:
- bool getParam(const char* name, int* param, int length =1){
- if (requestParam(name) ){
- if (length == req_param_resp.ints_length){
- //copy it over
- for(int i=0; ipublish(id_, msg); };
- int getEndpointType(){ return endpoint_; }
-
- const char * topic_;
- Msg *msg_;
- // id_ and no_ are set by NodeHandle when we advertise
- int id_;
- NodeHandleBase_* nh_;
-
- private:
- int endpoint_;
- };
-
-}
-
-#endif
diff --git a/rosserial/rosserial_client/src/ros_lib/ros/service_client.h b/rosserial/rosserial_client/src/ros_lib/ros/service_client.h
deleted file mode 100755
index 06522f2..0000000
--- a/rosserial/rosserial_client/src/ros_lib/ros/service_client.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2011, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote prducts derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ROS_SERVICE_CLIENT_H_
-#define _ROS_SERVICE_CLIENT_H_
-
-#include "rosserial_msgs/TopicInfo.h"
-
-#include "publisher.h"
-#include "subscriber.h"
-
-namespace ros {
-
- template
- class ServiceClient : public Subscriber_ {
- public:
- ServiceClient(const char* topic_name) :
- pub(topic_name, &req, rosserial_msgs::TopicInfo::ID_SERVICE_CLIENT + rosserial_msgs::TopicInfo::ID_PUBLISHER)
- {
- this->topic_ = topic_name;
- this->waiting = true;
- }
-
- virtual void call(const MReq & request, MRes & response)
- {
- if(!pub.nh_->connected()) return;
- ret = &response;
- waiting = true;
- pub.publish(&request);
- while(waiting && pub.nh_->connected())
- if(pub.nh_->spinOnce() < 0) break;
- }
-
- // these refer to the subscriber
- virtual void callback(unsigned char *data){
- ret->deserialize(data);
- waiting = false;
- }
- virtual const char * getMsgType(){ return this->resp.getType(); }
- virtual const char * getMsgMD5(){ return this->resp.getMD5(); }
- virtual int getEndpointType(){ return rosserial_msgs::TopicInfo::ID_SERVICE_CLIENT + rosserial_msgs::TopicInfo::ID_SUBSCRIBER; }
-
- MReq req;
- MRes resp;
- MRes * ret;
- bool waiting;
- Publisher pub;
- };
-
-}
-
-#endif
diff --git a/rosserial/rosserial_client/src/ros_lib/ros/service_server.h b/rosserial/rosserial_client/src/ros_lib/ros/service_server.h
deleted file mode 100755
index 67a3e0a..0000000
--- a/rosserial/rosserial_client/src/ros_lib/ros/service_server.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2011, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote prducts derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ROS_SERVICE_SERVER_H_
-#define _ROS_SERVICE_SERVER_H_
-
-#include "rosserial_msgs/TopicInfo.h"
-
-#include "publisher.h"
-#include "subscriber.h"
-
-namespace ros {
-
- template
- class ServiceServer : public Subscriber_ {
- public:
- typedef void(*CallbackT)(const MReq&, MRes&);
-
- ServiceServer(const char* topic_name, CallbackT cb) :
- pub(topic_name, &resp, rosserial_msgs::TopicInfo::ID_SERVICE_SERVER + rosserial_msgs::TopicInfo::ID_PUBLISHER)
- {
- this->topic_ = topic_name;
- this->cb_ = cb;
- }
-
- // these refer to the subscriber
- virtual void callback(unsigned char *data){
- req.deserialize(data);
- cb_(req,resp);
- pub.publish(&resp);
- }
- virtual const char * getMsgType(){ return this->req.getType(); }
- virtual const char * getMsgMD5(){ return this->req.getMD5(); }
- virtual int getEndpointType(){ return rosserial_msgs::TopicInfo::ID_SERVICE_SERVER + rosserial_msgs::TopicInfo::ID_SUBSCRIBER; }
-
- MReq req;
- MRes resp;
- Publisher pub;
- private:
- CallbackT cb_;
- };
-
-}
-
-#endif
diff --git a/rosserial/rosserial_client/src/ros_lib/ros/subscriber.h b/rosserial/rosserial_client/src/ros_lib/ros/subscriber.h
deleted file mode 100755
index 5464646..0000000
--- a/rosserial/rosserial_client/src/ros_lib/ros/subscriber.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2011, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote prducts derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ROS_SUBSCRIBER_H_
-#define ROS_SUBSCRIBER_H_
-
-#include "rosserial_msgs/TopicInfo.h"
-
-namespace ros {
-
- /* Base class for objects subscribers. */
- class Subscriber_
- {
- public:
- virtual void callback(unsigned char *data)=0;
- virtual int getEndpointType()=0;
-
- // id_ is set by NodeHandle when we advertise
- int id_;
-
- virtual const char * getMsgType()=0;
- virtual const char * getMsgMD5()=0;
- const char * topic_;
- };
-
-
- /* Actual subscriber, templated on message type. */
- template
- class Subscriber: public Subscriber_{
- public:
- typedef void(*CallbackT)(const MsgT&);
- MsgT msg;
-
- Subscriber(const char * topic_name, CallbackT cb, int endpoint=rosserial_msgs::TopicInfo::ID_SUBSCRIBER) :
- cb_(cb),
- endpoint_(endpoint)
- {
- topic_ = topic_name;
- };
-
- virtual void callback(unsigned char* data){
- msg.deserialize(data);
- this->cb_(msg);
- }
-
- virtual const char * getMsgType(){ return this->msg.getType(); }
- virtual const char * getMsgMD5(){ return this->msg.getMD5(); }
- virtual int getEndpointType(){ return endpoint_; }
-
- private:
- CallbackT cb_;
- int endpoint_;
- };
-
-}
-
-#endif
diff --git a/rosserial/rosserial_client/src/ros_lib/ros/time.h b/rosserial/rosserial_client/src/ros_lib/ros/time.h
deleted file mode 100755
index 6141261..0000000
--- a/rosserial/rosserial_client/src/ros_lib/ros/time.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2011, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote prducts derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ROS_TIME_H_
-#define ROS_TIME_H_
-
-#include
-#include
-
-#include "ros/duration.h"
-
-namespace ros
-{
- void normalizeSecNSec(uint32_t &sec, uint32_t &nsec);
-
- class Time
- {
- public:
- uint32_t sec, nsec;
-
- Time() : sec(0), nsec(0) {}
- Time(uint32_t _sec, uint32_t _nsec) : sec(_sec), nsec(_nsec)
- {
- normalizeSecNSec(sec, nsec);
- }
-
- double toSec() const { return (double)sec + 1e-9*(double)nsec; };
- void fromSec(double t) { sec = (uint32_t) floor(t); nsec = (uint32_t) round((t-sec) * 1e9); };
-
- uint32_t toNsec() { return (uint32_t)sec*1000000000ull + (uint32_t)nsec; };
- Time& fromNSec(int32_t t);
-
- Time& operator +=(const Duration &rhs);
- Time& operator -=(const Duration &rhs);
-
- static Time now();
- static void setNow( Time & new_now);
- };
-
-}
-
-#endif
diff --git a/rosserial/rosserial_client/src/ros_lib/tf/tf.h b/rosserial/rosserial_client/src/ros_lib/tf/tf.h
deleted file mode 100755
index a2888e3..0000000
--- a/rosserial/rosserial_client/src/ros_lib/tf/tf.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2011, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote prducts derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ROS_TF_H_
-#define ROS_TF_H_
-
-#include "geometry_msgs/TransformStamped.h"
-
-namespace tf
-{
-
- static inline geometry_msgs::Quaternion createQuaternionFromYaw(double yaw)
- {
- geometry_msgs::Quaternion q;
- q.x = 0;
- q.y = 0;
- q.z = sin(yaw * 0.5);
- q.w = cos(yaw * 0.5);
- return q;
- }
-
-}
-
-#endif
-
diff --git a/rosserial/rosserial_client/src/ros_lib/tf/transform_broadcaster.h b/rosserial/rosserial_client/src/ros_lib/tf/transform_broadcaster.h
deleted file mode 100755
index 817eaba..0000000
--- a/rosserial/rosserial_client/src/ros_lib/tf/transform_broadcaster.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2011, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote prducts derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ROS_TRANSFORM_BROADCASTER_H_
-#define ROS_TRANSFORM_BROADCASTER_H_
-
-#include "tfMessage.h"
-
-namespace tf
-{
-
- class TransformBroadcaster
- {
- public:
- TransformBroadcaster() : publisher_("/tf", &internal_msg) {}
-
- void init(ros::NodeHandle &nh)
- {
- nh.advertise(publisher_);
- }
-
- void sendTransform(geometry_msgs::TransformStamped &transform)
- {
- internal_msg.transforms_length = 1;
- internal_msg.transforms = &transform;
- publisher_.publish(&internal_msg);
- }
-
- private:
- tf::tfMessage internal_msg;
- ros::Publisher publisher_;
- };
-
-}
-
-#endif
-
diff --git a/rosserial/rosserial_client/src/ros_lib/time.cpp b/rosserial/rosserial_client/src/ros_lib/time.cpp
deleted file mode 100755
index 9341196..0000000
--- a/rosserial/rosserial_client/src/ros_lib/time.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2011, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote prducts derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "ros/time.h"
-
-namespace ros
-{
- void normalizeSecNSec(uint32_t& sec, uint32_t& nsec){
- uint32_t nsec_part= nsec % 1000000000UL;
- uint32_t sec_part = nsec / 1000000000UL;
- sec += sec_part;
- nsec = nsec_part;
- }
-
- Time& Time::fromNSec(int32_t t)
- {
- sec = t / 1000000000;
- nsec = t % 1000000000;
- normalizeSecNSec(sec, nsec);
- return *this;
- }
-
- Time& Time::operator +=(const Duration &rhs)
- {
- sec += rhs.sec;
- nsec += rhs.nsec;
- normalizeSecNSec(sec, nsec);
- return *this;
- }
-
- Time& Time::operator -=(const Duration &rhs){
- sec += -rhs.sec;
- nsec += -rhs.nsec;
- normalizeSecNSec(sec, nsec);
- return *this;
- }
-}
diff --git a/rosserial/rosserial_client/src/rosserial_client/__init__.py b/rosserial/rosserial_client/src/rosserial_client/__init__.py
deleted file mode 100755
index e69de29..0000000
diff --git a/rosserial/rosserial_client/src/rosserial_client/make_library.py b/rosserial/rosserial_client/src/rosserial_client/make_library.py
deleted file mode 100755
index 90523e9..0000000
--- a/rosserial/rosserial_client/src/rosserial_client/make_library.py
+++ /dev/null
@@ -1,605 +0,0 @@
-#!/usr/bin/env python
-
-#####################################################################
-# Software License Agreement (BSD License)
-#
-# Copyright (c) 2011, Willow Garage, Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-# * Neither the name of Willow Garage, Inc. nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-from __future__ import print_function
-
-__author__ = "mferguson@willowgarage.com (Michael Ferguson)"
-
-import roslib
-import roslib.srvs
-import roslib.message
-import rospkg
-import rospy
-import traceback
-
-import os, sys, subprocess, re
-
-# for copying files
-import shutil
-
-def type_to_var(ty):
- lookup = {
- 1 : 'uint8_t',
- 2 : 'uint16_t',
- 4 : 'uint32_t',
- 8 : 'uint64_t',
- }
- return lookup[ty]
-
-#####################################################################
-# Data Types
-
-class EnumerationType:
- """ For data values. """
-
- def __init__(self, name, ty, value):
- self.name = name
- self.type = ty
- self.value = value
-
- def make_declaration(self, f):
- f.write(' enum { %s = %s };\n' % (self.name, self.value))
-
-class PrimitiveDataType:
- """ Our datatype is a C/C++ primitive. """
-
- def __init__(self, name, ty, bytes):
- self.name = name
- self.type = ty
- self.bytes = bytes
-
- def make_initializer(self, f, trailer):
- f.write(' %s(0)%s\n' % (self.name, trailer))
-
- def make_declaration(self, f):
- f.write(' %s %s;\n' % (self.type, self.name) )
-
- def serialize(self, f):
- cn = self.name.replace("[","").replace("]","").split(".")[-1]
- if self.type != type_to_var(self.bytes):
- f.write(' union {\n')
- f.write(' %s real;\n' % self.type)
- f.write(' %s base;\n' % type_to_var(self.bytes))
- f.write(' } u_%s;\n' % cn)
- f.write(' u_%s.real = this->%s;\n' % (cn,self.name))
- for i in range(self.bytes):
- f.write(' *(outbuffer + offset + %d) = (u_%s.base >> (8 * %d)) & 0xFF;\n' % (i, cn, i) )
- else:
- for i in range(self.bytes):
- f.write(' *(outbuffer + offset + %d) = (this->%s >> (8 * %d)) & 0xFF;\n' % (i, self.name, i) )
- f.write(' offset += sizeof(this->%s);\n' % self.name)
-
- def deserialize(self, f):
- cn = self.name.replace("[","").replace("]","").split(".")[-1]
- if self.type != type_to_var(self.bytes):
- f.write(' union {\n')
- f.write(' %s real;\n' % self.type)
- f.write(' %s base;\n' % type_to_var(self.bytes))
- f.write(' } u_%s;\n' % cn)
- f.write(' u_%s.base = 0;\n' % cn)
- for i in range(self.bytes):
- f.write(' u_%s.base |= ((%s) (*(inbuffer + offset + %d))) << (8 * %d);\n' % (cn,type_to_var(self.bytes),i,i) )
- f.write(' this->%s = u_%s.real;\n' % (self.name, cn) )
- else:
- f.write(' this->%s = ((%s) (*(inbuffer + offset)));\n' % (self.name,self.type) )
- for i in range(self.bytes-1):
- f.write(' this->%s |= ((%s) (*(inbuffer + offset + %d))) << (8 * %d);\n' % (self.name,self.type,i+1,i+1) )
- f.write(' offset += sizeof(this->%s);\n' % self.name)
-
-
-class MessageDataType(PrimitiveDataType):
- """ For when our data type is another message. """
-
- def make_initializer(self, f, trailer):
- f.write(' %s()%s\n' % (self.name, trailer))
-
- def serialize(self, f):
- f.write(' offset += this->%s.serialize(outbuffer + offset);\n' % self.name)
-
- def deserialize(self, f):
- f.write(' offset += this->%s.deserialize(inbuffer + offset);\n' % self.name)
-
-
-class AVR_Float64DataType(PrimitiveDataType):
- """ AVR C/C++ has no native 64-bit support, we automatically convert to 32-bit float. """
-
- def make_initializer(self, f, trailer):
- f.write(' %s(0)%s\n' % (self.name, trailer))
-
- def make_declaration(self, f):
- f.write(' float %s;\n' % self.name )
-
- def serialize(self, f):
- f.write(' offset += serializeAvrFloat64(outbuffer + offset, this->%s);\n' % self.name)
-
- def deserialize(self, f):
- f.write(' offset += deserializeAvrFloat64(inbuffer + offset, &(this->%s));\n' % self.name)
-
-
-class StringDataType(PrimitiveDataType):
- """ Need to convert to signed char *. """
-
- def make_initializer(self, f, trailer):
- f.write(' %s("")%s\n' % (self.name, trailer))
-
- def make_declaration(self, f):
- f.write(' const char* %s;\n' % self.name)
-
- def serialize(self, f):
- cn = self.name.replace("[","").replace("]","")
- f.write(' uint32_t length_%s = strlen(this->%s);\n' % (cn,self.name))
- f.write(' memcpy(outbuffer + offset, &length_%s, sizeof(uint32_t));\n' % cn)
- f.write(' offset += 4;\n')
- f.write(' memcpy(outbuffer + offset, this->%s, length_%s);\n' % (self.name,cn))
- f.write(' offset += length_%s;\n' % cn)
-
- def deserialize(self, f):
- cn = self.name.replace("[","").replace("]","")
- f.write(' uint32_t length_%s;\n' % cn)
- f.write(' memcpy(&length_%s, (inbuffer + offset), sizeof(uint32_t));\n' % cn)
- f.write(' offset += 4;\n')
- f.write(' for(unsigned int k= offset; k< offset+length_%s; ++k){\n'%cn) #shift for null character
- f.write(' inbuffer[k-1]=inbuffer[k];\n')
- f.write(' }\n')
- f.write(' inbuffer[offset+length_%s-1]=0;\n'%cn)
- f.write(' this->%s = (char *)(inbuffer + offset-1);\n' % self.name)
- f.write(' offset += length_%s;\n' % cn)
-
-
-class TimeDataType(PrimitiveDataType):
-
- def __init__(self, name, ty, bytes):
- self.name = name
- self.type = ty
- self.sec = PrimitiveDataType(name+'.sec','uint32_t',4)
- self.nsec = PrimitiveDataType(name+'.nsec','uint32_t',4)
-
- def make_initializer(self, f, trailer):
- f.write(' %s()%s\n' % (self.name, trailer))
-
- def make_declaration(self, f):
- f.write(' %s %s;\n' % (self.type, self.name))
-
- def serialize(self, f):
- self.sec.serialize(f)
- self.nsec.serialize(f)
-
- def deserialize(self, f):
- self.sec.deserialize(f)
- self.nsec.deserialize(f)
-
-
-class ArrayDataType(PrimitiveDataType):
-
- def __init__(self, name, ty, bytes, cls, array_size=None):
- self.name = name
- self.type = ty
- self.bytes = bytes
- self.size = array_size
- self.cls = cls
-
- def make_initializer(self, f, trailer):
- if self.size == None:
- f.write(' %s_length(0), %s(NULL)%s\n' % (self.name, self.name, trailer))
- else:
- f.write(' %s()%s\n' % (self.name, trailer))
-
- def make_declaration(self, f):
- c = self.cls("*"+self.name, self.type, self.bytes)
- if self.size == None:
- f.write(' uint8_t %s_length;\n' % self.name)
- f.write(' %s st_%s;\n' % (self.type, self.name)) # static instance for copy
- f.write(' %s * %s;\n' % (self.type, self.name))
- else:
- f.write(' %s %s[%d];\n' % (self.type, self.name, self.size))
-
- def serialize(self, f):
- c = self.cls(self.name+"[i]", self.type, self.bytes)
- if self.size == None:
- # serialize length
- f.write(' *(outbuffer + offset++) = %s_length;\n' % self.name)
- f.write(' *(outbuffer + offset++) = 0;\n')
- f.write(' *(outbuffer + offset++) = 0;\n')
- f.write(' *(outbuffer + offset++) = 0;\n')
- f.write(' for( uint8_t i = 0; i < %s_length; i++){\n' % self.name)
- c.serialize(f)
- f.write(' }\n')
- else:
- f.write(' for( uint8_t i = 0; i < %d; i++){\n' % (self.size) )
- c.serialize(f)
- f.write(' }\n')
-
- def deserialize(self, f):
- if self.size == None:
- c = self.cls("st_"+self.name, self.type, self.bytes)
- # deserialize length
- f.write(' uint8_t %s_lengthT = *(inbuffer + offset++);\n' % self.name)
- f.write(' if(%s_lengthT > %s_length)\n' % (self.name, self.name))
- f.write(' this->%s = (%s*)realloc(this->%s, %s_lengthT * sizeof(%s));\n' % (self.name, self.type, self.name, self.name, self.type))
- f.write(' offset += 3;\n')
- f.write(' %s_length = %s_lengthT;\n' % (self.name, self.name))
- # copy to array
- f.write(' for( uint8_t i = 0; i < %s_length; i++){\n' % (self.name) )
- c.deserialize(f)
- f.write(' memcpy( &(this->%s[i]), &(this->st_%s), sizeof(%s));\n' % (self.name, self.name, self.type))
- f.write(' }\n')
- else:
- c = self.cls(self.name+"[i]", self.type, self.bytes)
- f.write(' for( uint8_t i = 0; i < %d; i++){\n' % (self.size) )
- c.deserialize(f)
- f.write(' }\n')
-
-#####################################################################
-# Messages
-
-class Message:
- """ Parses message definitions into something we can export. """
- global ROS_TO_EMBEDDED_TYPES
-
- def __init__(self, name, package, definition, md5):
-
- self.name = name # name of message/class
- self.package = package # package we reside in
- self.md5 = md5 # checksum
- self.includes = list() # other files we must include
-
- self.data = list() # data types for code generation
- self.enums = list()
-
- # parse definition
- for line in definition:
- # prep work
- line = line.strip().rstrip()
- value = None
- if line.find("#") > -1:
- line = line[0:line.find("#")]
- if line.find("=") > -1:
- try:
- value = line[line.find("=")+1:]
- except:
- value = '"' + line[line.find("=")+1:] + '"';
- line = line[0:line.find("=")]
-
- # find package/class name
- line = line.replace("\t", " ")
- l = line.split(" ")
- while "" in l:
- l.remove("")
- if len(l) < 2:
- continue
- ty, name = l[0:2]
- if value != None:
- self.enums.append( EnumerationType(name, ty, value))
- continue
-
- try:
- type_package, type_name = ty.split("/")
- except:
- type_package = None
- type_name = ty
- type_array = False
- if type_name.find('[') > 0:
- type_array = True
- try:
- type_array_size = int(type_name[type_name.find('[')+1:type_name.find(']')])
- except:
- type_array_size = None
- type_name = type_name[0:type_name.find('[')]
-
- # convert to C type if primitive, expand name otherwise
- try:
- code_type = ROS_TO_EMBEDDED_TYPES[type_name][0]
- size = ROS_TO_EMBEDDED_TYPES[type_name][1]
- cls = ROS_TO_EMBEDDED_TYPES[type_name][2]
- for include in ROS_TO_EMBEDDED_TYPES[type_name][3]:
- if include not in self.includes:
- self.includes.append(include)
- except:
- if type_package == None:
- type_package = self.package
- if type_package+"/"+type_name not in self.includes:
- self.includes.append(type_package+"/"+type_name)
- cls = MessageDataType
- code_type = type_package + "::" + type_name
- size = 0
- if type_array:
- self.data.append( ArrayDataType(name, code_type, size, cls, type_array_size ) )
- else:
- self.data.append( cls(name, code_type, size) )
-
- def _write_serializer(self, f):
- # serializer
- f.write(' virtual int serialize(unsigned char *outbuffer) const\n')
- f.write(' {\n')
- f.write(' int offset = 0;\n')
- for d in self.data:
- d.serialize(f)
- f.write(' return offset;\n');
- f.write(' }\n')
- f.write('\n')
-
- def _write_deserializer(self, f):
- # deserializer
- f.write(' virtual int deserialize(unsigned char *inbuffer)\n')
- f.write(' {\n')
- f.write(' int offset = 0;\n')
- for d in self.data:
- d.deserialize(f)
- f.write(' return offset;\n');
- f.write(' }\n')
- f.write('\n')
-
- def _write_std_includes(self, f):
- f.write('#include \n')
- f.write('#include \n')
- f.write('#include \n')
- f.write('#include "ros/msg.h"\n')
-
- def _write_msg_includes(self,f):
- for i in self.includes:
- f.write('#include "%s.h"\n' % i)
-
- def _write_constructor(self, f):
- f.write(' %s()%s\n' % (self.name, ':' if self.data else ''))
- if self.data:
- for d in self.data[:-1]:
- d.make_initializer(f, ',')
- self.data[-1].make_initializer(f, '')
- f.write(' {\n }\n\n')
-
- def _write_data(self, f):
- for d in self.data:
- d.make_declaration(f)
- for e in self.enums:
- e.make_declaration(f)
- f.write('\n')
-
- def _write_getType(self, f):
- f.write(' const char * getType(){ return "%s/%s"; };\n'%(self.package, self.name))
-
- def _write_getMD5(self, f):
- f.write(' const char * getMD5(){ return "%s"; };\n'%self.md5)
-
- def _write_impl(self, f):
- f.write(' class %s : public ros::Msg\n' % self.name)
- f.write(' {\n')
- f.write(' public:\n')
- self._write_data(f)
- self._write_constructor(f)
- self._write_serializer(f)
- self._write_deserializer(f)
- self._write_getType(f)
- self._write_getMD5(f)
- f.write('\n')
- f.write(' };\n')
-
- def make_header(self, f):
- f.write('#ifndef _ROS_%s_%s_h\n'%(self.package, self.name))
- f.write('#define _ROS_%s_%s_h\n'%(self.package, self.name))
- f.write('\n')
- self._write_std_includes(f)
- self._write_msg_includes(f)
-
- f.write('\n')
- f.write('namespace %s\n' % self.package)
- f.write('{\n')
- f.write('\n')
- self._write_impl(f)
- f.write('\n')
- f.write('}\n')
-
- f.write('#endif')
-
-class Service:
- def __init__(self, name, package, definition, md5req, md5res):
- """
- @param name - name of service
- @param package - name of service package
- @param definition - list of lines of definition
- """
-
- self.name = name
- self.package = package
-
- sep_line = len(definition)
- sep = re.compile('---*')
- for i in range(0, len(definition)):
- if (None!= re.match(sep, definition[i]) ):
- sep_line = i
- break
- self.req_def = definition[0:sep_line]
- self.resp_def = definition[sep_line+1:]
-
- self.req = Message(name+"Request", package, self.req_def, md5req)
- self.resp = Message(name+"Response", package, self.resp_def, md5res)
-
- def make_header(self, f):
- f.write('#ifndef _ROS_SERVICE_%s_h\n' % self.name)
- f.write('#define _ROS_SERVICE_%s_h\n' % self.name)
-
- self.req._write_std_includes(f)
- includes = self.req.includes
- includes.extend(self.resp.includes)
- includes = list(set(includes))
- for inc in includes:
- f.write('#include "%s.h"\n' % inc)
-
- f.write('\n')
- f.write('namespace %s\n' % self.package)
- f.write('{\n')
- f.write('\n')
- f.write('static const char %s[] = "%s/%s";\n'%(self.name.upper(), self.package, self.name))
-
- def write_type(out, name):
- out.write(' const char * getType(){ return %s; };\n'%(name))
- _write_getType = lambda out: write_type(out, self.name.upper())
- self.req._write_getType = _write_getType
- self.resp._write_getType = _write_getType
-
- f.write('\n')
- self.req._write_impl(f)
- f.write('\n')
- self.resp._write_impl(f)
- f.write('\n')
- f.write(' class %s {\n' % self.name )
- f.write(' public:\n')
- f.write(' typedef %s Request;\n' % self.req.name )
- f.write(' typedef %s Response;\n' % self.resp.name )
- f.write(' };\n')
- f.write('\n')
-
- f.write('}\n')
-
- f.write('#endif\n')
-
-
-#####################################################################
-# Make a Library
-
-def MakeLibrary(package, output_path, rospack):
- pkg_dir = rospack.get_path(package)
-
- # find the messages in this package
- messages = list()
- if os.path.exists(pkg_dir+"/msg"):
- print('Exporting %s\n'%package)
- sys.stdout.write(' Messages:')
- sys.stdout.write('\n ')
- for f in os.listdir(pkg_dir+"/msg"):
- if f.endswith(".msg"):
- file = pkg_dir + "/msg/" + f
- # add to list of messages
- print('%s,'%f[0:-4], end='')
- definition = open(file).readlines()
- md5sum = roslib.message.get_message_class(package+'/'+f[0:-4])._md5sum
- messages.append( Message(f[0:-4], package, definition, md5sum) )
-
- # find the services in this package
- services = list()
- if (os.path.exists(pkg_dir+"/srv/")):
- if messages == list():
- print('Exporting %s\n'%package)
- else:
- print('\n')
- sys.stdout.write(' Services:')
- sys.stdout.write('\n ')
- for f in os.listdir(pkg_dir+"/srv"):
- if f.endswith(".srv"):
- file = pkg_dir + "/srv/" + f
- # add to list of messages
- print('%s,'%f[0:-4], end='')
- definition, service = roslib.srvs.load_from_file(file)
- definition = open(file).readlines()
- md5req = roslib.message.get_service_class(package+'/'+f[0:-4])._request_class._md5sum
- md5res = roslib.message.get_service_class(package+'/'+f[0:-4])._response_class._md5sum
- messages.append( Service(f[0:-4], package, definition, md5req, md5res ) )
- print('\n')
- elif messages != list():
- print('\n')
-
- # generate for each message
- output_path = output_path + "/" + package
- for msg in messages:
- if not os.path.exists(output_path):
- os.makedirs(output_path)
- header = open(output_path + "/" + msg.name + ".h", "w")
- msg.make_header(header)
- header.close()
-
-def get_dependency_sorted_package_list(rospack):
- ''' Returns a list of package names, sorted by dependencies. '''
- pkgs = rospack.list()
- dependency_list = list()
- failed = list()
- for p in pkgs:
- try:
- depends = rospack.get_depends(p)
- dependent = False
- for i in range(len(dependency_list)):
- if dependency_list[i] in depends:
- dependency_list.insert(i, p)
- dependent = True
- break
- if not dependent:
- dependency_list.append(p)
- except rospkg.common.ResourceNotFound as e:
- failed.append(p + " (missing dependency: " + e.message + ")")
- print('[%s]: Unable to find dependency: %s. Messages cannot be built.\n'% (p, str(e)))
- dependency_list.reverse()
- return [dependency_list, failed]
-
-def rosserial_generate(rospack, path, mapping):
- # horrible hack -- make this die
- global ROS_TO_EMBEDDED_TYPES
- ROS_TO_EMBEDDED_TYPES = mapping
-
- # find and sort all packages
- pkgs, failed = get_dependency_sorted_package_list(rospack)
-
- # gimme messages
- for p in pkgs:
- try:
- MakeLibrary(p, path, rospack)
- except Exception as e:
- failed.append(p + " ("+str(e)+")")
- print('[%s]: Unable to build messages: %s\n' % (p, str(e)))
- print(traceback.format_exc())
- print('\n')
- if len(failed) > 0:
- print('*** Warning, failed to generate libraries for the following packages: ***')
- for f in failed:
- print(' %s'%f)
- raise Exception("Failed to generate libraries for: " + str(failed))
- print('\n')
-
-def rosserial_client_copy_files(rospack, path):
- os.makedirs(path+"/ros")
- os.makedirs(path+"/tf")
- files = ['duration.cpp',
- 'time.cpp',
- 'ros/duration.h',
- 'ros/msg.h',
- 'ros/node_handle.h',
- 'ros/publisher.h',
- 'ros/service_client.h',
- 'ros/service_server.h',
- 'ros/subscriber.h',
- 'ros/time.h',
- 'tf/tf.h',
- 'tf/transform_broadcaster.h']
- mydir = rospack.get_path("rosserial_client")
- for f in files:
- shutil.copy(mydir+"/src/ros_lib/"+f, path+f)
-
diff --git a/rosserial/rosserial_client/test/float64_test.cpp b/rosserial/rosserial_client/test/float64_test.cpp
deleted file mode 100755
index 84f18cf..0000000
--- a/rosserial/rosserial_client/test/float64_test.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "ros_lib/ros/msg.h"
-#include
-
-
-class TestFloat64 : public ::testing::Test
-{
-public:
- union
- {
- double val;
- unsigned char buffer[8];
- };
-
- static const double cases[];
- static const int num_cases;
-};
-
-const double TestFloat64::cases[] = {
- 0.0, 10.0, 15642.1, -50.2, 0.0001, -0.321,
- 123456.789, -987.654321, 3.4e38, -3.4e38,
-};
-const int TestFloat64::num_cases = sizeof(TestFloat64::cases) / sizeof(double);
-
-
-TEST_F(TestFloat64, testRoundTrip)
-{
- for (int i = 0; i < num_cases; i++)
- {
- memset(buffer, 0, sizeof(buffer));
- ros::Msg::serializeAvrFloat64(buffer, cases[i]);
- EXPECT_FLOAT_EQ(cases[i], val);
-
- float ret = 0;
- ros::Msg::deserializeAvrFloat64(buffer, &ret);
- EXPECT_FLOAT_EQ(cases[i], ret);
- }
-}
-
-
-int main(int argc, char **argv){
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
diff --git a/rosserial/rosserial_embeddedlinux/CHANGELOG.rst b/rosserial/rosserial_embeddedlinux/CHANGELOG.rst
deleted file mode 100755
index ff5a8c8..0000000
--- a/rosserial/rosserial_embeddedlinux/CHANGELOG.rst
+++ /dev/null
@@ -1,83 +0,0 @@
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Changelog for package rosserial_embeddedlinux
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-0.7.1 (2015-07-06)
-------------------
-
-0.7.0 (2015-04-23)
-------------------
-* Use native 64-bit double on embeddedlinux.
-* Include time.h header for linux in embedded_linux_hardware.h.
-* Support OS X time in the embeddedlinux port.
-* Contributors: Mike Purvis
-
-0.6.3 (2014-11-05)
-------------------
-* Miscellaneous tidying in EmbeddedLinuxHardware.
-* Rename header.
-* Automatic astyle fixes.
-* portName as const char*, eliminate strtok.
-* Contributors: Mike Purvis
-
-0.6.2 (2014-09-10)
-------------------
-
-0.6.1 (2014-06-30)
-------------------
-
-0.6.0 (2014-06-11)
-------------------
-
-0.5.6 (2014-06-11)
-------------------
-* Add Mike Purvis as maintainer to all but xbee.
-* Contributors: Mike Purvis
-
-0.5.5 (2014-01-14)
-------------------
-
-0.5.4 (2013-10-17)
-------------------
-
-0.5.3 (2013-09-21)
-------------------
-
-0.5.2 (2013-07-17)
-------------------
-
-* Fix release version
-
-0.5.1 (2013-07-15)
-------------------
-
-0.4.5 (2013-07-02)
-------------------
-* rosserial_embeddedlinux: Fix CMakeLists.txt ...
- so 'catkin_make install' can find 'examples' directory under 'src' directory in rosserial_embeddedlinux
-* fix install rule for examples dir
-* Fixed a bug in ros_lib install logic which took an exception because it copied files to themselves
- Added execute permission to make_libraries.py in rosserial_embeddedlinux
- Moved examples under src in rosserial_embeddedlinux
-* fix package name
-
-0.4.4 (2013-03-20)
-------------------
-* merge
-* Merge remote-tracking branch 'origin/groovy-devel' into groovy-devel
-* Install examples in install dir & next to ros_lib. Change maintainer email.
-
-0.4.3 (2013-03-13 14:08)
-------------------------
-* forgot to remove install directives
-
-0.4.2 (2013-03-13 01:15)
-------------------------
-* fix build issues when in isolation by moving more stuff into make_library
-
-0.4.1 (2013-03-09)
-------------------
-
-0.4.0 (2013-03-08)
-------------------
-* initial catkin version on github
diff --git a/rosserial/rosserial_embeddedlinux/CMakeLists.txt b/rosserial/rosserial_embeddedlinux/CMakeLists.txt
deleted file mode 100755
index 7cf902a..0000000
--- a/rosserial/rosserial_embeddedlinux/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-cmake_minimum_required(VERSION 2.8.3)
-project(rosserial_embeddedlinux)
-
-find_package(catkin REQUIRED)
-catkin_package(CATKIN_DEPENDS)
-
-install(DIRECTORY src/ros_lib
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/src
-)
-
-install(DIRECTORY src/examples
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/src
-)
-
-install(PROGRAMS src/rosserial_embeddedlinux/make_libraries.py
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
-)
diff --git a/rosserial/rosserial_embeddedlinux/package.xml b/rosserial/rosserial_embeddedlinux/package.xml
deleted file mode 100755
index 1e5f47f..0000000
--- a/rosserial/rosserial_embeddedlinux/package.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
- rosserial_embeddedlinux
- 0.7.1
-
- Libraries and examples for ROSserial usage on Embedded Linux Enviroments
-
- Paul Bouchier
- Paul Bouchier
- Mike Purvis
- BSD
- http://ros.org/wiki/rosserial_embeddedlinux
-
- catkin
-
- std_msgs
- sensor_msgs
- geometry_msgs
- nav_msgs
- rosserial_client
-
- rospy
- rosserial_msgs
-
diff --git a/rosserial/rosserial_embeddedlinux/src/examples/ExampleService/ExampleService.cpp b/rosserial/rosserial_embeddedlinux/src/examples/ExampleService/ExampleService.cpp
deleted file mode 100755
index 178ec6b..0000000
--- a/rosserial/rosserial_embeddedlinux/src/examples/ExampleService/ExampleService.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * rosserial_embeddedlinux service server example
- *
- * Advertises a service it offers. Prints the string sent to the service
- * and responds with an alternating string.
- * The service request can be sent from the ROS command line with e.g.
- * $ xxx
- */
-
-#include
-#include
-#include
-#include
-
-ros::NodeHandle nh;
-using rosserial_examples::Test;
-#define ROSSRVR_IP "192.168.15.122"
-
-int i=0;
-void svcCallback(const Test::Request & req, Test::Response & res){
- if((i++)%2)
- res.output = "hello";
- else
- res.output = "ros";
- printf("Service request message: \"%s\" received, responding with: %s", res.output);
-}
-ros::ServiceServer server("test_srv",&svcCallback);
-
-int main()
-{
- nh.initNode(ROSSRVR_IP);
- nh.advertiseService(server);
-
- while(1) {
- nh.spinOnce();
- sleep(1);
- }
-}
diff --git a/rosserial/rosserial_embeddedlinux/src/examples/ExampleServiceClient/ExampleServiceClient.cpp b/rosserial/rosserial_embeddedlinux/src/examples/ExampleServiceClient/ExampleServiceClient.cpp
deleted file mode 100755
index b68b7a2..0000000
--- a/rosserial/rosserial_embeddedlinux/src/examples/ExampleServiceClient/ExampleServiceClient.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * rosserial_embeddedlinux service client example
- *
- * Calls a service offered by a ROS service server and publishes what it receives from
- * the service server to the chatter topic. It also prints the received service response.
- *
- * You can run a suitable service on ROS with:
- * $ rosrun rosserial_embeddedlinux client.py
- *
- * When you run this program on the embedded linux system, client.py on the ROS workstation
- * will ask you to respond with a string. The string you give it will be passed back to this
- * service client, which will print and publish it.
- */
-
-#include
-#include
-#include
-#include