Skip to content

Instantly share code, notes, and snippets.

@lucasw
Last active February 16, 2019 16:27
Show Gist options
  • Save lucasw/76a903f98bce3179da6282baf9021f30 to your computer and use it in GitHub Desktop.
Save lucasw/76a903f98bce3179da6282baf9021f30 to your computer and use it in GitHub Desktop.
ros2 notes

Updating many repositories to use ros2 bouncy: image_manip, usb_cam, v4l2ucp, imgui_ros

The intent is to develop/learn how to convert ros1 packages first along with the entire workflow of building and debugging and deploying and then take advantage of ros2 features.

Colcon

No verbose option? cd into build/package_name then run make VERBOSE=1 right there.

Does running a release build (using a mixin) then forgetting to specify release the next time clobber all the old built files, requiring a complete rebuild?

Likewise with debug builds.

Lack of devel half-way install space is annoying, though forces proper install of necessary files from beginning.

Can edit a yaml then ros launch and immediately see results, have to colcon build it, and possibly re-source the install/setup.bash if a new file was created.

--symlink-install is solution to above- it installs with symlinks to files in source, so scripts and yamls can be run with new changes without reinstall.

Debugging

gdb attach to process is probably the right approach rather than figuring out how to launch/run processes with all the arguments in gdb.

The process node composition plays in there, if only want to debug one node and let the rest run full speed then need to leave that node out, or run all of them in separate processes. or

Python rclpy

One node took up a lot of cpu to do very little. ros1 had that probably but only 10% cpu instead of nearly 100%. Probably there is an easy fix but for now using mostly C++ since performance is the goal anyhow.

Where python will be useful is for initial configuration scripts that launch and end, maybe python will be better at figuring out parameters of other nodes, or what the contents of custom messages are.

Messages and Services

Have made a few custom services and they work fine. async response approach looks ideal for user interfaces, but haven't used it yet.

Need the same ability for at least python to encounter a new message/service and peel it apart.

Parameters

Setting parameters in launch file is very roundabout- writing yaml files to /tmp. Not sure how to get arguments into the launch.py file (just look at sys.argv?)

Not updating parameters live anywhere, mostly using them like in ros1 and only updating at node init time.

Not sure if high frequency parameter updating is okay now in ros2.

Replacing dynamic reconfigure with individual basic type topic subscription mostly. It gets repetitive, probably will end up making convenience functions to help there, maybe even reinvent the dynamic reconfigure wheel with a yaml configured class that is a member of any class that wants to use it.

Or parameters turn out to be easy and convenient for this. Certainly certain controls ought to be topics - floats and ints that can change rapidly, while text boxes for configuration and enables and disables can be slower parameter updates- both of those tended to be commingled because it was convenient in .cfg files in the past.

Process composition

Not sure what currently launch file approach is doing here. Want to be able to package nodes into single processes for efficiency later.

usb_cam

ros-drivers/usb_cam#103

usb_cam - would this be better off with a new name to clearly delineate from uvc_camera, v4l_camera or v4l2_camera would be better (though it doesn't necessarily have to be a camera).

Haven't seen any responses to the issue, raise something on discourse? orphaned packages group? Send messages to maintainers?

It is grabbing images super slow, haven't debugged yet.

v4l2ucp

lucasw/v4l2ucp#4

Probably should rename this to v4l2_control, it doesn't have much to do with old v4l2ucp now.

Need to resolve parameters vs. topics, right now it is all topics. No camera control ought to be changed that frequently, so here dynamic parameters ought to be enough.

Image Manip

Don't necessarily convert all the nodes, just ones needed immediately.

lucasw/image_manip#6 lucasw/image_manip#11

Not useing unique_ptrs yet, revisit this later to increase performance. TBD insert link to page that shows pointers being inserted as text into images to show where they are getting copied in a chain of nodes.

Simulation and Visualization

May update simple_sim_ros next (maybe rename it to bullet_ros also).

Need to look at ros2 rviz - update rviz_textured_quads, rviz_lighting, and rviz_camera_stream.

UI

imgui_ros

lucasw/imgui_ros#19

Need to develop imgui_ros more.

How to introspect nodes for parameters, then create a bunch of imgui widgets to set them (if they can even be set live).

Need to look at docking. Want to use docking to create ini file then disable it (via default parameter) for normal usage. (also disable the multi view port stuff for now).

Need to stretch ui components to fill window, and have changes to that window stretch components inside- probably easy to do.

@lucasw
Copy link
Author

lucasw commented Dec 16, 2018

Crystal

Fresh system with no previous bouncy install.

For image_manip, v4l2ucp, usb_cam, imgui_ros

sudo apt install ros-crystal-cv-bridge libv4l-dev libsdl2-dev libglm-dev ros-crystal-tf2-sensor-msgs

@lucasw
Copy link
Author

lucasw commented Dec 16, 2018

Update bouncy system to crystal

Can keep bouncy around.

sudo apt install ros-crystal-desktop ros-crystal-cv-bridge ros-crystal-tf2-sensor-msgs

Make a new workspace just for crystal, can go to the other for bouncy.

mkdir -p ~/ros/crystal_colcon_ws/src
cd ~/ros/crystal_colcon_ws/src
git clone -b bouncy https://github.com/lucasw/v4l2ucp
git clone -b bouncy https://github.com/lucasw/usb_cam
git clone -b bouncy https://github.com/lucasw/image_manip
git clone -b bouncy https://github.com/lucasw/imgui_ros
cd imgui_ros/imgui_ros
git clone https://github.com/ocornut/imgui

@lucasw
Copy link
Author

lucasw commented Dec 18, 2018

colcon isn't installing scripts properly in crystal, or building packages as expected (probably related).
Changing a script then running colcon build --packages-select imgui_ros doesn't result in the new version of the script getting installed
(symlink install may avoid this).

Go back to bouncy for now.

@lucasw
Copy link
Author

lucasw commented Jan 12, 2019

Using a size_t for set_parameter_if_not_set instead of int results in:

cpp:33:
/opt/ros/crystal/include/rclcpp/parameter.hpp: In instantiation of ‘rclcpp::Parameter::Parameter(const string&, ValueTypeT) [with ValueTypeT = long unsigned int; std::__cxx11::string = std::__cxx11::basic_string<char>]’:
/opt/ros/crystal/include/rclcpp/node_impl.hpp:222:17:   required from ‘void rclcpp::Node::set_parameter_if_not_set(const string&, const ParameterT&) [with ParameterT = long unsigned int; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/home/lucasw/colcon_ws/src/imgui_ros/imgui_ros/src/test/generate_pointcloud2.cpp:45:55:   required from here
/opt/ros/crystal/include/rclcpp/parameter.hpp:43:21: error: call of overloaded ‘ParameterValue(long unsigned int&)’ is ambiguous
   : Parameter(name, ParameterValue(value))
                     ^~~~~~~~~~~~~~~~~~~~~
In file included from /opt/ros/crystal/include/rclcpp/parameter.hpp:25:0,
                 from /opt/ros/crystal/include/rclcpp/node_interfaces/node_parameters_interface.hpp:26,
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment