I'm trying to use data from a yaml file in a ROS(kinetic)/ c++ code so yaml-cpp seems like a good option for me. My code yields no errors but does not work properly:
It seems like the YAML::LoadFile
function is not able to find my file since the following lines go to exception:
YAML::Node yamlnode_;
try{
yamlnode_= YAML::LoadFile("../yaml_file.yaml");
}
catch(std::exception &e){
ROS_ERROR("Failed to load yaml file");
}
Including yaml-cpp via
#include <yaml-cpp/yaml.h>
seems to work since YAML:: functions are recognized afterwards.
The path ../yaml_file.yaml
is set up correctly which I also checked in program via
#include "../yaml_file.yaml"
which yields parsing errors (as expected) which show me that the correct file was found (but obviously cannot be included).
The yaml_file.yaml is used successfully in multiple .xacro files.
Keep in mind that I am somewhat new to ROS and yaml-cpp; I'm looking forward to see your questions and answers