How to implement the robot body filter?
Hey everybody,
I'm stuck on the implementation of the Robot Body Filter (https://github.com/peci1/robot_body_f...) I want to self filter my robot from an RGBD-Image/pointcloud2 (Realsense D435i) but I don't know how to set up the filter. I've seen lines of C++-code but I would like to get this done within a launch-file. But I can't find any tutorials or examples of that. I'm using ROS Melodic on an Ubuntu 18.04
Maybe someone could point me in the right direction.
Thank you!
Update:
Hey ahedfares89,
thanks for your reply. I tried to apply your manual but got stuck. It's probably more of an C++-problem (I'm more the python guy). Maybe you can spot the wrong thinks. I tried different ways to implement your answer but non of them worked.
#include "ros/ros.h"
#include "sensor_msgs/PointCloud2.h"
#include "filters/filter_chain.h"
#include <ros/console.h>
class robot_body_filter
{
filters::FilterChain<sensor_msgs::PointCloud2> filter_chain_;
public:
robot_body_filter()
{
pub_ = n_.advertise<sensor_msgs::PointCloud2>("/camera/depth/color/points_filtered", 1);
sub_ = n_.subscribe("/camera/depth/color/points", 1, &robot_body_filter::callback, this);
}
void callback(const sensor_msgs::PointCloud2& input)
{
sensor_msgs::PointCloud2 output;
filter_chain_.update(input, output);
pub_.publish(output);
}
private:
ros::NodeHandle n_;
ros::Publisher pub_;
ros::Subscriber sub_;
};
int main(int argc, char **argv)
{
ros::init(argc, argv, "load_filter_chain");
robot_body_filter rbf;
rbf.configure("cloud_filter_chain");
ros::spin();
return 0;
}
Thanks in advance.
Robert
Hello! In the wiki page (http://wiki.ros.org/robot_body_filter) You can find all the filter params. Just add them as you choose in your launch file! It this what are you asking for?
I've seen the params but where/how do I specify the sensor_msgs/PointCloud2-stream that is comming from my Camera?
I am not sure because I didn't work with this, but checking the page it says that this filter is dependant to filters:FilterBase API (in 3.1) and is compatible with filterchain. Checking at filters web (http://wiki.ros.org/filters) there is a filterschain explanation which should be a good way to apply that.
I've already tried to implement the filter chain but with no success. The documentation could be improved. I also wasn't able to find any working examples. I was hoping that there would be an alternativ way just by implementing the filter in a launch file. Well I guess I first have to get the filterchain-C++-Script up and running.
just checking a little i have the same impression as you. hope someone can help you! :)
Not an answer to your question but you could also try realtime_urdf_filter
Thank you. As you can see here: http://official-rtab-map-forum.206.s1... I did exactly that. Maybe not the most elegant or most efficent way but working. Still looking for a working example of an implemented filter.
Hello Robert, did you manage to implement the filter? Id have some questions too