forked from CoreSenseEU/coresense_instrumentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added generic template * Added image template * Added image_transport * Added image option * Added image_transport pub & sub * Bug * Added new tests * 0.2.0
- Loading branch information
Showing
11 changed files
with
229 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Changelog for package coresense_instrumentation | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
0.2.0 (2023-11-30) | ||
------------------ | ||
* Added new type: sensor_msgs/msg/Image with specialiced template | ||
|
||
0.1.0 (2023-11-29) | ||
------------------ | ||
* Driver works correctly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
<package format="3"> | ||
<name>coresense_instrumentation</name> | ||
<version>0.1.0</version> | ||
<version>0.2.0</version> | ||
<description>Coresense Instrumentation</description> | ||
<maintainer email="[email protected]">Juan Carlos Manzanares Serrano</maintainer> | ||
<license>Apache-2.0</license> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Changelog for package coresense_instrumentation | ||
Changelog for package coresense_instrumentation_drived | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
0.2.0 (2023-11-30) | ||
------------------ | ||
* Added new type: sensor_msgs/msg/Image with specialiced template | ||
|
||
0.1.0 (2023-11-29) | ||
------------------ | ||
* Driver works correctly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
<package format="3"> | ||
<name>coresense_instrumentation_driver</name> | ||
<version>0.1.0</version> | ||
<version>0.2.0</version> | ||
<description>Coresense Instrumentation Driver</description> | ||
<maintainer email="[email protected]">Juan Carlos Manzanares Serrano</maintainer> | ||
<license>Apache-2.0</license> | ||
|
@@ -14,6 +14,7 @@ | |
<depend>rclcpp_components</depend> | ||
<depend>std_msgs</depend> | ||
<depend>sensor_msgs</depend> | ||
<depend>image_transport</depend> | ||
|
||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>ament_lint_common</test_depend> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
...ense_instrumentation_driver/src/coresense_instrumentation_driver/InstrumentationImage.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// Copyright 2023 Intelligent Robotics Lab | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "coresense_instrumentation_driver/InstrumentationLifecycleNode.hpp" | ||
|
||
namespace coresense_instrumentation_driver | ||
{ | ||
|
||
template class coresense_instrumentation_driver::InstrumentationLifecycleNode<sensor_msgs::msg::Image>; | ||
|
||
InstrumentationLifecycleNode<sensor_msgs::msg::Image>::InstrumentationLifecycleNode( | ||
const rclcpp::NodeOptions & options) | ||
: rclcpp_lifecycle::LifecycleNode("image_node", "", options) | ||
{ | ||
declare_parameter("topic", std::string("")); | ||
declare_parameter("topic_type", std::string("")); | ||
|
||
get_parameter("topic", topic_); | ||
get_parameter("topic_type", topic_type_); | ||
|
||
node_ = rclcpp::Node::make_shared("subnode"); | ||
|
||
RCLCPP_INFO(get_logger(), "Creating InstrumentationImage"); | ||
} | ||
|
||
InstrumentationLifecycleNode<sensor_msgs::msg::Image>::~InstrumentationLifecycleNode() | ||
{ | ||
RCLCPP_DEBUG(get_logger(), "Destroying InstrumentationImage"); | ||
} | ||
|
||
void InstrumentationLifecycleNode<sensor_msgs::msg::Image>::imageCallback( | ||
const sensor_msgs::msg::Image::ConstSharedPtr & msg) | ||
{ | ||
if (pub_ && pub_.getNumSubscribers() > 0) { | ||
pub_.publish(msg); | ||
} | ||
} | ||
|
||
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn | ||
InstrumentationLifecycleNode<sensor_msgs::msg::Image>::on_configure(const rclcpp_lifecycle::State &) | ||
{ | ||
auto subscription_options = rclcpp::SubscriptionOptions(); | ||
|
||
sub_ = image_transport::create_subscription( | ||
node_.get(), | ||
topic_, | ||
std::bind( | ||
&InstrumentationLifecycleNode<sensor_msgs::msg::Image>::imageCallback, this, | ||
std::placeholders::_1), | ||
"raw", | ||
rmw_qos_profile_sensor_data, | ||
subscription_options); | ||
|
||
return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS; | ||
} | ||
|
||
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn | ||
InstrumentationLifecycleNode<sensor_msgs::msg::Image>::on_activate(const rclcpp_lifecycle::State &) | ||
{ | ||
image_transport::ImageTransport it(node_); | ||
pub_ = it.advertise("/coresense" + topic_, 1); | ||
|
||
return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS; | ||
} | ||
|
||
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn | ||
InstrumentationLifecycleNode<sensor_msgs::msg::Image>::on_deactivate( | ||
const rclcpp_lifecycle::State &) | ||
{ | ||
return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS; | ||
} | ||
|
||
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn | ||
InstrumentationLifecycleNode<sensor_msgs::msg::Image>::on_cleanup(const rclcpp_lifecycle::State &) | ||
{ | ||
return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS; | ||
} | ||
|
||
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn | ||
InstrumentationLifecycleNode<sensor_msgs::msg::Image>::on_shutdown(const rclcpp_lifecycle::State &) | ||
{ | ||
return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS; | ||
} | ||
|
||
std::string InstrumentationLifecycleNode<sensor_msgs::msg::Image>::get_topic() | ||
{ | ||
return topic_; | ||
} | ||
|
||
std::string InstrumentationLifecycleNode<sensor_msgs::msg::Image>::get_topic_type() | ||
{ | ||
return topic_type_; | ||
} | ||
|
||
} // namespace coresense_instrumentation_driver | ||
|
||
#include "rclcpp_components/register_node_macro.hpp" | ||
RCLCPP_COMPONENTS_REGISTER_NODE( | ||
coresense_instrumentation_driver::InstrumentationLifecycleNode<sensor_msgs::msg::Image>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters