Skip to content

WIP: Stingray depth camera#10

Open
sovadim wants to merge 4 commits into
missions_refactorfrom
stingray_depth_camera
Open

WIP: Stingray depth camera#10
sovadim wants to merge 4 commits into
missions_refactorfrom
stingray_depth_camera

Conversation

@sovadim

@sovadim sovadim commented Nov 17, 2020

Copy link
Copy Markdown
Member

No description provided.

@sovadim
sovadim changed the base branch from master to missions_refactor November 17, 2020 21:18
@sovadim sovadim changed the title Stingray depth camera WIP: Stingray depth camera Nov 17, 2020
## Generate messages in the 'msg' folder
add_message_files(
FILES
Object.msg

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно использовать сообщение из пакета stingray_vision_msgs

Comment thread src/stingray_depth_vision/src/distance_measure.cpp Outdated
int main(int argc, char **argv) {
ros::init(argc, argv, "zed_subscriber");

ros::NodeHandle n;

Copy link
Copy Markdown
Member

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]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я правильно понимаю что здесь двумерное изображение будет представляться одномерным массивом?

Copy link
Copy Markdown
Member Author

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])) {

Copy link
Copy Markdown
Member

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;

Copy link
Copy Markdown
Member

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) {

Copy link
Copy Markdown
Member

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;

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Насчет обновлений Readme потом еще подумаем, но пускай для удобства пока останется

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants