-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Stingray depth camera #10
base: missions_refactor
Are you sure you want to change the base?
Conversation
## Generate messages in the 'msg' folder | ||
add_message_files( | ||
FILES | ||
Object.msg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно использовать сообщение из пакета stingray_vision_msgs
@@ -0,0 +1,6 @@ | |||
string name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно использовать сообщение из пакета 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше подобные переменные не называть одной буквой n, лучше назвать nodeHandle или хотя бы nh
}; | ||
|
||
void depthCallback(const sensor_msgs::Image::ConstPtr& msg) { | ||
float* depths = (float*)(&msg->data[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я правильно понимаю что здесь двумерное изображение будет представляться одномерным массивом?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ты проверял, эта формула точно работает?
И желательно вынести ее в отдельную переменную для лучшей читаемости
#include <sensor_msgs/Image.h> | ||
#include "stingray_depth_vision/Object.h" | ||
|
||
using namespace boost::accumulators; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я предпочитаю не использовать 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
То же самое, надо использовать сообщение из stingray_vision_msgs
Точнее там планируется что в топик будет слаться сообщение Objects
class CameraActions { | ||
|
||
private: | ||
int16_t top_left_x; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я планировал использовать везде CamelCase в C++ в Stingray, но в целом не критично
@@ -0,0 +1,9 @@ | |||
# Stingray depth package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Насчет обновлений Readme потом еще подумаем, но пускай для удобства пока останется
No description provided.