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

[ROS2] grid_map_demos port 1/3 #259

Merged
merged 10 commits into from
Sep 29, 2020
Merged

Conversation

Marwan99
Copy link

@Marwan99 Marwan99 commented Sep 13, 2020

grid_map_demos porting will be split into 3 PRs.

This PR includes:

  • Linting of the whole package.
  • Port of the following nodes/demos:
    • simple_demo 118ef1c
      • src/simple_demo_node.cpp
      • config/simple_demo.yaml
      • launch/simple_demo_launch.py
    • tutorial_demo 118ef1c
      • src/tutorial_demo_node.cpp
      • config/tutorial_demo.yaml
      • launch/tutorial_demo_launch.py
    • iterator_demo ad6e9ea
      • src/iterators_demo_node.cpp
      • src/IteratorsDemo.cpp
      • config/iterators_demo.yaml
      • launch/iterators_demo_launch.py
    • image_to_grid_map_demo ad6e9ea
      • src/image_to_gridmap_demo_node.cpp
      • src/ImageToGridmapDemo.cpp
      • scripts/image_publisher.py
      • config/image_to_gridmap_demo.yaml
      • launch/image_to_gridmap_demo_launch.py
  • The CMakeLists.txt and package.xml have been updated according to the nodes/demos mentioned above, they should be fully ported and cleaned in the final grid_map_demos PR.

Signed-off-by: Marwan Taher <marokhaled99@gmail.com>
Signed-off-by: Marwan Taher <marokhaled99@gmail.com>
Signed-off-by: Marwan Taher <marokhaled99@gmail.com>
@Marwan99 Marwan99 mentioned this pull request Sep 13, 2020
Copy link

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

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

Looks good on a first run, did you test each of these to be working in rviz?

${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${OCTOMAP_INCLUDE_DIR}
# ${EIGEN3_INCLUDE_DIR}

Choose a reason for hiding this comment

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

Dont you still need these?

Copy link
Author

Choose a reason for hiding this comment

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

These includes seemed redundant, things building and running fine as is (locally at least atm). octomap already included when depending on grid_map_octomap and same for eigen as well (not sure which package off the top of my head). Will delete them in the final grid_map_demos port to confirm that nothing needs, if thats okay.

simple_demo
${catkin_LIBRARIES}
"rclcpp"

Choose a reason for hiding this comment

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

Use dependencies these are all the same

Copy link
Author

Choose a reason for hiding this comment

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

I was planning on using dependencies once I all the nodes are ported to know all the common dependencies. So this should done in an upcoming PR, is that okay.


gridMapPublisher_ = this->create_publisher<grid_map_msgs::msg::GridMap>(
"grid_map", rclcpp::QoS(
1).transient_local());

Choose a reason for hiding this comment

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

This seems like an unnecessary line break

ros::Duration duration(0.01);
duration.sleep();
auto sleep_duration = rclcpp::Duration::from_seconds(0.01);
rclcpp::sleep_for(std::chrono::nanoseconds(sleep_duration.nanoseconds()));

Choose a reason for hiding this comment

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

was 0.01*1e9 not good enough 😉

Copy link
Author

Choose a reason for hiding this comment

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

Fair point :')

@Marwan99
Copy link
Author

Looks good on a first run, did you test each of these to be working in rviz?

@SteveMacenski Yes, all tested with RVIZ and compared against the output from ros1.

… instead of a node for each visualization

Signed-off-by: Marwan Taher <marokhaled99@gmail.com>
Signed-off-by: Marwan Taher <marokhaled99@gmail.com>
@Marwan99
Copy link
Author

CI failure should be resolved once grid_map_filters is merged.
The dependency on grid_map_filters can be commend out for now to get CI to continue uninterpreted, if need.

Copy link
Collaborator

@maximilianwulf maximilianwulf left a comment

Choose a reason for hiding this comment

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

That is huge 👍 Thanks a lot. So you want to merge this and then do the rest?

@@ -0,0 +1,61 @@
import os
Copy link
Collaborator

Choose a reason for hiding this comment

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

That is a lot of work, respect!

Copy link
Author

Choose a reason for hiding this comment

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

Thanks :)

return 0;
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice

@@ -15,15 +12,16 @@ int main(int argc, char** argv)
GridMap map({"layer"});
map.setFrameId("map");
map.setGeometry(Length(0.7, 0.7), 0.01, Position(0.0, 0.0));
ROS_INFO("Created map with size %f x %f m (%i x %i cells).\n The center of the map is located at (%f, %f) in the %s frame.",
ROS_INFO(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Still ROS?

Copy link
Author

Choose a reason for hiding this comment

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

This file is not ported into this PR, it is just linted.
This will be addressed in an upcoming PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks.

grid_map_demos/src/opencv_demo_node.cpp Show resolved Hide resolved
unsigned int nCells = map.getSize().prod();
// cppcheck-suppress unreadVariable
double rootMeanSquaredError = sqrt((map["error"].array().pow(2).sum()) / nCells);
// unsigned int nCells = map.getSize().prod(); // unused variable
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can just delete it.

@@ -30,7 +30,7 @@ class GridCellsVisualization : public VisualizationBase
* Constructor.
* @param name the name of the visualization.
*/
explicit GridCellsVisualization(const std::string & name);
explicit GridCellsVisualization(const std::string & name, rclcpp::Node::SharedPtr node_ptr);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Violation of naming convention: nodePtr.

@@ -32,7 +32,7 @@ class PointCloudVisualization : public VisualizationBase
* Constructor.
* @param name the name of the visualization.
*/
explicit PointCloudVisualization(const std::string & name);
explicit PointCloudVisualization(const std::string & name, rclcpp::Node::SharedPtr node_ptr);
Copy link
Collaborator

Choose a reason for hiding this comment

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

In all of these files the naming convention was violated.

Signed-off-by: Marwan Taher <marokhaled99@gmail.com>
@ghost
Copy link

ghost commented Sep 25, 2020

Congratulations 🎉. DeepCode analyzed your code in 902.65 seconds and we found no issues. Enjoy a moment of no bugs ☀️.

👉 View analysis in DeepCode’s Dashboard | Configure the bot

@Marwan99
Copy link
Author

So you want to merge this and then do the rest?

Yes, the rest will be the 2 upcoming PRs.

@Marwan99
Copy link
Author

Regarding the deepcode warnings:

Container std::array is only queried but does not seem to be ever updated. Occurrences: InterpolationDemo.cpp:129

I guess that's fine in this context?

Calling size on empty container std::array will always evaluate to 0. Occurrences: InterpolationDemo.cpp:141

This doesn't seem right to me as std::array<..> g is being populated here so g is not an empty container, is that correct?

@maximilianwulf Can you please advice on the correct course of action for these warnings?


@maximilianwulf @SteveMacenski Can you please review the changes?

@maximilianwulf
Copy link
Collaborator

Container std::array is only queried but does not seem to be ever updated. Occurrences: InterpolationDemo.cpp:129
I guess that's fine in this context?

We add content in the for loop, right? I don't really get it.

This doesn't seem right to me as std::array<..> g is being populated here so g is not an empty container, is that correct?

Ah yes, that is what I think, can you add an ignore to it?

Copy link
Collaborator

@maximilianwulf maximilianwulf left a comment

Choose a reason for hiding this comment

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

LGTM.

@Marwan99
Copy link
Author

We add content in the for loop, right?

Yes.
It is ambiguous about the array its referring to. Is it safe to ignore this warning as well?

for (int i = 0; i < numGaussians; ++i) {
g.at(i).x0 = means.at(i).first;
g.at(i).y0 = means.at(i).second;
g.at(i).varX = vars.at(i).first;
g.at(i).varY = vars.at(i).second;
g.at(i).s = scales.at(i);
}

@maximilianwulf
Copy link
Collaborator

It is ambiguous about the array its referring to. Is it safe to ignore this warning as well?

I would say so.

@Marwan99
Copy link
Author

Retry DeepCode

@Marwan99
Copy link
Author

Very interesting, the warnings are now magically not there anymore.
The warnings were not showing up for some reason so I re-triggered deepcode to get them again but now they are completely gone.

@SteveMacenski Good to go?

@SteveMacenski
Copy link

You need to readd EIGEN3_INCLUDE_DIR to includes so that when the includes are explored these are gathered.

@SteveMacenski
Copy link

Ping me when CI passes and I'll merge

@Marwan99
Copy link
Author

@SteveMacenski Ready to merge.

@SteveMacenski SteveMacenski merged commit a7157dd into ANYbotics:ros2 Sep 29, 2020
@Marwan99 Marwan99 deleted the demo-port branch September 29, 2020 19:55
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.

None yet

3 participants