Open sunt40 opened 4 years ago
Make ratslam subscribe one more node, such as semantic information node, to improve its map accuracy.But I don't know how to add ROS nodes for ratslam.
You can subscribe to any of the RatSLAM topics. E.g.,
import rospy
from ratslam_ros.msg import TopologicalMap
rospy.init_node("ratslam_map_subscriber")
def on_receive_map(map):
print(map)
sub_ratslam_map = rospy.Subscriber(
"/irat_red/ExperienceMap/Map",
TopologicalMap,
on_receive_map
)
rospy.spin()
Note in this case RatSLAM only writes the map out at 30 second intervals. You might want to change this line "if (action->header.stamp - prev_pub_time > ros::Duration(30.0))" to set a different duration.
There is a lot of info in our OpenRatSLAM paper about the software architecture (search Google scholar for OpenRatSLAM). Fig. 2 in our OpenRatSLAM paper shows the ROS connections between nodes by message type and descriptions of messages. You can also run
rostopic info
while RatSLAM is running to get a list of the topics used in the system.
I think I need to modify and add some node names which ratslam subscribes.Which files should I modify?
Can you give me your email or other contact information for the convenience of communication. Recently I have some problem about ratslam and I'm sure you can give me a lot of help. @scott--
All the ROS interfaces are in the main*.cpp files.
You can do a search for subscriptions and publishing like this.
grep -E -R -n "subscribe[\(|\<].*\)" .
./ratslam_ros/src/main_em.cpp:279: ros::Subscriber sub_odometry = node.subscribe
grep -E -R -n "advertise[\(|\<].*\)" .
./ratslam_ros/src/main_em.cpp:272: pub_em = node.advertise
Can you give me your email or other contact information for the convenience of communication.
All of these comments get emailed to me already, but as I am not currently working in this space, I only answer them when I get time.
OK.Thank you very much.
I want ratslam's experience map node to subscribe to an extra topic . How to change it in main_em.cpp ?
Subscribing to another topic is exactly the same as standard ROS. You would just add the following:
void callback(MsgTypeConstPtr msg, other_arguments ...) { }
Then inside main():
ros::Subscriber sub_new_topic = node.subscribe<MsgType>(topic, 0, boost::bind(callback, _1, other_arguments ...), ros::VoidConstPtr());
You'll need to lookup the ROS tutorials for message generation, boost::bind, etc
OK. Thank you a lot!
What is the purpose of adding another node? You can add a new ROS node in the same way as any other ROS system (https://wiki.ros.org/ROSNodeTutorialC++).