Skip to content

Commit b3f5470

Browse files
authored
Setting Up Vision Packages (#420)
* vision package initial commit * removed license
1 parent eb133d2 commit b3f5470

3 files changed

Lines changed: 96 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
2+
3+
cmake_minimum_required(VERSION 3.8)
4+
project(vision_manager)
5+
6+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
7+
add_compile_options(-Wall -Wextra -Wpedantic)
8+
endif()
9+
10+
# find dependencies
11+
find_package(ament_cmake REQUIRED)
12+
find_package(rclcpp REQUIRED)
13+
find_package(std_msgs REQUIRED)
14+
15+
add_executable(vision_manager src/vision_manager.cpp)
16+
ament_target_dependencies(vision_manager rclcpp std_msgs)
17+
18+
install(TARGETS
19+
vision_manager
20+
DESTINATION lib/${PROJECT_NAME})
21+
22+
23+
ament_package()
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
4+
<name>vision_manager</name>
5+
<version>0.0.0</version>
6+
<description>TODO: Package description</description>
7+
<maintainer email="flin0@seas.upenn.edu">ubuntu</maintainer>
8+
<license>Apache-2.0</license>
9+
10+
<buildtool_depend>ament_cmake</buildtool_depend>
11+
12+
<depend>rclcpp</depend>
13+
<depend>std_msgs</depend>
14+
15+
<test_depend>ament_lint_auto</test_depend>
16+
<test_depend>ament_lint_common</test_depend>
17+
18+
<export>
19+
<build_type>ament_cmake</build_type>
20+
</export>
21+
</package>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2016 Open Source Robotics Foundation, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include <chrono>
16+
#include <memory>
17+
#include <string>
18+
19+
#include "rclcpp/rclcpp.hpp"
20+
#include "std_msgs/msg/string.hpp"
21+
22+
using namespace std::chrono_literals;
23+
24+
/* This example creates a subclass of Node and uses a fancy C++11 lambda
25+
* function to shorten the callback syntax, at the expense of making the
26+
* code somewhat more difficult to understand at first glance. */
27+
28+
class MinimalPublisher : public rclcpp::Node {
29+
public:
30+
MinimalPublisher() : Node("minimal_publisher"), count_(0) {
31+
publisher_ = this->create_publisher<std_msgs::msg::String>("topic", 10);
32+
auto timer_callback = [this]() -> void {
33+
auto message = std_msgs::msg::String();
34+
message.data = "Hello, world! " + std::to_string(this->count_++);
35+
RCLCPP_INFO(this->get_logger(), "Publishing: '%s'", message.data.c_str());
36+
this->publisher_->publish(message);
37+
};
38+
timer_ = this->create_wall_timer(500ms, timer_callback);
39+
}
40+
41+
private:
42+
rclcpp::TimerBase::SharedPtr timer_;
43+
rclcpp::Publisher<std_msgs::msg::String>::SharedPtr publisher_;
44+
size_t count_;
45+
};
46+
47+
int main(int argc, char* argv[]) {
48+
rclcpp::init(argc, argv);
49+
rclcpp::spin(std::make_shared<MinimalPublisher>());
50+
rclcpp::shutdown();
51+
return 0;
52+
}

0 commit comments

Comments
 (0)