WIP: Stingray depth camera#10
Conversation
| ## Generate messages in the 'msg' folder | ||
| add_message_files( | ||
| FILES | ||
| Object.msg |
There was a problem hiding this comment.
Нужно использовать сообщение из пакета stingray_vision_msgs
| @@ -0,0 +1,6 @@ | |||
| string name | |||
There was a problem hiding this comment.
Нужно использовать сообщение из пакета stingray_vision_msgs
| int main(int argc, char **argv) { | ||
| ros::init(argc, argv, "zed_subscriber"); | ||
|
|
||
| ros::NodeHandle n; |
There was a problem hiding this comment.
Лучше подобные переменные не называть одной буквой n, лучше назвать nodeHandle или хотя бы nh
| }; | ||
|
|
||
| void depthCallback(const sensor_msgs::Image::ConstPtr& msg) { | ||
| float* depths = (float*)(&msg->data[0]); |
There was a problem hiding this comment.
Я правильно понимаю что здесь двумерное изображение будет представляться одномерным массивом?
|
|
||
| for (uint32_t h = upper_y; h < lower_y; ++h) { | ||
| for (uint32_t w = left_x; w < right_x; ++w) { | ||
| if (!std::isnan(depths[w + (h - upper_y)*w]) && !std::isinf(depths[w + (h - upper_y)*w])) { |
There was a problem hiding this comment.
Ты проверял, эта формула точно работает?
И желательно вынести ее в отдельную переменную для лучшей читаемости
| #include <sensor_msgs/Image.h> | ||
| #include "stingray_depth_vision/Object.h" | ||
|
|
||
| using namespace boost::accumulators; |
There was a problem hiding this comment.
Я предпочитаю не использовать using namespace: https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice
| ROS_INFO("Mean distance: %g, Counted: %ld", mean(acc), count(acc)); | ||
| } | ||
|
|
||
| void netCallback(const distance_measure::Object::ConstPtr& msg) { |
There was a problem hiding this comment.
То же самое, надо использовать сообщение из stingray_vision_msgs
Точнее там планируется что в топик будет слаться сообщение Objects
| class CameraActions { | ||
|
|
||
| private: | ||
| int16_t top_left_x; |
There was a problem hiding this comment.
Я планировал использовать везде CamelCase в C++ в Stingray, но в целом не критично
| @@ -0,0 +1,9 @@ | |||
| # Stingray depth package | |||
There was a problem hiding this comment.
Насчет обновлений Readme потом еще подумаем, но пускай для удобства пока останется
No description provided.