This commit is contained in:
Sem van der Hoeven
2023-05-10 10:11:43 +02:00
parent 31f3959de4
commit e4c0db4553
2 changed files with 7 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
#include <chrono> \#include <chrono>
#include "rclcpp/rclcpp.hpp" #include "rclcpp/rclcpp.hpp"
#include "object_detection/msg/multiflex_reading.hpp" #include "object_detection/msg/multiflex_reading.hpp"
@@ -38,9 +38,9 @@ public:
return; return;
} }
if (!multiflex->configureNumberOfSensors(0x3f)) // check if all 6 distance sensors work if (!multiflex->configureNumberOfSensors(0x1F)) // check if all 6 distance sensors work
{ {
RCLCPP_ERROR(this->get_logger(), "Failed to set the number of sensors to 6!"); RCLCPP_ERROR(this->get_logger(), "Failed to set the number of sensors to 5!");
return; return;
} }
@@ -72,11 +72,12 @@ private:
auto msg = object_detection::msg::MultiflexReading(); auto msg = object_detection::msg::MultiflexReading();
for (size_t i = 0; i < data.size(); i++) for (size_t i = 0; i < data.size(); i++)
{ {
msg.distance_data[i] = data.distance[i]; RCLCPP_INFO(this->get_logger(), "distance: %f", data.distance[i]);
// msg.distance_data[i] = data.distance[i];
} }
// publish message // publish message
publisher_->publish(msg); // publisher_->publish(msg);
} }
}; };

View File

@@ -80,7 +80,7 @@ class TestController(Node):
if key == 'f': if key == 'f':
self.get_logger().info('up a little') self.get_logger().info('up a little')
self.send_request(pitch=0.0, yaw=0.0, self.send_request(pitch=0.0, yaw=0.0,
roll=0.0, thrust=-0.01) roll=0.0, thrust=0.01)
if key == 'n': if key == 'n':
self.get_logger().info('stop') self.get_logger().info('stop')
self.send_request(pitch=0.0, yaw=0.0, self.send_request(pitch=0.0, yaw=0.0,