add launch file
This commit is contained in:
@@ -48,6 +48,11 @@ install(TARGETS
|
|||||||
DESTINATION lib/${PROJECT_NAME}
|
DESTINATION lib/${PROJECT_NAME}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
DIRECTORY launch
|
||||||
|
DESTINATION share/${PROJECT_NAME}
|
||||||
|
)
|
||||||
|
|
||||||
if(BUILD_TESTING)
|
if(BUILD_TESTING)
|
||||||
find_package(ament_lint_auto REQUIRED)
|
find_package(ament_lint_auto REQUIRED)
|
||||||
# the following line skips the linter which checks for copyrights
|
# the following line skips the linter which checks for copyrights
|
||||||
|
|||||||
15
src/object_detection/launch/object_detection_launch.py
Normal file
15
src/object_detection/launch/object_detection_launch.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
from launch import LaunchDescription
|
||||||
|
from launch_ros.actions import Node
|
||||||
|
|
||||||
|
def generate_launch_description():
|
||||||
|
return LaunchDescription([
|
||||||
|
Node(
|
||||||
|
package="object_detection",
|
||||||
|
executable="multiflex_reader",
|
||||||
|
name="multiflex_reader",
|
||||||
|
parameters=[
|
||||||
|
{"serial_port": "/dev/ttyACM0"}
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
])
|
||||||
@@ -21,8 +21,12 @@ public:
|
|||||||
MultiflexReader()
|
MultiflexReader()
|
||||||
: Node("multiflex_reader")
|
: Node("multiflex_reader")
|
||||||
{
|
{
|
||||||
|
rcl_interfaces::msg::ParameterDescriptor serial_port_descriptor = rcl_interfaces::msg::ParameterDescriptor{};
|
||||||
|
serial_port_descriptor.description = "Serial port of the USB port that the multiflex PCB is connected to.";
|
||||||
|
this->declare_parameter("serial_port", "/dev/ttyACM0", serial_port_descriptor);
|
||||||
|
|
||||||
factory = terabee::ITerarangerFactory::getFactory();
|
factory = terabee::ITerarangerFactory::getFactory();
|
||||||
multiflex = factory->createTerarangerMultiflex("/dev/ttyACM0");
|
multiflex = factory->createTerarangerMultiflex(this->get_parameter("serial_port").as_string());
|
||||||
|
|
||||||
if (!multiflex)
|
if (!multiflex)
|
||||||
{
|
{
|
||||||
@@ -54,7 +58,7 @@ private:
|
|||||||
{
|
{
|
||||||
terabee::DistanceData data = multiflex->getDistance();
|
terabee::DistanceData data = multiflex->getDistance();
|
||||||
auto msg = object_detection::msg::MultiflexReading();
|
auto msg = object_detection::msg::MultiflexReading();
|
||||||
for (int i = 0; i < data.size(); i++)
|
for (size_t i = 0; i < data.size(); i++)
|
||||||
{
|
{
|
||||||
msg.distance_data[i] = data.distance[i];
|
msg.distance_data[i] = data.distance[i];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user