Comments (5)
I guess the problem here is that the node checks if the topic is already there and then subscribes it.
Well if you launch it in a launchfile probably the node of the scan merger is launched in the beginning... topics not there ... topics not subscribed
change the topic parser function like this, and it should work, as far as it does ...
void LaserscanMerger::laserscan_topic_parser()
{
// LaserScan topics to subscribe
ros::master::V_TopicInfo topics;
ros::master::getTopics(topics);
istringstream iss(laserscan_topics);
vector<string> tokens;
copy(istream_iterator<string>(iss), istream_iterator<string>(), back_inserter<vector<string> >(tokens));
vector<string> tmp_input_topics;
for(int i=0;i<tokens.size();++i)
{
// for(int j=0;j<topics.size();++j)
// {
// if( (tokens[i].compare(topics[j].name) == 0) && (topics[j].datatype.compare("sensor_msgs/LaserScan") == 0) )
// {
tmp_input_topics.push_back(tokens[i]);
// }
// }
}
from ira_laser_tools.
change the topic parser function like this, and it should work, as far as it does ...
I've bump into the same problem, and thanks to @cyborg-x1, the fix worked. Guess this behavior is more desirable considering the ROS philosophy....
from ira_laser_tools.
try this fix: https://answers.ros.org/question/225183/ira_laser_tools-merger-doesnt-subscribe-to-topics-from-laser-in-gazebo/
Basically he adds a success return value and loops over laserscan_topic_parser()
until the topics are published.
from ira_laser_tools.
try this fix: https://answers.ros.org/question/225183/ira_laser_tools-merger-doesnt-subscribe-to-topics-from-laser-in-gazebo/
Basically he adds a success return value and loops over
laserscan_topic_parser()
until the topics are published.
I saw that thread and tried to make that fix. I feel like I'm doing it wrong. Could you post the modified source code or help me find where exactly im supposed to add this ros::Rate loop_rate(0.5); //-- 0.5 [Hz] -> 2.0 [s] while( !this->laserscan_topic_parser() ) { ROS_DEBUG("LaserscanMerger: Retrying to detect the topics to subscribe to..."); loop_rate.sleep(); }
Thanks
from ira_laser_tools.
// LaserScan topics to subscribe
ros::master::V_TopicInfo topics;
ros::master::getTopics(topics);
istringstream iss(laserscan_topics);
vector<string> tokens;
copy(istream_iterator<string>(iss), istream_iterator<string>(), back_inserter<vector<string> >(tokens));
vector<string> tmp_input_topics;
while(tokens.size() != tmp_input_topics.size())
{
ros::master::getTopics(topics);
for(int i=0;i<tokens.size();++i)
{
for(int j=0;j<topics.size();++j)
{
if( (tokens[i].compare(topics[j].name) == 0) && (topics[j].datatype.compare("sensor_msgs/LaserScan") == 0) )
{
tmp_input_topics.push_back(topics[j].name);
}
}
}
sort(tmp_input_topics.begin(),tmp_input_topics.end());
std::vector<string>::iterator last = std::unique(tmp_input_topics.begin(), tmp_input_topics.end());
tmp_input_topics.erase(last, tmp_input_topics.end());
ROS_INFO_STREAM_THROTTLE(2.0, "Laserscan merger waiting for specified input topics. " << tmp_input_topics.size() << "/" << tokens.size() << " input topics found");
if(tokens.size() == tmp_input_topics.size()) //Do not sleep if all input topics are found
{
break;
}
ros::Duration(1.0).sleep();
}
// Do not re-subscribe if the topics are the same
if( (tmp_input_topics.size() != input_topics.size()) || !equal(tmp_input_topics.begin(),tmp_input_topics.end(),input_topics.begin()))
{
....
This fix works for me. Waits until all input topics are available, and outputs a throttled ROS_INFO to let a user know how many of its selected input topics are available and how many are still to come.
from ira_laser_tools.
Related Issues (20)
- Using this package, is it possible to merge two scans lying in 2 different planes?
- GNU C Compiler Warnings jenkis build.ros.org HOT 1
- Intensity of the lasers HOT 3
- Not being able to work with gmapping node HOT 1
- laserscan_visualizer - configuring range not working HOT 9
- Error of double free or corruption HOT 1
- The merge is so slow HOT 11
- Laser Merger doesn't compute range data (fixed value) HOT 1
- Release for ROS noetic HOT 2
- Unable to roslaunch laserscan_multi_merger when launch file is run in a different package HOT 3
- Unable to get merged cloud topic DATA
- Use latest timestamp in laser merger scan publish HOT 1
- ROS2 port HOT 1
- ROS2/foxy Support HOT 7
- use of last version on noetic HOT 4
- Is this project only simple merge laser data not transform coordinate HOT 1
- set range_max to inf or any value
- Two RPLIDAR's A1 orientation problem
- slam_toolbox can't build a map using multi-laser output data HOT 2
- Inconsistent map generation when using Gmapping
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ira_laser_tools.