aerostack2 / aerostack2.github.io

Documentation of the Aerostack2 Project
https://aerostack2.github.io/
MIT License
8 stars 6 forks source link

Trying to add a gimbal results in error - and fix #64

Closed OdedHorowits closed 1 week ago

OdedHorowits commented 1 week ago

Adding a gimbal to the aerostack2_examples/project_gazebo/sim_config/world.json file as seems at https://aerostack2.github.io/_03_aerial_platforms/_gazebo_simulation/index.html#gimbal results in error:

[ERROR] [launch]: Caught exception in launch (see debug for traceback):
field "payload" not yet prepared so type is still a ForwardRef, you might need to call Payload.update_forward_refs().

To fix that, there is a need to add the following line (with no indent) at the end of /opt/ros/humble/local/lib/python3.10/dist-packages/as2_gazebo_assets/models/payload.py:

Payload.update_forward_refs()
pariaspe commented 1 week ago

Hi @OdedHorowits , which Pydantic version are you using? Try to install Pydantic v1.10

OdedHorowits commented 1 week ago

Hi @pariaspe Using Pydantic v1.10, indeed there is no need for my addition. I had version 1.8.2 before. However, the camera attached to the gimbal is not streaming any data - Nothing is seen in rviz, and ros2 topic echo /drone0/sensor_measurements/rgbd_camera/camera_info gives nothing (on both versions of Pydantic)

pariaspe commented 1 week ago

Did that error msg disappear? There are some known bugs in aerostack2 v1.0.9 that hopefully will be solved soon in next release. Could you please share your new world.json?

OdedHorowits commented 1 week ago

The error msg is not presented anymore. Here is my world.json that does not stream any camera data:

{
    "world_name": "my_world",
    "drones": [
        {
            "model_type": "quadrotor_base",
            "model_name": "drone0",
            "xyz": [0.0, 0.0, 0.3],
            "rpy": [0, 0, 0],
            "flight_time": 60,
            "payload": [
                {
                    "model_type": "gimbal_position",
                    "model_name": "gimbal",
                    "payload":
                    {
                        "model_type": "rgbd_camera",
                        "model_name": "rgbd_camera"                        
                    }
                }
            ]
        }
    ]
}

This file work properly:

{
    "world_name": "my_world",
    "drones": [
        {
            "model_type": "quadrotor_base",
            "model_name": "drone0",
            "xyz": [0.0, 0.0, 0.3],
            "rpy": [0, 0, 0],
            "flight_time": 60,
            "payload": [
                {
                    "model_type": "rgbd_camera",
                    "model_name": "rgbd_camera",
                    "xyz": [0, 0, 0.2],
                    "rpy": [0, 0, 0]
                }
            ]
        }
    ]
}
pariaspe commented 1 week ago

Hi again, just tested it and it's working on main branch. Trying now on latest binary release

pariaspe commented 1 week ago

Hi @OdedHorowits, could you try launching the following json?

{
    "world_name": "my_world",
    "drones": [
        {
            "model_type": "quadrotor_base",
            "model_name": "drone0",
            "xyz": [0.0, 0.0, 0.3],
            "rpy": [0, 0, 0],
            "flight_time": 60,
            "payload": [
                {
                    "model_type": "gimbal_position",
                    "model_name": "gb",
                    "payload":
                    {
                        "model_type": "rgbd_camera",
                        "model_name": "rgbd_camera"                        
                    }
                }
            ]
        }
    ]
}

There was a hard-coded gimbal name somewhere in the code. As said before, it is already solved at main branch.

OdedHorowits commented 1 week ago

Hi @OdedHorowits, could you try launching the following json?

Yes, that fixed the problem. The gibal's model_name must be gb.

Here is how I installed Aerostack2 in my docker:

RUN apt-get update \
    && apt-get install -y \
      ros-humble-aerostack2 \
    && rm -rf /var/lib/apt-get/lists/*

RUN apt-get update \
    && apt-get install -y \
    ros-humble-as2-gazebo-assets \
    && rm -rf /var/lib/apt-get/lists/*

RUN apt-get update \
    && apt-get install -y \
    ros-humble-as2-platform-gazebo \
    && rm -rf /var/lib/apt-get/lists/* \
    && apt-get autoremove -y

Thtat gave me version 1.0.9-1jammy.20240530 So I hope that would be fixed in the next binaries version!

pariaspe commented 1 week ago

It will! Thanks for notifying the issue :+1:

OdedHorowits commented 1 week ago

Oh I am sorry... It works, but the streamed video vibrates as if there was no gimbal at all...

pariaspe commented 1 week ago

I'm sorry to say that vibration mitigation is not implemented yet in the gimbal

OdedHorowits commented 1 week ago

I'm sorry to say that vibration mitigation is not implemented yet in the gimbal

Oh, ok then.