Giter VIP home page Giter VIP logo

Comments (27)

MatthijsBurgh avatar MatthijsBurgh commented on July 23, 2024

This error message is coming from tue_config. I don't know why you get it. Because I don't get it. Not when passing as argument to ed directly and not when using the configure node.

So it might be an issue with whitespace, So please make sure you are using all spaces and run a yaml linter.

As a final test run rosrun tue_config test_yaml_and_show <absolute_path_to_config>

from ed.

zerolatnc avatar zerolatnc commented on July 23, 2024

I used the yamllint package to check the config file and it threw some errors about indentation and also that there were too many spaces inside the braces. After correcting these, I have the following config file:

world:
  - id: block1
    pose: {x: 2, y: 0, z: 0.5}
    shape:
      box:
        size: {x: 0.5, y: 0.5, z: 1}
  - id: block2
    pose: {x: 3, y: 2, z: 0.75}
    shape:
      box:
        size: {x: 0.5, y: 0.5, z: 1.5}

plugins:
  - name: gui_server
    lib: libed_gui_server_plugin.so

Running the linter now gives me only one warning: warning: missing document start "---" (document-start)

But running rosrun tue_config test_yaml_and_show <absolute_path_to_config> still gives me the same error.

I have an old docker image of ros:melodic-robot from about 8 months ago, and when I use that image, this error interestingly doesn't show up.

from ed.

MatthijsBurgh avatar MatthijsBurgh commented on July 23, 2024

Could you check your yaml-cpp version on your system and in the docker?

from ed.

zerolatnc avatar zerolatnc commented on July 23, 2024

It is libyaml-cpp0.5v5 in the docker container. On my host pc, I don't have yaml-cpp.

from ed.

MatthijsBurgh avatar MatthijsBurgh commented on July 23, 2024

Could please install libyaml-cpp-dev? I have 0.5.2-4ubuntu1

from ed.

zerolatnc avatar zerolatnc commented on July 23, 2024

I had it installed earlier. I had both libyaml-cpp-dev and libyaml-cpp0.5v5.

Now, I removed both of them and tried to install libyaml-cpp-dev again. Installing libyaml-cpp-dev also installs libyaml-cpp0.5v5.

root@aa72d705efa4:/usr/share/doc# apt install libyaml-cpp-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  curl libegl1-mesa libfreeimage3 libjxr0 libogre-1.9-dev libogre-1.9.0v5 libraw16 libzzip-0-13
  pyqt5-dev python-pyqt5 python-pyqt5.qtsvg ros-melodic-image-transport ros-melodic-interactive-markers
  ros-melodic-laser-geometry ros-melodic-map-msgs ros-melodic-media-export
  ros-melodic-python-qt-binding ros-melodic-resource-retriever
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  libyaml-cpp0.5v5
The following NEW packages will be installed:
  libyaml-cpp-dev libyaml-cpp0.5v5
0 upgraded, 2 newly installed, 0 to remove and 19 not upgraded.
Need to get 342 kB of archives.
After this operation, 1829 kB of additional disk space will be used.
Do you want to continue? [Y/n]

The version of libyaml-cpp-dev is the same as yours:

root@aa72d705efa4:/# apt list libyaml-cpp-dev
Listing... Done
libyaml-cpp-dev/bionic,now 0.5.2-4ubuntu1 amd64 [installed]

But the error persists.

from ed.

MatthijsBurgh avatar MatthijsBurgh commented on July 23, 2024

Please try to start ed without a config. And call the configure service with the absolute path of your config file.

from ed.

zerolatnc avatar zerolatnc commented on July 23, 2024

Here is the output:

root@aa72d705efa4:~/catkin_ws# rosservice call /ed/configure "request: '/root/catkin_ws/src/test.yaml'" 
error_msg: "In 'world': \n\n    Sequences must only contains maps\n\n\n\nIn root of configuration:\n\
  \n    Root of the config file must be a map.\n\n"

from ed.

MatthijsBurgh avatar MatthijsBurgh commented on July 23, 2024

I really have no idea. I suggest you clean the build and build again.

from ed.

zerolatnc avatar zerolatnc commented on July 23, 2024

So you are not getting this error when you use the ros:melodic-robot docker image?

from ed.

MatthijsBurgh avatar MatthijsBurgh commented on July 23, 2024

I have limited diskspace, I am not able to test with Docker on this machine.

from ed.

zerolatnc avatar zerolatnc commented on July 23, 2024

Okay. Anyway, thanks for your help!

from ed.

Maik13579 avatar Maik13579 commented on July 23, 2024

Hey, is there a solution for this issue by now?

I have the same problem with ros noetic.

Here is my dockerfile

ARG ROS_WS=/root/catkin_ws

FROM ros:noetic as base
ARG ROS_WS
ENV ROS_WS $ROS_WS
ENV DEBIAN_FRONTEND noninteractive
SHELL ["/bin/bash", "-c"]
COPY docker/ros_entrypoint.sh /ros_entrypoint.sh
ENTRYPOINT ["/ros_entrypoint.sh"]
WORKDIR $ROS_WS
RUN source /opt/ros/$ROS_DISTRO/setup.bash && mkdir src && catkin_make
RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> /root/.bashrc
RUN echo "source $ROS_WS/devel/setup.bash" >> /root/.bashrc

FROM base as ed
ARG ROS_WS
ENV ED_PLUGIN_PATH $ROS_WS/devel/lib
ENV ED_MODEL_PATH $ROS_WS/src/iki_object_models/models
WORKDIR $ROS_WS/src/tue-robotics
RUN apt update \
 && apt upgrade -y \
 && apt install --no-install-recommends -y \
    git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/ed.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/ed_object_models.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/ed_msgs.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/code_profiler.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/geolib2.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/rgbd.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/tue_config.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/tue_filesystem.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/tue_serialization.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/ed_gui_server.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/ed_rviz_plugins.git \
 && apt purge -y \
    git \
 && rm -rf /var/lib/apt/lists/*

WORKDIR $ROS_WS

RUN apt update \
 && apt install -y \
    libsdformat6-dev \
 && rosdep update \
 && rosdep install --from-paths src --ignore-src -r -y \
 && rm -rf /var/lib/apt/lists/*
WORKDIR $ROS_WS/src/
COPY iki_object_models iki_object_models
WORKDIR $ROS_WS
RUN source /opt/ros/$ROS_DISTRO/setup.bash && catkin_make                           

libyaml-cpp versions are:

libyaml-cpp-dev/now 0.6.2-4ubuntu1 amd64 [installed,local]
libyaml-cpp0.6/now 0.6.2-4ubuntu1 amd64 [installed,local]

My current approach

When running ed with a config file:

rosrun ed ed <path/to/my-ed-config.yaml>

It raises this error:

[ERROR] [1666879062.282182368]: 
Error during configuration:

In 'world': 

   Sequences must only contains maps

Error comes from this function in tue_config/src/loaders/yaml.cpp:

bool loadFromYAMLNode(const YAML::Node& node, ReaderWriter& config)
{
    bool success = true;
#ifdef YAML_VERSION_0_3
    for(YAML::Iterator it = node.begin(); it != node.end(); ++it)
    {
        std::string key;
        it.first() >> key;
        const YAML::Node& n = it.second();
#else
    for(YAML::const_iterator it = node.begin(); it != node.end(); ++it)
    {
        std::string key = it->first.as<std::string>();
        const YAML::Node& n = it->second;
#endif

        switch (n.Type())
        {
        case YAML::NodeType::Scalar:
        {
            if (!yamlScalarToVariant(key, n, config))
                success = false;
            break;
        }
        case YAML::NodeType::Sequence:
        {
            config.writeArray(key);

#ifdef YAML_VERSION_0_3
            for(YAML::Iterator it2 = n.begin(); it2 != n.end(); ++it2)
#else
            for(YAML::const_iterator it2 = n.begin(); it2 != n.end(); ++it2)
#endif
            {
                const YAML::Node& n2 = *it2;
                if (n2.Type() != YAML::NodeType::Map)
                {
                    config.addError("Sequences must only contains maps");
                    return false;
                }
                else
                {
                    config.addArrayItem();
                    loadFromYAMLNode(n2, config);
                    config.endArrayItem();
                }
            }

            config.endArray();

            break;
        }
        case YAML::NodeType::Map:
            config.writeGroup(key);
            loadFromYAMLNode(n, config);
            config.endGroup();
            break;
        case YAML::NodeType::Null:
            break;
        }
    }

    return success;
}

By changing the error output to:

config.addError(std::to_string(n2.Type()) + " != " + std::to_string(YAML::NodeType::Map));

we get this error:

1 != 4

From the Headerfile we get the values:

enum value { Undefined, Null, Scalar, Sequence, Map };

So instead of a yaml node of type "Map" there is type "Null"

I'm not really good at C++ so I'm asking for help here.

from ed.

MatthijsBurgh avatar MatthijsBurgh commented on July 23, 2024

Indeed the config file is parsed in tue_config. The easiest way to test is: rosrun tue_config test_yaml_and_show <your_config>.yaml.

Could provide a config file that generates this error? Please attach the file instead of pasting it. As using a combination of spaces/tabs can also cause issues.

from ed.

Maik13579 avatar Maik13579 commented on July 23, 2024

I am using this config.

rosrun tue_config test_yaml_and_show /config/my-ed-config.yaml
1
1
1
Error: While parsing '/config/my-ed-config.yaml':

In 'world': 

    Sequences must only contains maps

from ed.

MatthijsBurgh avatar MatthijsBurgh commented on July 23, 2024

I am also running yaml-cpp at 0.6.2. The config does not provide me with any errors.

from ed.

Maik13579 avatar Maik13579 commented on July 23, 2024

I started printing out different values to see if there was anything weird:

                if (n2.Type() != YAML::NodeType::Map)
                {
                    config.addError(node.Tag()+std::to_string(node.Type()));
                    config.addError(it->first.as<std::string>());
                    config.addError(it2->first.as<std::string>());
                    config.addError(n.Tag()+std::to_string(n.Type()));
                    config.addError(n2.Tag()+std::to_string(n2.Type()));
                    config.addError(std::to_string(n2.Type()) + " != " + std::to_string(YAML::NodeType::Map));
                    config.addError("Sequences must only contains maps");
                    return false;

And now its working.... extremely weird ^^

from ed.

Maik13579 avatar Maik13579 commented on July 23, 2024

Got it down to this line:

                    config.addError(it2->first.as<std::string>());
                    config.addError("Sequences must only contains maps");
                    return false;

Just by adding config.addError(it2->first.as<std::string>()); (above line 172) it starts working.

from ed.

MatthijsBurgh avatar MatthijsBurgh commented on July 23, 2024

I assume you added it before the if condition.

But I have no clue what the real cause and/or solution is.

from ed.

Maik13579 avatar Maik13579 commented on July 23, 2024

No that is the weird part, I added it inside the if block. The code is never executed, because if it were executed, the error would occur.

#ifdef YAML_VERSION_0_3
            for(YAML::Iterator it2 = n.begin(); it2 != n.end(); ++it2)
#else
            for(YAML::const_iterator it2 = n.begin(); it2 != n.end(); ++it2)
#endif
            {
                const YAML::Node& n2 = *it2;
                if (n2.Type() != YAML::NodeType::Map)
                {
                    config.addError(it2->first.as<std::string>());
                    config.addError("Sequences must only contains maps");
                    return false;
                }
                else
                {
                    config.addArrayItem();
                    loadFromYAMLNode(n2, config, resolve_config);
                    config.endArrayItem();
                }
            }

I dont know about the building process of c++, but somehow this line makes a different.

from ed.

MatthijsBurgh avatar MatthijsBurgh commented on July 23, 2024

This sounds very odd. Could you maybe provide some info about your system and compiler. Maybe we can find a difference.

from ed.

Maik13579 avatar Maik13579 commented on July 23, 2024
lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.2 LTS
Release:	20.04
Codename:	focal
uname -r
5.4.0-131-generic
docker --version 
Docker version 20.10.6, build 370c289

I used the ros:noetic image.

from ed.

MatthijsBurgh avatar MatthijsBurgh commented on July 23, 2024

This roughly matches my system. Though I am running the master branch, not the 2022-before-rwc tag. But also the tag works on my machine. Could you create a simple Dockerfile for consistent testing.

The most important info is missing, what compiler do you use?

from ed.

Maik13579 avatar Maik13579 commented on July 23, 2024

Yes especially when it comes to docker I always use the "newest" tag, because you never know what is still happening on the master branch.

Unfortunately I don't know anything about the compiler. I use the ros:noetic image and build the packages with catkin_make. But with the Dockerfile below you can check it yourself.

Here is the dockerfile that generates the error for me.

FROM ros:noetic
ENV DEBIAN_FRONTEND noninteractive
SHELL ["/bin/bash", "-c"]
ENV ED_PLUGIN_PATH /root/catkin_ws/devel/lib
WORKDIR /root/catkin_ws/src/tue-robotics
RUN apt update \
 && apt upgrade -y \
 && apt install --no-install-recommends -y \
    git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/ed.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/ed_object_models.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/ed_msgs.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/code_profiler.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/geolib2.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/rgbd.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/tue_config.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/tue_filesystem.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/tue_serialization.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/ed_gui_server.git \
 && git clone --branch 2022-before-rwc https://github.com/tue-robotics/ed_rviz_plugins.git \
 && rm -rf /var/lib/apt/lists/*
WORKDIR /root/catkin_ws
RUN apt update \
 && apt install -y \
    libsdformat6-dev \
 && rosdep update \
 && rosdep install --from-paths src --ignore-src -r -y \
 && rm -rf /var/lib/apt/lists/*
RUN source /opt/ros/$ROS_DISTRO/setup.bash && catkin_make
RUN echo "source /root/catkin_ws/devel/setup.bash" >> /root/.bashrc
WORKDIR /tutorial
RUN git clone https://github.com/tue-robotics/ed_tutorials.git

Put the code above in a file called Dockerfile and build the image with:

docker build -t ed:test .

This will take a while so just let it run in the background. Start the container with:

docker run --rm -it --name ed_test ed:test bash

For testing you need a roscore inside the container so start one.

roscore

Open a new terminal and type:

docker exec -it ed_test bash

Now you can test the config with:

rosrun tue_config test_yaml_and_show ed_tutorials/tutorial01/my-ed-config.yaml

In my case the output look like this:

rosrun tue_config test_yaml_and_show ed_tutorials/tutorial01/my-ed-config.yaml 
1
1
1
Error: While parsing 'ed_tutorials/tutorial01/my-ed-config.yaml':

In 'world': 

    Sequences must only contains maps


from ed.

Maik13579 avatar Maik13579 commented on July 23, 2024

And after changing the file /root/catkin_ws/src/tue-robotics/tue_config/src/loaders/yaml.cpp like described above, the output is:

rosrun tue_config test_yaml_and_show ed_tutorials/tutorial01/my-ed-config.yaml 
1
1
1
plugins:
- name: gui_server
  type: ed_gui_server/gui_server
world:
- id: block1
  pose:
    x: 2
    y: 0
    z: 0.5
  shape:
    box:
      size:
        x: 0.5
        y: 0.5
        z: 1
- id: block2
  pose:
    x: 3
    y: 2
    z: 0.75
  shape:
    box:
      size:
        x: 0.5
        y: 0.5
        z: 1.5

from ed.

PetervDooren avatar PetervDooren commented on July 23, 2024

Tested on a PC where we found this problem on two workspaces. One working and one not. This eliminates system package as the cause of this problem.
The problem lies in the build options for tue_config. Plain catkin build compiles a non working version. Building with catkin build -DCMAKE_BUILD_TYPE=RelWithDebInfo produces a working version, this results in CXX_FLAGS = -O2 -g -DNDEBUG. Building with catkin build -DCMAKE_BUILD_TYPE=Release, which results in CXX_FLAGS = -O3 -DNDEBUG

from ed.

MatthijsBurgh avatar MatthijsBurgh commented on July 23, 2024

This looks similar to jbeder/yaml-cpp#833

from ed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.