├── VISensor_Factsheet_web.pdf
├── install_libvisensor.sh
├── pkgconfig
└── visensor.pc
├── .gitignore
├── package.xml
├── cmake
├── FindVISensor.cmake
└── FindEigen.cmake
├── src
├── sensors
│ ├── led_flasher.cpp
│ ├── corner_detector.cpp
│ ├── camera.cpp
│ ├── imu.cpp
│ ├── external_trigger.cpp
│ ├── sensor.cpp
│ ├── imu_mpu9150.cpp
│ ├── corner_mt9v034.cpp
│ ├── imu_adis16488.cpp
│ └── camera_mt9v034.cpp
├── visensor
│ ├── visensor_datatypes.cpp
│ └── visensor_api.cpp
├── work
│ ├── camera_tau320.hpp
│ ├── imu_mpu6000.hpp
│ ├── brisk_mt9v034.hpp
│ ├── sensor_calibration.cpp
│ ├── calib_mpu6000.cpp
│ └── brisk_mt9v034.cpp
├── synchronization
│ ├── frame_corner_synchronizer.cpp
│ └── time_synchronizer.cpp
├── serial_bridge
│ └── SerialHost.cpp
└── networking
│ └── file_transfer.cpp
├── include
├── config
│ ├── config.hpp
│ ├── debug.hpp
│ ├── assert.hpp
│ └── compiler.hpp
├── visensor
│ ├── visensor_config.hpp
│ ├── visensor_version.hpp
│ ├── visensor.hpp
│ ├── visensor_exceptions.hpp
│ ├── visensor_constants.hpp
│ └── visensor_api.hpp
├── sensors
│ ├── sensor_factory.hpp
│ ├── led_flasher.hpp
│ ├── imu.hpp
│ ├── imu_adis16488.hpp
│ ├── imu_adis16448.hpp
│ ├── camera.hpp
│ ├── corner_detector.hpp
│ ├── corner_mt9v034.hpp
│ ├── camera_tau640.hpp
│ ├── imu_mpu9150.hpp
│ ├── dense_matcher.hpp
│ ├── sensor.hpp
│ └── external_trigger.hpp
├── networking
│ ├── file_transfer.hpp
│ ├── auto_discovery.hpp
│ ├── config_connection.hpp
│ └── connection.hpp
├── helpers
│ └── stereo_homography.hpp
├── synchronization
│ ├── frame_corner_synchronizer.hpp
│ ├── time_synchronizer.hpp
│ └── concurrent_queue.hpp
├── serial_bridge
│ └── SerialHost.hpp
└── visensor_impl.hpp
├── CMakeLists.txt
└── README.md
/VISensor_Factsheet_web.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ethz-asl/libvisensor/HEAD/VISensor_Factsheet_web.pdf
--------------------------------------------------------------------------------
/install_libvisensor.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | cmake -H. -Bbuild -DDONT_USE_CATKIN=1
3 | cd build
4 | make -j8
5 | sudo make install
6 |
--------------------------------------------------------------------------------
/pkgconfig/visensor.pc:
--------------------------------------------------------------------------------
1 | Name: visensor
2 | Description: Interface library for the VI-Sensor
3 | Requires:
4 | Version:
5 | Libs: -lvisensor
6 | Cflags: -I/usr/include/visensor
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 | *.obj
6 |
7 | # Compiled Dynamic libraries
8 | *.so
9 | *.dylib
10 | *.dll
11 |
12 | # Compiled Static libraries
13 | *.lai
14 | *.la
15 | *.a
16 | *.lib
17 |
18 | # Executables
19 | *.exe
20 | *.out
21 | *.app
22 |
--------------------------------------------------------------------------------
/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | libvisensor
4 | 1.1.0
5 |
6 |
7 | Driver for the communication with the VI-Sensor
8 |
9 |
10 | http://www.skybotix.com
11 | Michael Burri, Pascal Gohl and Thomas Schneider
12 | Pascal Gohl
13 | Propriatary
14 | catkin
15 |
16 | eigen
17 |
18 |
19 |
--------------------------------------------------------------------------------
/cmake/FindVISensor.cmake:
--------------------------------------------------------------------------------
1 | # - Try to find ImageMagick++
2 | # Once done, this will define
3 | #
4 | # Magick++_FOUND - system has Magick++
5 | # Magick++_INCLUDE_DIRS - the Magick++ include directories
6 | # Magick++_LIBRARIES - link these to use Magick++
7 |
8 | include(LibFindMacros)
9 |
10 | # Use pkg-config to get hints about paths
11 | libfind_pkg_check_modules(VISensorDriver_PKGCONF visensor)
12 |
13 | # Include dir
14 | find_path(VISensorDriver_INCLUDE_DIR
15 | NAMES aslam_sensor_driver.hpp
16 | PATHS ${VISensorDriver_PKGCONF_INCLUDE_DIRS}
17 | )
18 |
19 |
20 | # Finally the library itself
21 | find_library(VISensorDriver_LIBRARY
22 | NAMES libvisensor.so
23 | PATHS ${VISensorDriver_PKGCONF_LIBRARY_DIRS}
24 | )
25 |
26 | # Set the include dir variables and the libraries and let libfind_process do the rest.
27 | # NOTE: Singular variables for this library, plural for libraries this this lib depends on.
28 | set(VISensorDriver_PROCESS_INCLUDES VISensorDriver_INCLUDE_DIR)
29 | set(VISensorDriver_PROCESS_LIBS VISensorDriver_LIBRARY)
30 | libfind_process(VISensorDriver)
31 |
--------------------------------------------------------------------------------
/src/sensors/led_flasher.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * camera_mt9v034.cpp
3 | *
4 | * Created on: Apr 18, 2012
5 | * Author: burrimi
6 | */
7 |
8 | #include
9 | #include
10 | #include
11 |
12 | #include "sensors/led_flasher.hpp"
13 | #include "visensor_impl.hpp" // needed by forward declaration
14 |
15 | namespace visensor {
16 | LedFlasher::LedFlasher(SensorId::SensorId sensor_id,
17 | ConfigConnection::WeakPtr config_connection)
18 | : Sensor(SensorSettings(sensor_id,
19 | SensorType::SensorType::LIGHT_CONTROL,
20 | 0,
21 | LedFlasherDefaults::NUM_OF_MSGS_IN_PACKAGE,
22 | LedFlasherDefaults::USE_CONST_PACKAGE_SIZE,
23 | LedFlasherDefaults::CALIBRATION_SIZE),
24 | config_connection),
25 | config_(sensor_id) {
26 | }
27 |
28 | LedFlasher::~LedFlasher() {
29 | }
30 |
31 | void LedFlasher::init() {
32 | }
33 |
34 | ViConfigMsg LedFlasher::getConfigParam(std::string cmd, uint32_t value) {
35 | return config_.getConfigParam(cmd, value);
36 | }
37 |
38 | } //namespace visensor
39 |
--------------------------------------------------------------------------------
/include/config/config.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef CONFIG_HPP_
33 | #define CONFIG_HPP_
34 |
35 | //global includes
36 | #include //uint32, ... types
37 |
38 | //include debug helpers for library builds
39 | #include "compiler.hpp"
40 | #include "debug.hpp"
41 | #include "assert.hpp"
42 |
43 |
44 | #endif /* CONFIG_HPP_ */
45 |
--------------------------------------------------------------------------------
/include/visensor/visensor_config.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef VISENSOR_CONFIG_HPP_
33 | #define VISENSOR_CONFIG_HPP_
34 |
35 | //Control symbol exports
36 | #ifdef VISENSOR_EXPORT
37 | # include
38 | #else
39 | # define DSO_EXPORT
40 | # define DSO_IMPORT
41 | #endif
42 |
43 |
44 | #endif /* VISENSOR_CONFIG_HPP_ */
45 |
--------------------------------------------------------------------------------
/include/visensor/visensor_version.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef VISENSOR_VERSION_HPP_
33 | #define VISENSOR_VERSION_HPP_
34 |
35 | #include
36 |
37 | namespace visensor {
38 |
39 | static const unsigned int LIBRARY_VERSION_MAJOR = 1;
40 | static const unsigned int LIBRARY_VERSION_MINOR = 1;
41 | static const unsigned int LIBRARY_VERSION_PATCH = 0;
42 |
43 | } //namespace visensor
44 |
45 | #endif /* VISENSOR_VERSION_HPP_ */
46 |
--------------------------------------------------------------------------------
/include/visensor/visensor.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Redistribution and non-commercial use in source and binary forms, with or without
8 | * modification, are permitted provided that the following conditions are met:
9 | *
10 | * Redistributions of source code must retain the above copyright notice, this
11 | * list of conditions and the following disclaimer.
12 | *
13 | * Redistributions in binary form must reproduce the above copyright notice, this
14 | * list of conditions and the following disclaimer in the documentation and/or
15 | * other materials provided with the distribution.
16 | *
17 | * Neither the name of the {organization} nor the names of its
18 | * contributors may be used to endorse or promote products derived from
19 | * this software without specific prior written permission.
20 | *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | *
32 | */
33 |
34 | #ifndef VISENSOR_HPP_
35 | #define VISENSOR_HPP_
36 |
37 | #include
38 | #include
39 | #include
40 | #include
41 | #include
42 |
43 | #endif //VISENSOR_HPP_
44 |
--------------------------------------------------------------------------------
/src/sensors/corner_detector.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #include
33 |
34 | #include "visensor/visensor_datatypes.hpp"
35 | #include "sensors/corner_detector.hpp"
36 |
37 | namespace visensor {
38 |
39 | void CornerDetector::setCornerCallback(boost::function callback) {
40 | user_callback_ = callback;
41 | }
42 |
43 | void CornerDetector::publishCornerData(ViCorner::Ptr& frame, ViErrorCode error) {
44 | if (user_callback_)
45 | user_callback_(frame, error);
46 | }
47 |
48 | } // namespace visensor
49 |
--------------------------------------------------------------------------------
/include/sensors/sensor_factory.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef SENSOR_FACTORY_HPP_
33 | #define SENSOR_FACTORY_HPP_
34 |
35 | #include
36 | #include
37 | #include
38 |
39 | #include "networking/connection.hpp"
40 | #include "sensors/sensor.hpp"
41 |
42 | namespace visensor {
43 | class SensorFactory {
44 | public:
45 | static const void createSensors(
46 | IpConnection::WeakPtr config_connection,
47 | Sensor::IdMap* sensor_map,
48 | boost::thread_group* threads);
49 | };
50 |
51 | } //namespace visensor
52 |
53 | #endif /* SENSOR_FACTORY_HPP_ */
54 |
--------------------------------------------------------------------------------
/include/networking/file_transfer.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef FILEHANDLER_HPP_
33 | #define FILEHANDLER_HPP_
34 |
35 | #include
36 | #include
37 |
38 | class FileTransfer {
39 | public:
40 | FileTransfer(boost::asio::ip::tcp::socket& socket);
41 | virtual ~FileTransfer();
42 |
43 | void sendFile(std::string& local_path, std::string& remote_path);
44 | void receiveFile(std::string& local_path, std::string& remote_path);
45 |
46 | private:
47 | std::string sendPathString(std::string string);
48 |
49 | boost::asio::ip::tcp::socket& socket_;
50 | };
51 |
52 | #endif /* FILEHANDLER_HPP_ */
53 |
--------------------------------------------------------------------------------
/src/sensors/camera.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #include
33 | #include
34 |
35 | #include
36 |
37 | namespace visensor {
38 |
39 | void Camera::setFrameCallback(boost::function callback) {
40 | user_callbacks_.push_back(callback);
41 | }
42 |
43 | void Camera::publishFrameData(ViFrame::Ptr& frame, ViErrorCode error) {
44 | if (user_callbacks_.empty() == 0) {
45 | BOOST_FOREACH(
46 | boost::function callback, user_callbacks_) {
47 | callback(frame, error);
48 | }
49 | }
50 | }
51 |
52 | } // namespace visensor
53 |
--------------------------------------------------------------------------------
/include/config/debug.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef DEBUG_HPP_
33 | #define DEBUG_HPP_
34 |
35 | #include
36 |
37 | #ifdef NDEBUG
38 | #define DEBUG_TEST 0
39 | #else
40 | #define DEBUG_TEST 1
41 | #endif
42 |
43 |
44 | /***************************************************/
45 | /* DEBUG TERMINAL PRINT */
46 | /***************************************************/
47 |
48 | struct Sink { template Sink(Args const& ... ) {} };
49 | #if DEBUG_TEST
50 | #define VISENSOR_DEBUG(...) \
51 | do { printf("[libvisensor]: "); printf(__VA_ARGS__); } while (0)
52 | #else
53 | #define VISENSOR_DEBUG(...) Sink { __VA_ARGS__ }
54 | #endif
55 |
56 |
57 |
58 |
59 | #endif /* DEBUG_HPP_ */
60 |
--------------------------------------------------------------------------------
/include/sensors/led_flasher.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * camera_mt9v034.hpp
3 | *
4 | * Created on: Apr 18, 2012
5 | * Author: burrimi
6 | */
7 |
8 | #ifndef LED_FLASHER_HPP_
9 | #define LED_FLASHER_HPP_
10 |
11 | #include
12 | #include
13 |
14 | #include "networking/param_server.hpp"
15 | #include "sensors/camera.hpp"
16 |
17 | namespace visensor {
18 |
19 | namespace LedFlasherDefaults {
20 | const int I2C_ADRESS = 0x48,
21 | RATE = CAMERA_FREQUENCY,
22 | NUM_OF_MSGS_IN_PACKAGE = 1,
23 | CALIBRATION_SIZE = 0;
24 | const uint8_t COM_TYPE = ViComType::FPGA_32;
25 |
26 | const bool USE_CONST_PACKAGE_SIZE = true;
27 | }
28 |
29 | class LedFlasherConfig {
30 | public:
31 | LedFlasherConfig(const SensorId::SensorId sensorId)
32 | : sensor_id_(sensorId) {
33 | // name, type, register, default, mask, min, max
34 | param_server_.addParam("strobe", param_server::UINT_T, 0X04, 2, 0, 0, 12287);
35 | param_server_.addParam("strobe_mode", param_server::BOOL_T, 0X00, true, 0x01);
36 | }
37 |
38 | ViConfigMsg getConfigParam(const std::string paramName, uint16_t value) {
39 | ViConfigMsg msg;
40 | msg.valChanged = param_server_.getConfigParam(paramName, value, msg.reg,
41 | msg.val);
42 | msg.sensorId = sensor_id_;
43 | msg.devAdress = LedFlasherDefaults::I2C_ADRESS;
44 | msg.comType = LedFlasherDefaults::COM_TYPE;
45 | return msg;
46 | }
47 |
48 | ViConfigMsg getConfigParam(const std::string paramName) {
49 | ViConfigMsg msg;
50 | msg.valChanged = param_server_.getConfigParam(paramName, msg.reg, msg.val);
51 | msg.sensorId = sensor_id_;
52 | msg.devAdress = LedFlasherDefaults::I2C_ADRESS;
53 | msg.comType = LedFlasherDefaults::COM_TYPE;
54 | return msg;
55 | }
56 |
57 | const SensorId::SensorId sensor_id_;
58 |
59 | private:
60 | param_server::ParamServer param_server_;
61 | };
62 |
63 | class LedFlasher : public Sensor {
64 | public:
65 | typedef boost::shared_ptr Ptr;
66 |
67 | LedFlasher(SensorId::SensorId sensor_id,
68 | ConfigConnection::WeakPtr config_connection);
69 | virtual ~LedFlasher();
70 |
71 | virtual void init();
72 | virtual ViConfigMsg getConfigParam(std::string cmd, uint32_t value);
73 |
74 | private:
75 | LedFlasherConfig config_;
76 | };
77 |
78 | } //namespace visensor
79 |
80 | #endif /* LED_FLASHER_HPP_ */
81 |
--------------------------------------------------------------------------------
/include/networking/auto_discovery.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef AutoDiscovery_HPP_
33 | #define AutoDiscovery_HPP_
34 |
35 | #include
36 | #include
37 | #include
38 | #include
39 |
40 | #include "visensor/visensor_datatypes.hpp"
41 |
42 | namespace visensor
43 | {
44 |
45 | class AutoDiscovery {
46 | public:
47 |
48 | AutoDiscovery(unsigned short int port);
49 | virtual ~AutoDiscovery();
50 |
51 | ViDeviceList findSensor();
52 |
53 | private:
54 | typedef std::set SensorSet;
55 | std::vector getIpList();
56 |
57 | boost::asio::io_service io_service_;
58 | boost::asio::ip::udp::socket socket_;
59 | unsigned short int port_;
60 | char* data_;
61 | boost::asio::ip::udp::endpoint sensor_endpoint_;
62 | };
63 |
64 | } //namespace visensor
65 |
66 | #endif /* AutoDiscovery_HPP_ */
67 |
--------------------------------------------------------------------------------
/src/visensor/visensor_datatypes.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #include
33 |
34 |
35 | namespace visensor
36 | {
37 |
38 | ViFrame::ViFrame()
39 | {
40 | allocated_image_bytes=0;
41 | height=0;
42 | width=0;
43 | camera_id=0;
44 | timestamp=0;
45 | timestamp_host=0;
46 | id=0;
47 | image_type=ViImageType::NOT_SET;
48 | useCorners=0;
49 | // allocated_image_bytes=image_size;
50 | // image = new unsigned char[allocated_image_bytes];
51 | }
52 |
53 | ViFrame::~ViFrame()
54 | {
55 | }
56 |
57 | int ViFrame::getBufferSize()
58 | {
59 | return allocated_image_bytes;
60 | }
61 |
62 | void ViFrame::setImageRawPtr(boost::shared_ptr buffer,
63 | uint32_t buffer_size) {
64 | image=buffer;
65 | allocated_image_bytes=buffer_size;
66 | }
67 |
68 | uint8_t* ViFrame::getImageRawPtr()
69 | {
70 | return image.get();
71 | }
72 |
73 | } //namespace visensor
74 |
75 |
--------------------------------------------------------------------------------
/include/networking/config_connection.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef CONFIGCONNECTION_HPP_
33 | #define CONFIGCONNECTION_HPP_
34 |
35 | #include
36 | #include
37 |
38 | #include
39 |
40 | namespace visensor {
41 |
42 | class ConfigConnection {
43 | public:
44 |
45 | typedef boost::shared_ptr Ptr;
46 | typedef boost::weak_ptr WeakPtr;
47 |
48 | ConfigConnection() {};
49 | virtual ~ConfigConnection() {};
50 |
51 | virtual void writeConfig(SensorId::SensorId sensor_id, uint8_t dev_adress, uint8_t reg,
52 | uint32_t val, uint8_t comType) = 0;
53 | virtual void readConfig(SensorId::SensorId sensor_id, uint8_t dev_adress, uint8_t reg,
54 | uint32_t &val, uint8_t comType) = 0;
55 | };
56 |
57 | } /* namespace visensor */
58 |
59 | #endif /* CONFIGCONNECTION_HPP_ */
60 |
--------------------------------------------------------------------------------
/include/config/assert.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef ASSERT_HPP_
33 | #define ASSERT_HPP_
34 |
35 | /***************************************************/
36 | /* ASSERT MACROS */
37 | /***************************************************/
38 | //asserts if cond is true
39 | #define VISENSOR_ASSERT_COND(cond, ...) \
40 | do { \
41 | if ((cond)) { \
42 | printf("ASSERTION FAILED\n\tfile = %s\n\tline = %d\n\tcond = %s\n", __FILE__, __LINE__, #cond); \
43 | do { printf("\tmsg: "); printf(__VA_ARGS__); printf("\n");} while (0); \
44 | exit(1); \
45 | } \
46 | } while (0)
47 |
48 |
49 | #define VISENSOR_ASSERT(...) \
50 | do { \
51 | printf("ASSERTION FAILED\n\tfile = %s\n\tline = %d\n", __FILE__, __LINE__); \
52 | do { printf("\tmsg: "); printf(__VA_ARGS__); printf("\n");} while (0); \
53 | exit(1); \
54 | } while (0)
55 |
56 |
57 |
58 | #endif /* ASSERT_HPP_ */
59 |
--------------------------------------------------------------------------------
/include/helpers/stereo_homography.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef STEREOHOMOGRAPHY_HPP_
33 | #define STEREOHOMOGRAPHY_HPP_
34 |
35 | #include
36 |
37 | #include
38 |
39 | class StereoHomography {
40 | public:
41 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW
42 |
43 | StereoHomography(const visensor::ViCameraCalibration& calib_cam0,
44 | const visensor::ViCameraCalibration& calib_cam1);
45 |
46 | //Computes homography for stereo rectification
47 | void getHomography(Eigen::Matrix3d& H0, Eigen::Matrix3d& H1, double& f_new, Eigen::Vector2d& p0_new,
48 | Eigen::Vector2d& p1_new);
49 |
50 | private:
51 | double r0_[9];
52 | double t0_[3];
53 | double f0_[2];
54 | double p0_[2];
55 | double d0_[5];
56 | double r1_[9];
57 | double t1_[3];
58 | double f1_[2];
59 | double p1_[2];
60 | double d1_[5];
61 | int image_width_;
62 | int image_height_;
63 | };
64 |
65 | #endif /* STEREOHOMOGRAPHY_HPP_ */
66 |
--------------------------------------------------------------------------------
/include/synchronization/frame_corner_synchronizer.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef FRAMECORNERSYNCHRONIZER_HPP_
33 | #define FRAMECORNERSYNCHRONIZER_HPP_
34 |
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 |
41 | #include "visensor/visensor_datatypes.hpp"
42 |
43 | using namespace visensor;
44 |
45 | class FrameCornerSynchronizer {
46 | public:
47 | FrameCornerSynchronizer();
48 | ~FrameCornerSynchronizer();
49 |
50 | void addFrame(ViFrame::Ptr frame);
51 | void addCorner(ViCorner::Ptr corner);
52 | void setUserCallback(
53 | boost::function callback);
54 |
55 | private:
56 | boost::function< void (ViFrame::Ptr, ViCorner::Ptr)> user_callback_;
57 | mutable boost::mutex mutex_;
58 | boost::condition_variable cond_;
59 | std::queue corner_queue_;
60 | };
61 |
62 | #endif /* FRAMECORNERSYNCHRONIZER_HPP_ */
63 |
--------------------------------------------------------------------------------
/include/config/compiler.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef COMPILER_HPP_
33 | #define COMPILER_HPP_
34 |
35 | #ifndef VISENSOR_PRIVATE_API_ACCESS
36 |
37 | #if defined _WIN32 || defined __CYGWIN__
38 | #ifdef BUILDING_DSO
39 | #ifdef __GNUC__
40 | #define DSO_EXPORT __attribute__ ((DSOexport))
41 | #else
42 | #define DSO_EXPORT __declspec(DSOexport) // Note: actually gcc seems to also supports this syntax.
43 | #endif
44 | #else
45 | #ifdef __GNUC__
46 | #define DSO_EXPORT __attribute__ ((DSOimport))
47 | #else
48 | #define DSO_EXPORT __declspec(DSOimport) // Note: actually gcc seems to also supports this syntax.
49 | #endif
50 | #endif
51 | #define DSO_HIDDEN
52 | #else
53 | #if __GNUC__ >= 4
54 | #define DSO_EXPORT __attribute__ ((visibility ("default")))
55 | #define DSO_HIDDEN __attribute__ ((visibility ("hidden")))
56 | #else
57 | #define DSO_EXPORT
58 | #define DSO_HIDDEN
59 | #endif
60 | #endif
61 |
62 | #endif
63 |
64 | #endif /* COMPILER_HPP_ */
65 |
--------------------------------------------------------------------------------
/include/visensor/visensor_exceptions.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef VISENSOR_EXCEPTIONS_HPP_
33 | #define VISENSOR_EXCEPTIONS_HPP_
34 |
35 | #include
36 | #include
37 |
38 | namespace visensor {
39 |
40 | class DSO_EXPORT exceptions : public std::runtime_error
41 | {
42 | public:
43 | exceptions(std::string msg): std::runtime_error(msg) {}
44 |
45 | class ConnectionException;
46 | class SensorException;
47 | class FirmwareException;
48 | };
49 |
50 | class DSO_EXPORT exceptions::ConnectionException : public exceptions
51 | {
52 | public:
53 | ConnectionException(std::string msg): exceptions(msg) {}
54 | };
55 |
56 | class DSO_EXPORT exceptions::SensorException : public exceptions
57 | {
58 | public:
59 | SensorException(std::string msg): exceptions(msg) {}
60 | };
61 |
62 | class DSO_EXPORT exceptions::FirmwareException : public exceptions
63 | {
64 | public:
65 | FirmwareException(std::string msg): exceptions(msg) {}
66 | };
67 |
68 |
69 | } //namespace visensor
70 |
71 | #endif /* VISENSOR_EXCEPTIONS_HPP_ */
72 |
--------------------------------------------------------------------------------
/include/sensors/imu.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef IMU_HPP_
33 | #define IMU_HPP_
34 |
35 | #include
36 | #include
37 | #include
38 |
39 | #include "sensors/sensor.hpp"
40 |
41 | namespace visensor {
42 | #define STANDARD_GRAVITY 9.80665
43 |
44 | class Imu : public Sensor {
45 | public:
46 | typedef boost::shared_ptr Ptr;
47 |
48 | Imu(SensorId::SensorId sensor_id, SensorSettings sensorSettings,
49 | ConfigConnection::WeakPtr config_connection)
50 | : Sensor(sensorSettings, config_connection),
51 | imu_id_(sensor_id) {
52 | }
53 | virtual ~Imu() {
54 | }
55 | ;
56 | virtual ViConfigMsg getConfigParam(std::string cmd, uint32_t value)=0;
57 |
58 | void publishImuData(ViImuMsg::Ptr imu, ViErrorCode error);
59 | void setUserCallback(boost::function callback);
60 | virtual void init() = 0;
61 |
62 | protected:
63 | boost::function user_callback_;
64 | const SensorId::SensorId imu_id_;
65 | };
66 | } //namespace visensor
67 |
68 | #endif /* IMU_HPP_ */
69 |
--------------------------------------------------------------------------------
/include/serial_bridge/SerialHost.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Skybotix AG, Switzerland (info@skybotix.com)
3 | * Copyright (c) 2014, Autonomous Systems Lab, ETH Zurich, Switzerland
4 | *
5 | * All rights reserved.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #ifndef SERIALHOST_HPP_
33 | #define SERIALHOST_HPP_
34 |
35 | #include
36 |
37 | #include
38 | #include
39 | #include
40 | #include
41 |
42 | #include "synchronization/concurrent_queue.hpp"
43 | #include "visensor/visensor_datatypes.hpp"
44 |
45 | namespace visensor {
46 |
47 | class SerialHost {
48 |
49 | private:
50 | void processSerialData();
51 | void publishSerialData(ViSerialData::Ptr& data_ptr);
52 |
53 | boost::shared_ptr worker_thread;
54 |
55 | std::vector > user_callbacks_;
56 | concurrent_queue > data_queue_;
57 |
58 | public:
59 | SerialHost();
60 | virtual ~SerialHost();
61 |
62 | void setSerialDataCallback(boost::function callback);
63 | void addDataToPublishQueue(ViSerialData::Ptr data_ptr);
64 |
65 | typedef boost::shared_ptr Ptr;
66 | typedef boost::weak_ptr WeakPtr;
67 | };
68 |
69 | } /* namespace visensor */
70 | #endif /* SERIALHOST_HPP_ */
71 |
--------------------------------------------------------------------------------
/src/work/camera_tau320.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * camera_tau320.hpp
3 | *
4 | * Created on: Apr 18, 2012
5 | * Author: burrimi
6 | */
7 |
8 | #ifndef CAMERA_TAU320_HPP_
9 | #define CAMERA_TAU320_HPP_
10 |
11 | #include "camera.hpp"
12 | #include
13 | #include