-
Notifications
You must be signed in to change notification settings - Fork 362
Event camera #83
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
Event camera #83
Conversation
* workin pipeline, wrong velocity format and of doesn't seem to work * nice pipeline with histo, but rather slow * check the framerate * not working pipeline * working pipeline of firt event sensor * commit before implementing trajectory * able to send the events to client * able to transfrm it ina image but not properly working * wrong deserialization * working pipeline * added timestep * not working trajectory * not working * working but not moving * some working * racing is workin properly, the oter one not really * working in racing * first working pipeline, but not ood yet * not working pieline * working but wrong error * not workin testing * having big errors again * events and other thing do not have same coordinates * working with second last images * nothing important * check coroutines * added client evet settings * i don't undertand why but this works * added histogram and removed second image * rosbag publisher * not working * working pipeline * tested and storing rosbags * cleaned code and added recording script * new env, writing to rosbag, no pos wirting * saving image and events * save image * writing images and erasing zeros * proper time function * saving properly * huge error accumulation * little faster and testing is more independent, overall working * recieving all images * snaga * changed testin bag destination * changed to previous port numbers * added depth and int64, still ring trajectory * added snaga config * this looks nice for now * working but has to be cleaned and made smarter, still having the helper function * wrkin ad clean * for snaga to produce video * trajectory * higher res * slightl change of trajectory * recording definitive * major changes to make it adaptive * formatted * added linear depth * added adaptive time of elia * add rotation * added corect pos output * added speed variing * added trajectory * doubled vel * added new trajectory * added angle to pure translation * add fourth traj * trajectory five * sixth trajectory * seventh trajectory * cleaned code
@@ -3,6 +3,9 @@ dist | |||
*.egg-info | |||
*.so | |||
__pycache__ | |||
build | |||
|
|||
flightros/params/local.yaml |
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.
is this line necessary?
@@ -96,7 +103,7 @@ class UnityBridge { | |||
int64_t u_packet_latency_; | |||
|
|||
// axuiliary variables | |||
const Scalar unity_connection_time_out_{10.0}; | |||
const Scalar unity_connection_time_out_{1000.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.
why using such a large time out
int output_index{0}; | ||
// eventcamera settings | ||
float Cm{0.1}; | ||
float Cp{0.1}; |
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.
what are Cm and Cp?
and why not using "Scalar" instead "float"
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.
cp and cm are the thresholds of the event sensor.
// #include <cstdio> | ||
// #include <stdint.h> | ||
// #include <cinttypes> | ||
// #include <ze/common/transformation.hpp> |
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.
maybe you can delete these comments if they are no longer needed
// using uint16_t = ze::uint16_t; | ||
// using uint16_t =std::unit16_t; | ||
// using Time = std::int64_t; | ||
|
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.
also delete these comments if no longer needed
// uint16_t y; | ||
// Time t; | ||
// bool pol; | ||
// }; |
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.
same as above
bool setsigmaCm(const float sigma_cm); | ||
bool setRefractory(const uint64_t refractory_period); | ||
bool setLogEps(const float log_eps); | ||
bool setImgStore(const bool img_store); |
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.
can we use "Scalar" instead of "float"?
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
bool setImgStore(const bool img_store); | ||
|
||
bool changeTime(TimeMessage_t time_msg); | ||
double getSecSimTime(); |
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.
also why using 'double" here
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.
because we need a higher resolution for this variable
cv::Mat createEventimages(); | ||
|
||
private: | ||
Logger logger_{"RBGCamera"}; |
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.
This is an event camera, right?
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, my bad
@@ -81,6 +82,7 @@ bool UnityBridge::sendInitialSettings(void) { | |||
msg << "Pose"; | |||
// create JSON object for initial settings | |||
json json_mesg = settings_; | |||
std::cout << settings_.vehicles[0].eventcameras.size(); |
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.
it seems like a debug code. you can remove it
// << " seconds." << std::endl; | ||
// usleep((time_out / 10.0) * 1e6); | ||
// run_time += time_out / 10.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.
I guess the code is commented out by accident.
float sigma_cp_; | ||
float sigma_cm_; | ||
int64_t refractory_period_ns_; | ||
float log_eps_; |
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.
float
or Scalar
handleOutput(always); | ||
} | ||
|
||
bool UnityBridge::handleOutput(bool always) { |
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.
always
is not used
// create new message object | ||
zmqpp::message msg; | ||
logger_.info(sub_port_); |
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.
this seems like only for debug. remove it if not needed
std::end(events)); | ||
queue_mutex_.unlock(); | ||
std::string amount = std::to_string(event_queue_for_img.size()); | ||
logger_.warn(amount); |
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.
why need a warning here?
|
||
EventCamera::EventCamera() | ||
: channels_(3), width_(720), height_(480), fov_{70.0} { | ||
auto time = std::chrono::high_resolution_clock::now(); |
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.
replace auto
with std::chrono::high_resolution_clock::now
} | ||
logger_.error("empty events buffer"); | ||
return events; | ||
} |
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.
get which events? all events from the start or a single event at the current time step?
bool EventCamera::setCp(const float cp) { | ||
if (cp <= 0.0) { | ||
logger_.warn( | ||
"The setting value for Eventcamera Cp is not valid, discard the " |
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.
what is Cp, maybe be specific here
float getCm(void) const; | ||
float getCp(void) const; | ||
float getsigmaCm(void) const; | ||
float getsigmaCp(void) const; |
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.
are float
s needed, or Scalar
@@ -24,6 +24,7 @@ bool UnityBridge::initializeConnections() { | |||
pub_.bind(client_address_ + ":" + pub_port_); | |||
|
|||
// create and bind a download_socket | |||
logger_.info(sub_port_); |
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.
is this logger for debug only
@@ -269,37 +322,100 @@ bool UnityBridge::handleOutput() { | |||
} | |||
} | |||
} | |||
// feed events to the eventcamera | |||
for (const auto& cam : settings_.vehicles[idx].eventcameras) { |
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.
try not use auto
@@ -0,0 +1,90 @@ | |||
#pragma once |
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.
the record.hpp
can be more specific, e.g., "record_events.hpp"
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.
but it is actually to record all kind of data, e.g. positions, images, ...
@@ -0,0 +1,94 @@ | |||
#pragma once |
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.
is this testing.hpp file needed?
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.
some high-level comments:
- use clang-format for automatically formating the c++ code
- be consistent when using "float" or "double", I prefer using "Scalar"
- delete codes that are not longer needed, such as std::cout , longer, or commented code
- in flightros, put the ROS example into a single folder, e.g., a folder named "eventcamera"
This is the event camera implementation.