Skip to content
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

Open
wants to merge 4 commits into
base: missions_refactor
Choose a base branch
from

Conversation

sovadim
Copy link
Member

@sovadim sovadim commented Nov 17, 2020

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
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
Member

Choose a reason for hiding this comment

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

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

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

ros::NodeHandle n;
Copy link
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
Member

Choose a reason for hiding this comment

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

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

Copy link
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
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
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
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
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
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