Hello everyone,
I have an issue with my parameters, when I launched my launch file where I load the yaml file, I can see that parameters from the yaml file are being loaded to the parameter server. When I get this values with rosparam get structure, everything is fine.
In the terminal, I got the first time the good values :
PARAMETERS
* /rosdistro: kinetic
* /rosversion: 1.12.14
* /structure/angle: 120
* /structure/bras: 3
* /structure/longueur: 550
But, when loading inside my code, I get this odd values :
angle : 32767, bras : -429406320, longueur : 0
Part of my code where I get these values from the parameter server.
int bras;
int angle;
int longueur;
if (nh.param("/structure/angle", angle) && nh.param("/structure/bras", bras) && nh.param("/structure/longueur", longueur))
{
cout << "angle : " << angle << ", bras : " << bras << ", longueur : " << longueur << endl;
if (bras*angle > 360) {
cout << bras*angle << endl;
ROS_ERROR("Erreur sur le nombre de bras ou l'angle entre les bras de la structure.");
}
}else {
ROS_ERROR("Erreur chargement paramètres structure.");
}
I am loading inside this code, some other parameters, but there are fine :
int wantedId;
std::string topicFiducial;
nh.param<std::string>("topicFiducial", topicFiducial, "aruco_detect/fiducial_transforms");
nh.param<int>("wantedId", wantedId, 42);
I am using Kinetic with Ubuntu 16.
Originally posted by oiseau on ROS Answers with karma: 32 on 2019-01-28
Post score: 0
Original comments
Comment by curi_ROS on 2019-01-28:
It might be because you haven't initialised the variables bras, angle, longeuer
Comment by oiseau on 2019-01-28:
When initialized to zero, I don't get odd values, but I don't get the good values too, only zero. The parameter exits, because I am not getting any error.