Skip to content

Dummy robot demo#118

Merged
Karsten1987 merged 14 commits intomasterfrom
dummy_robot_demo
Mar 22, 2017
Merged

Dummy robot demo#118
Karsten1987 merged 14 commits intomasterfrom
dummy_robot_demo

Conversation

@Karsten1987
Copy link
Copy Markdown
Contributor

This is a PR for a robot demo which includes a map_server, joint_state_publisher, robot_state_publisher and a laser_scan_publisher. It basically resembles the rrbot.

The following PRs are dependent on this:

The following new packages have to be compiled for this:

Depending on the success for the chocolatey packages, we can also use the upstream version of urdfdom* and tinyxml

Buldfarm Status:

  • linux: Build Status
  • mac: Build Status (unrelated test failure)
  • windows: In progress, we need tinyxml and eigen3 as chocolate packages

@Karsten1987 Karsten1987 self-assigned this Mar 11, 2017
@dhood dhood added the in progress Actively being worked on (Kanban column) label Mar 11, 2017
@Karsten1987
Copy link
Copy Markdown
Contributor Author

@ros2/team I leave this PR labeled as in progress due to open PRs, but ask for feedback already.

@mikaelarguedas
Copy link
Copy Markdown
Member

same as ros2/ci#34 (comment), should all the dependencies listed above be added to the new repos file and this demo target a different branch than master?

Copy link
Copy Markdown
Member

@mikaelarguedas mikaelarguedas 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!
Haven't tried the code just read through it. Except a few minor comments it looks good to me.

Note: I think the dependencies necessary to run this code should be listed in the package.xml of all packages using them.
Note2: Could you detail the motivation for not leveraging the map_server ported recently and implementing a dummy one here instead ?

Nitpick: there is a .swp file in this PR that should be removed. We could add .gitignore files on the repos if we think it makes sense.

project(dummy_map_server)

if(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra")
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.

Nit: please use -Wpedantic if complying with it is not too much work, same for every package of this PR

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rmw REQUIRED)
find_package(nav_msgs REQUIRED)
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.

Nit: alphabetical

<buildtool_depend>rosidl_default_generators</buildtool_depend>

<build_depend>rclcpp</build_depend>
<build_depend>nav_msgs</build_depend>
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.

alphabetical order, same below

@@ -0,0 +1,51 @@
#!/usr/bin/env python3
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.

avoid shebang lines for multiplatform compatibility

<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>

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.

should declare launch as an exec dependency

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

#include "rcl/rcl.h"
#include "rclcpp/rclcpp.hpp"

#include "nav_msgs/msg/occupancy_grid.hpp"
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.

Nit: this should go before the rcl* imports in alphabetical order, same below


#include "sensor_msgs/msg/laser_scan.hpp"

#define DEG2RAD M_PI / 180.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.

Nit: Should this macro be function-like rather than a scalar?

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.

Should math.h be included to use this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

copied from sick_lms code.

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.

Ok, while not changing the macro structure, I still think we should import math.h in here to use M_PI


#include "sensor_msgs/msg/joint_state.hpp"

#define DEG2RAD M_PI / 180.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.

Not used in this file

distance = std::abs(amplitude * std::sin(counter));

for (size_t i = 0; i < msg->ranges.size(); ++i) {
msg->ranges[i] = distance;
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.

Given that msg->intensities has been allocated memory accordingly, would it make sense to fill it too here ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it publishes 0 right now and are not necessary for the rviz demo.

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.

sounds good, in that case maybe we can get rid of / comment out L51

} else {
msg->header.stamp.sec =
static_cast<builtin_interfaces::msg::Time::_sec_type>(now.count() / 1000000000);
msg->header.stamp.nanosec = now.count() % 1000000000;
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.

@Karsten1987
Copy link
Copy Markdown
Contributor Author

Karsten1987 commented Mar 13, 2017

Thanks for the feedback!

I didn't use the new map_server as this code was written before williams PR was merged. I'll definitely plan on using it, have to create a dummy map. Do we have any tutorial like demo maps?

For the tutorial repo file, I am not sure. I don't know if we have a real policy on what goes in there and what not. I still think that the robot_state_publisher is a rather crucial ROS(1/2) package, which should be in master - IMHO.

I'll run the build jobs again, to make sure the pedantic flag doesn't cause any trouble.

@gerkey
Copy link
Copy Markdown
Member

gerkey commented Mar 13, 2017

@Karsten1987 if you're looking for an example map, the old Willow map is often helpful:

https://github.com/turtlebot/turtlebot_apps/tree/indigo/turtlebot_navigation/maps


#include "rcl/rcl.h"
#include "rclcpp/rclcpp.hpp"
#include "rcl/rcl.h"
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.

Nit: rcl before rclcpp was good. nav_msgs is the include I was referring to (that should be before the rcl* ones)

@Karsten1987
Copy link
Copy Markdown
Contributor Author

Tinyxml and Eigen3 chocolate packages can be found here:
https://github.com/ros2/choco-packages/releases

@Karsten1987 Karsten1987 added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Mar 22, 2017
@Karsten1987
Copy link
Copy Markdown
Contributor Author

Winner Winner Chicken Dinner!

Linux: Build Status
OSX: Build Status
Windows: Build Status

As mentioned in the previous comments, TinyXML and Eigen3 can simply be installed from brew or aptitude, for Windows we provide the choco packages.
I ran the demo successfully on Windows and piped it to RViz via the bridge!

@ros2/team If somebody could review that please.

Copy link
Copy Markdown
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

lgtm, though I just skimmed over it.

Only comment is that there is still a .swp file committed in there that should be removed.

@mikaelarguedas
Copy link
Copy Markdown
Member

👍 🎉

@Karsten1987 Karsten1987 merged commit 277e43c into master Mar 22, 2017
@Karsten1987 Karsten1987 removed the in review Waiting for review (Kanban column) label Mar 22, 2017
@Karsten1987 Karsten1987 deleted the dummy_robot_demo branch March 22, 2017 22:34
@wjwwood
Copy link
Copy Markdown
Member

wjwwood commented Mar 22, 2017

For the Windows one, do you think it would be better to specify that you mean to download the two .nuget files from that link? Or you could just link directly to the download of both.

Otherwise lgtm, thanks!

@Karsten1987
Copy link
Copy Markdown
Contributor Author

And finally the wiki page

https://github.com/ros2/ros2/wiki/dummy-robot-demo

file_path = os.path.dirname(os.path.realpath(__file__))


def launch():
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.

Wrong signature for a launch file (see #140).

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.

6 participants