gazebosim / gz-sim

Open source robotics simulator. The latest version of Gazebo.
https://gazebosim.org
Apache License 2.0
621 stars 251 forks source link

Add Track and Follow options in gui EntityContextMenu #2402

Closed bperseghetti closed 1 month ago

bperseghetti commented 1 month ago

🎉 New feature

Summary

I would like to thank NXP for their support in enabling this work.

Depends on:

This adds a new /gui/track topic using the CameraTrack message to control multiple types of tracking and associated pgain(s), target(s) and offset(s). Furthermore it publishes a tracking camera status CameraTrack message on /gui/currently_tracked

This also adds an 3 unique follow modes and a tracking mode all able to be set from either the /gui/track topic or more ideally from the user gui.

The 3 follow modes are in a submenu under the right click top level menu Follow Options > and are:

The other right click top level menu item added is Track, where the gui camera can be moved anywhere in the simulator but will always track the selected object. track

These all respect using the escape key to stop any form of tracking.

Test it

Use these changes for collection-harmonic.yaml:

repositories:
  gz-gui:
    type: git
    url: https://github.com/rudislabs/gz-gui.git
    version: pr-track-follow
  gz-msgs:
    type: git
    url: https://github.com/rudislabs/gz-msgs.git
    version: pr-track-follow
  gz-sim:
    type: git
    url: https://github.com/rudislabs/gz-sim.git
    version: pr-track-follow

Checklist

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

j-rivero commented 1 month ago

@osrf-jenkins run tests

bperseghetti commented 1 month ago

@osrf-jenkins run tests

nosradom commented 2 weeks ago

I accidentally upgraded to 8.4.0 today. This feature is giving me some problems.

The popup window Follow command does not seem to do anything anymore. Is there a new dependency that is needed for this to work? The 'Move To' command works but follow does not when it previously did.

Using the Right click on the Entity Tree. Then the popup window selecting the Follow Options -> Follow

I'm experimenting with using docker to run some ardupilot simulations. Below is the Dockerfile. (Rebuilding the docker image is how I accidentally upgraded).

I am using harmonic and humble

Also is there an easy way to revert to 8.3.0?

ARG ROS_DISTRO
FROM ros:${ROS_DISTRO}

ENV COLCON_WS=/root/colcon_ws
ENV COLCON_WS_SRC=/root/colcon_ws/src
ENV PYTHONWARNINGS="ignore:setup.py install is deprecated::setuptools.command.install"

ENV DEBIAN_FRONTEND noninteractive

ARG GZ_VERSION

RUN apt-get update -qq \
    && apt-get install -y \
        wget \
    && rm -rf /var/lib/apt/lists/*

RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg\
    && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null

RUN apt-get update -qq \
    && apt-get install -y \
        gz-${GZ_VERSION} \
        build-essential\
        ros-${ROS_DISTRO}-rcl-interfaces\
        ros-${ROS_DISTRO}-rclcpp\
        ros-${ROS_DISTRO}-builtin-interfaces\
        ros-${ROS_DISTRO}-ros-gz\
        ros-${ROS_DISTRO}-sdformat-urdf\
        ros-${ROS_DISTRO}-vision-msgs\
        ros-${ROS_DISTRO}-actuator-msgs\
        ros-${ROS_DISTRO}-image-transport\
    && rm -rf /var/lib/apt/lists/*

RUN mkdir -p ${COLCON_WS_SRC}\
    && cd ${COLCON_WS}\
    && . /opt/ros/${ROS_DISTRO}/setup.sh\
    && colcon build

RUN git clone --recursive --depth 1 https://github.com/ArduPilot/ardupilot_gazebo.git

RUN apt-get update \
    && apt-get install -y \
        libgz-sim8-dev \
        rapidjson-dev

RUN mkdir ardupilot_gazebo/build\
    && cd ardupilot_gazebo/build\
    && cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo

RUN cd ardupilot_gazebo/build\
    && make -j4

ENV GZ_SIM_RESOURCE_PATH=/ardupilot_gazebo/models:/ardupilot_gazebo/worlds:/models:/worlds
ENV GZ_SIM_SYSTEM_PLUGIN_PATH=/ardupilot_gazebo/build

CMD gz sim -v4 -r /ardupilot_gazebo/worlds/iris_runway.sdf
bperseghetti commented 2 weeks ago

I accidentally upgraded to 8.4.0 today. This feature is giving me some problems.

The popup window Follow command does not seem to do anything anymore. Is there a new dependency that is needed for this to work? The 'Move To' command works but follow does not when it previously did.

Using the Right click on the Entity Tree. Then the popup window selecting the Follow Options -> Follow

I'm experimenting with using docker to run some ardupilot simulations. Below is the Dockerfile. (Rebuilding the docker image is how I accidentally upgraded).

I am using harmonic and humble

Also is there an easy way to revert to 8.3.0?

ARG ROS_DISTRO
FROM ros:${ROS_DISTRO}

ENV COLCON_WS=/root/colcon_ws
ENV COLCON_WS_SRC=/root/colcon_ws/src
ENV PYTHONWARNINGS="ignore:setup.py install is deprecated::setuptools.command.install"

ENV DEBIAN_FRONTEND noninteractive

ARG GZ_VERSION

RUN apt-get update -qq \
    && apt-get install -y \
        wget \
    && rm -rf /var/lib/apt/lists/*

RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg\
    && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null

RUN apt-get update -qq \
    && apt-get install -y \
        gz-${GZ_VERSION} \
        build-essential\
        ros-${ROS_DISTRO}-rcl-interfaces\
        ros-${ROS_DISTRO}-rclcpp\
        ros-${ROS_DISTRO}-builtin-interfaces\
        ros-${ROS_DISTRO}-ros-gz\
        ros-${ROS_DISTRO}-sdformat-urdf\
        ros-${ROS_DISTRO}-vision-msgs\
        ros-${ROS_DISTRO}-actuator-msgs\
        ros-${ROS_DISTRO}-image-transport\
    && rm -rf /var/lib/apt/lists/*

RUN mkdir -p ${COLCON_WS_SRC}\
    && cd ${COLCON_WS}\
    && . /opt/ros/${ROS_DISTRO}/setup.sh\
    && colcon build

RUN git clone --recursive --depth 1 https://github.com/ArduPilot/ardupilot_gazebo.git

RUN apt-get update \
    && apt-get install -y \
        libgz-sim8-dev \
        rapidjson-dev

RUN mkdir ardupilot_gazebo/build\
    && cd ardupilot_gazebo/build\
    && cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo

RUN cd ardupilot_gazebo/build\
    && make -j4

ENV GZ_SIM_RESOURCE_PATH=/ardupilot_gazebo/models:/ardupilot_gazebo/worlds:/models:/worlds
ENV GZ_SIM_SYSTEM_PLUGIN_PATH=/ardupilot_gazebo/build

CMD gz sim -v4 -r /ardupilot_gazebo/worlds/iris_runway.sdf

@iche033 I think this is what I mentioned to you yesterday about not having it in first but releasing a gz-sim.

bperseghetti commented 2 weeks ago

@nosradom fix is incoming and should be released to binaries soon. A release for gz-gui was needed and is here: https://github.com/gazebosim/gz-gui/pull/624

nosradom commented 2 weeks ago

@nosradom fix is incoming and should be released to binaries soon. A release for gz-gui was needed and is here: gazebosim/gz-gui#624

Awesome thanks

bperseghetti commented 2 weeks ago

@nosradom fix is incoming and should be released to binaries soon. A release for gz-gui was needed and is here: gazebosim/gz-gui#624

Awesome thanks

Were you able to update and make sure it works properly in your environment?