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

Camera class added and fiducial marker detections #7

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

chris24sahadeo
Copy link
Member

Milestone 1a v1

Copy link
Member

@sarika93 sarika93 left a comment

Choose a reason for hiding this comment

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

Not done reviewing this, but there is definitely enough here to tackle while I finish reviewing the rest of it.
The YAML formatting needs a big refactor, as well as determining if something is too far away.

rviz_simulator/launch/simulate.launch Outdated Show resolved Hide resolved
rviz_simulator/include/rviz_simulator/target.h Outdated Show resolved Hide resolved
rviz_simulator/src/target.cpp Show resolved Hide resolved
rviz_simulator/src/target.cpp Outdated Show resolved Hide resolved
rviz_simulator/include/rviz_simulator/camera.h Outdated Show resolved Hide resolved
rviz_simulator/src/camera.cpp Outdated Show resolved Hide resolved
rviz_simulator/src/camera.cpp Outdated Show resolved Hide resolved
rviz_simulator/src/camera.cpp Outdated Show resolved Hide resolved
rviz_simulator/src/camera.cpp Outdated Show resolved Hide resolved
rviz_simulator/src/camera.cpp Outdated Show resolved Hide resolved
TODO:
- Function to detect if target is too far away

- Change code to confirm to new YAML output requirements

- Document desired YAML output with David
Still working on milestone 1 Big Discussion Fixes.
Committing just to save progress.
The camera detects more targets on the right side then the left side
Code now generates the new YAML file formats,
as specified in the google doc.
Copy link
Member

@sarika93 sarika93 left a comment

Choose a reason for hiding this comment

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

Requested a few changes. When I ran this there was one instance where I was unable to generate an detections even though there was a tag within range of the camera. I was unable to recreate this afterwards though; if I am able to, I will let you know.

Also you have some very long variable names. Generally, you want names to be clear but with fewer words; abbreaviations are fine once they are clear e.g. dist instead of distance.

rviz_simulator/include/rviz_simulator/camera.h Outdated Show resolved Hide resolved
rviz_simulator/include/rviz_simulator/camera.h Outdated Show resolved Hide resolved
rviz_simulator/include/rviz_simulator/camera.h Outdated Show resolved Hide resolved
rviz_simulator/include/rviz_simulator/camera.h Outdated Show resolved Hide resolved
rviz_simulator/launch/simulate.launch Show resolved Hide resolved
rviz_simulator/src/camera.cpp Show resolved Hide resolved
rviz_simulator/src/camera.cpp Show resolved Hide resolved
rviz_simulator/src/camera.cpp Show resolved Hide resolved
rviz_simulator/src/camera.cpp Outdated Show resolved Hide resolved
rviz_simulator/src/camera.cpp Outdated Show resolved Hide resolved
@chris24sahadeo chris24sahadeo requested a review from sarika93 July 30, 2019 19:09
rviz_simulator/launch/simulate.launch Outdated Show resolved Hide resolved
rviz_simulator/launch/simulate.launch Outdated Show resolved Hide resolved
std_msgs::ColorRGBA blue = loadColor(n, "blue");
double target_scale;
n.getParam("target_scale", target_scale);
double target_scale = 0.1;
Copy link
Member

Choose a reason for hiding this comment

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

Tag size should not be hardcoded. This should be a param as was done previously. However, there should be two params instead of one; one for target_x_scale and one for target_y_scale. You can use a default of target_x_scale = target_y_scale = 0.1.

Copy link
Member Author

Choose a reason for hiding this comment

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

I made the param in the initialize_simulator.yaml file a sequence of length 3 (length, width, depth), example:
target_size: [0.1, 0.1, 0.01]
which is read into a std::vector<double> from the parameter server in the simulate.cpp file (since rosparam cpp can automatically read vectors with no additional code)

The depth is theoretically 0 since the target is a plane, so I gave it a depth of 1cm and set the target class to accept the vector and initialize the visualization marker dimensions accordingly.

rviz_simulator/src/camera.cpp Outdated Show resolved Hide resolved
rviz_simulator/src/camera.cpp Outdated Show resolved Hide resolved
rviz_simulator/src/simulate.cpp Outdated Show resolved Hide resolved
rviz_simulator/src/simulate.cpp Outdated Show resolved Hide resolved
rviz_simulator/src/simulate.cpp Outdated Show resolved Hide resolved
rviz_simulator/src/simulate.cpp Outdated Show resolved Hide resolved
rviz_simulator/src/simulate.cpp Outdated Show resolved Hide resolved
Copy link
Member

@sarika93 sarika93 left a comment

Choose a reason for hiding this comment

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

Some minor things to fix. Verifying pixel values before I approve.

> `camera_intrinsics_file:=<camera_intrinsics_file_name.yaml>`

The `simulator` node creates a new folder `"detections_ROS_timestamp"` in the `rviz_simulator` package folder. A new detections folder with a new timestamp is created each time `roslaunch` is run.
The `simulator` node creates a new folder with the name `"detections_<ROS_timestamp>"` in the `rviz_simulator` package folder.
Copy link
Member

Choose a reason for hiding this comment

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

The comment you are resolving only said you needed to include an example to the ROS Timestamp; not the entire detections file. The file sample clutters the README.

Additionally, in the below example, it looks like the time-stamped name is associated with the detections YAML file and this is not the case. It's actually used in the folder name.

Instead, if you want to provide detections examples, create an "examples" folder and upload a few examples of the file format to the repo. If you take this approach (which I would recommend), add in comments so anyone who wants to read this through knows what the fields mean and what the format is (e.g. if matrices are row or column major).

@@ -39,8 +39,9 @@
#include <fstream>

// for making directories
#include <sys/stat.h>
#include <sys/types.h>
// #include <sys/stat.h>
Copy link
Member

Choose a reason for hiding this comment

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

If these are no longer used, just remove them, rather than commenting it out.

@@ -107,17 +108,17 @@ void Camera::makeOutputDirectories()
std::string detections_root_folder = package_path + "/detections";

// if detections root directory does not exist then create it
struct stat info;
if (stat(detections_root_folder.c_str(), &info) != 0)
// struct stat info;
Copy link
Member

Choose a reason for hiding this comment

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

Remove this commented out line.

ROS_ERROR_STREAM("Error making directory : " << strerror(errno) << std::endl);
}

this->output_folder_path_ = detections_root_folder + "/" + output_folder_name;

if (mkdir(this->output_folder_path_.c_str(), 0777) == -1)
if (!boost::filesystem::create_directories(this->output_folder_path_))
ROS_ERROR_STREAM("Error : " << strerror(errno) << std::endl);

Copy link
Member

Choose a reason for hiding this comment

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

Nit: Remove extra line space for consistency

}
else // invalid point name
{
ROS_ERROR_STREAM(point_name << " is an invalid param name.");
ROS_ERROR_STREAM("The param " << point_name << "was not found or is of an invalid type. Exiting application!");
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Add in a space before "was" for cleaner formatting.

Copy link
Member

@sarika93 sarika93 left a comment

Choose a reason for hiding this comment

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

Approving after testing (which admittedly wasn't super rigorous), with the assumption that the fixes from the previous review will be made before merging.

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