Hello @hanikevi , I added custom message package for observer at 220617e4 (with a small modificaiton of 0ada475b).
In general (local) ROS environment, when we make our own custom message package and build, the related header file is located in ~/catkin_ws/devel/include/<package-name>, so that we can use that message for publish and subscribe btwn nodes.
Since I've been working on implementation of observer node in Nix environment, I am not sure about how my observer node (in Nix env) can communicate with franka's impedance controller which is built in "local" Converging PC workspace.
If I added my custom message package in flake.nix like below, will nix develop command somehow build the message package and make related header file so that I can use it?
rosPackages = with rospkgs; [ ros-core catkin std-msgs sensor-msgs geometry-msgs message-generation message-runtime ## for impedance controller #franka-hw #combined-robot-hw #joint-limits-interface #controller-interface #actionlib ## standard #control-msgs # needed for JointTrajInterface #moveit-msgs franka-msgs urdf ## custom observer-msgs ];
If so, I think I should edit CMakeLists.txt and package.xml of franka_example_controllers package for "local" franka's impedance controller to publish or subscribe topics of ObserverState.msg. Should I just specify a path where a header file of observer_msgs package is installed in /nix/store and add it for CMakeLists.txt as below?
CMakeLists.txt
cmake_minimum_required(VERSION 3.4)project(franka_example_controllers)set(${OBSERVER_STATE_INCLUDE_DIRS} /nix/store/<path-where-custom-message-package-installed>/include )# ...target_include_directories(franka_example_controllers SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS} ${OBSERVER_STATE_INCLUDE_DIRS})# ...
The 'ros' solution is to distribute your observer_msgs package in parallel with the observer, so that others (e.g. the local catkin workspace on converging PC) can build and view your messages. Looking at your message format, it would also be possible to just publish as independent topics, but this makes recording them more difficult and has a bit more overhead.
What is the communication you need with the impedance controller? In the future, we're planning that you have an impedance controller, but I would suggest that this gets developed in the Nix environment so we can have a simple install for it. However, if you'd like to get your message defs into the local workspace, I'd suggest you separate out the msg defs and add that to the local catkin workspace and build locally. One possible way to do this is to stay with a single repo here and do a sparse checkout in the local workspace to get just the directory with your message package.
Oh, do you mean that it would be better to integrate the format of franka's cartesian_impedance_example_controller with the current observer package in the Nix environment into a single package?
I think I misunderstood. I was thinking that: after completing the observer validation offline, I should build this package on the Converging PC, and run the observer node in Nix environment, while cartesian_impedance_example_controller node runs from the local environment in a separate shell. So I thought I would need to make a message package btwn observer node (in the Nix shell) and impedance controller node (in the local workspace shell) should be built.
However, if the franka_ros package is to be integrated with the observer in the Nix environment, then clearly, observer_msgs package is no more for communication btwn observer and impedance controller, cause they will handle signals internally within a single node.
Thank you for your correction! If I have misunderstanding, please let me know =)
I think putting the impedance controller here or using the existing one is fine, you could choose which one you decide is best.
I was thinking long-term, probably you will write your own impedance controller and, for me, it would make sense to have this new impedance contorller as a package or node in this git repository.
If you just want to test quickly using the existing cartesian_impedance_example_controller, you could add the observer_msgs to the converging workspace pretty easily.
I understand it. I also agree that in the long term, implementing the impedance controller integrated with observers as a separate package (rather than using the existing cartesian_impedance_example_controller) would be better in terms of reproducibility and maintainability.
I added both observer_msgs and pkg_offline_observer as ros packages in the nix environment on this branch. This means, with the nix develop command, you have the ros packages directly available and can do rosrun ImpedanceController ImpedanceController_node. This has as disadvantage that the caching/rebuilding is on the package level, so if you touch any file in pkg_offline_observer, it'll trigger a rebuild. Probably just doing a local cmake is better until we stabilize the code, then we can merge these changes here in.
One tricky point was getting the common imports to work.
77426e39 this commit makes common into a header-only library, basically. It works, but might be less elegant
e79a5c83 here I tried to make common into a shared library, but it has a runtime error so I think I'm exporting something wrong.
I don't think we need to merge this branch, just as reference if you'd like to add any custom ros packages to the nix environment.
As of a542c5fa builds and runs. Was missing some linked deps for the shared library. Right now there's two nix shells,
.#default which has common as a library in the shell environment, and
.#prebuilt, where you can do nix develop .#prebuilt --command rosrun ImpedanceController ImpedanceController_node. Or just enter the .#prebuilt and afterwards run the ros executable.
Hello @hanikevi , I hope that you have a great time during holidays. Thank you for providing a solution for adding custom ros package in nix environment. I found that, when I compared data btwn Franka state and FT sensor that I obtained during contact experiment, it was quite hard to induce some meaningful conclusion, cause I guess the contact force, that is made by the interactive marker via RViz, was so trivial.
Also, I guess there're some bugs in the estimation of DOB and SOSML that I implemented fundamentally. So, I was working on debugging the observers' code by applying a free-space motion and perturbation in the simulation here, that you provided.
I did some code refactoring for the offline observer to integrate with impedance controller and to separate subscriber's callback function and main loop at feature/5-observer-implementation branch. Since, until now, I used standard ROS messages like geoemtry_msgs::Twist, geometry_msgs::Accel and so on, there's lots of publishers and subscribers in the code, but thanks to you I can further simplify code.
After I debug and stabilize the codes, I would be able to merge the branches for a clean repository structure. I will keep update for the results.
Thank you for everything you provided for me. You must spent quite lots of time and effort for it, cause my repo's structure is quite complicated.
Hi Jeong, thanks for pushing those. After thinking, it looked easier to directly add the packaging in 9-..., which I started in 202ae324. However, I was hitting a lot of build errors (e.g. needed to add imports to sensor_msgs/Joy.h) so I wasn't sure if the code you pushed there is what was building locally. Could you check and let me know? Once we fix the CMakeLists.txt and source files so they compile, looks like everything is working in Nix, fr3_impedance_controller_real will get built as a ros pacakge in the nix env.