Skip to content

Commit

Permalink
Merge branch 'gazebo11' into scpeters/plowing
Browse files Browse the repository at this point in the history
  • Loading branch information
scpeters committed Jul 5, 2022
2 parents 93ff028 + 3e3e019 commit 4822d47
Show file tree
Hide file tree
Showing 26 changed files with 692 additions and 38 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/conda-forge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ jobs:
# Compilation related dependencies
mamba install cmake compilers make ninja pkg-config
# Actual dependencies
mamba install libprotobuf libsdformat libignition-cmake2 libignition-math6 libignition-transport8 libignition-common3 libignition-fuel-tools4 qt=5.12.9=*_4 ogre=1.10 freeimage curl tbb-devel qwt tinyxml2 libccd boost-cpp libcurl tinyxml bzip2 zlib ffmpeg graphviz libgdal libusb bullet-cpp dartsim simbody hdf5 openal-soft glib gts
# re-add dartsim once the libsdformat 9.8 issue is resolved
# https://github.com/osrf/gazebo/pull/3223#issuecomment-1140019713
mamba install libprotobuf libsdformat libignition-cmake2 libignition-math6 libignition-transport8 libignition-common3 libignition-fuel-tools4 qt=5.12.9=*_4 ogre=1.10 freeimage curl tbb-devel qwt tinyxml2 libccd boost-cpp libcurl tinyxml bzip2 zlib ffmpeg graphviz libgdal libusb bullet-cpp simbody hdf5 openal-soft glib gts
- name: Linux-only Dependencies [Linux]
if: contains(matrix.os, 'ubuntu')
Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
string (TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER)

set (GAZEBO_MAJOR_VERSION 11)
set (GAZEBO_MINOR_VERSION 10)
set (GAZEBO_MINOR_VERSION 11)
# The patch version may have been bumped for prerelease purposes; be sure to
# check gazebo-release/ubuntu/debian/changelog@default to determine what the
# next patch version should be for a regular release.
set (GAZEBO_PATCH_VERSION 2)
set (GAZEBO_PATCH_VERSION 0)

set (GAZEBO_VERSION ${GAZEBO_MAJOR_VERSION}.${GAZEBO_MINOR_VERSION})
set (GAZEBO_VERSION_FULL ${GAZEBO_MAJOR_VERSION}.${GAZEBO_MINOR_VERSION}.${GAZEBO_PATCH_VERSION})
Expand Down Expand Up @@ -194,6 +194,7 @@ set(OGRE_RESOURCE_PATH ${OGRE_PLUGINDIR})
# Seems that OGRE_PLUGINDIR can end in a newline, which will cause problems when
# we pass it to the compiler later.
string(REPLACE "\n" "" OGRE_RESOURCE_PATH ${OGRE_RESOURCE_PATH})
FILE(TO_CMAKE_PATH "${OGRE_RESOURCE_PATH}" OGRE_RESOURCE_PATH)


# Check for DRI capable Display
Expand Down
33 changes: 33 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
## Gazebo 11

## Gazebo 11.11.0 (2022-05-25)

1. Convert `OGRE_RESOURCE_PATH` with `TO_CMAKE_PATH`
* [Pull request #3165](https://github.com/osrf/gazebo/pull/3165)
* A contrubition from Silvio Traversaro

1. Fix compatibility with FFmpeg 5.0
* [Pull request #3195](https://github.com/osrf/gazebo/pull/3195)
* A contrubition from Silvio Traversaro

1. Get/Set friction coefficients of wheels
* [Pull request #3219](https://github.com/osrf/gazebo/pull/3219)

1. Support `<anti_aliasing>` element when setting up camera
* [Pull request #3201](https://github.com/osrf/gazebo/pull/3201)

1. Added shininess to models
* [Pull request #3213](https://github.com/osrf/gazebo/pull/3213)
* [Pull request #3223](https://github.com/osrf/gazebo/pull/3223)

1. Fix missing namespace for string
* [Pull request #3211](https://github.com/osrf/gazebo/pull/3211)

1. Fix typo in TBB target check in `gazebo-config.cmake.in`
* [Pull request #3207](https://github.com/osrf/gazebo/pull/3207)

1. Separate cache files for each heightmap LOD
* [Pull request #3200](https://github.com/osrf/gazebo/pull/3200)

1. Parse `ode_quiet` physics parameter from SDFormat
* [Pull request #3194](https://github.com/osrf/gazebo/pull/3194)

## Gazebo 11.10.2 (2022-03-19)

1. Support plotting for entities with / in the name
Expand Down Expand Up @@ -5051,3 +5083,4 @@ compilation on Windows.
* Numerous bug fixes
* APT repository hosted at [http://osrfoundation.org OSRF]
* Improved process control prevents zombie processes

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Gazebo - A dynamic multi-robot simulator
This is the Gazebo simulator. Gazebo simulates multiple robots in a
3D environment, with extensive dynamic interaction between objects.

http://gazebosim.org
http://classic.gazebosim.org

Installation
------------
Instructions are located at

http://gazebosim.org/install
http://classic.gazebosim.org/install

Gazebo cmake parameters available at configuring time:

Expand Down Expand Up @@ -51,7 +51,7 @@ Gazebo cmake parameters available at configuring time:

Uninstallation
--------------
Read the uninstallation instructions (http://gazebosim.org/uninstall) in the
Read the uninstallation instructions (http://classic.gazebosim.org/uninstall) in the
online manual for generic instructions. For most people, the following
sequence will suffice (might need sudo if it installed in /usr):

Expand Down
2 changes: 1 addition & 1 deletion cmake/SearchForStuff.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ endif ()

########################################
# Find SDFormat
set(SDF_MIN_REQUIRED_VERSION 9.3)
set(SDF_MIN_REQUIRED_VERSION 9.8)
find_package(sdformat9 ${SDF_MIN_REQUIRED_VERSION} REQUIRED)
if (sdformat9_FOUND)
message (STATUS "Looking for SDFormat9 - found")
Expand Down
4 changes: 2 additions & 2 deletions cmake/gazebo-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ list(APPEND @PKG_NAME@_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${PROTOBUF_LIBRARIES})

# Find SDFormat
find_package(sdformat9 REQUIRED)
find_package(sdformat9 REQUIRED VERSION 9.8)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${SDFormat_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${SDFormat_LIBRARIES})

Expand Down Expand Up @@ -226,7 +226,7 @@ list(APPEND @PKG_NAME@_LDFLAGS -L${GAZEBO_INSTALL_LIB_DIR}/gazebo-@GAZEBO_MAJOR_
set (GAZEBO_HAS_TBB_GREATER_OR_EQUAL_2021 @HAVE_TBB_GREATER_OR_EQUAL_2021@)
if (GAZEBO_HAS_TBB_GREATER_OR_EQUAL_2021)
find_package(TBB CONFIG)
if (TARGET tbb::tbb)
if (TARGET TBB::tbb)
list(APPEND @PKG_NAME@_LIBRARIES TBB::tbb)
endif ()
endif ()
123 changes: 116 additions & 7 deletions gazebo/common/AudioDecoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ void AudioDecoder::Cleanup()
#ifdef HAVE_FFMPEG
bool AudioDecoder::Decode(uint8_t **_outBuffer, unsigned int *_outBufferSize)
{
AVPacket packet, packet1;
#if LIBAVFORMAT_VERSION_MAJOR < 59
AVPacket *packet, packet1;
int bytesDecoded = 0;
#else
AVPacket *packet;
#endif
unsigned int maxBufferSize = 0;
AVFrame *decodedFrame = nullptr;

Expand Down Expand Up @@ -97,14 +101,66 @@ bool AudioDecoder::Decode(uint8_t **_outBuffer, unsigned int *_outBufferSize)
else
common::AVFrameUnref(decodedFrame);

av_init_packet(&packet);
while (av_read_frame(this->formatCtx, &packet) == 0)
packet = av_packet_alloc();
if (!packet)
{
gzerr << "Failed to allocate AVPacket" << std::endl;
return false;
}
while (av_read_frame(this->formatCtx, packet) == 0)
{
if (packet.stream_index == this->audioStream)
if (packet->stream_index == this->audioStream)
{
#if LIBAVFORMAT_VERSION_MAJOR >= 59
// Inspired from
// https://github.com/FFmpeg/FFmpeg/blob/n5.0/doc/examples/decode_audio.c#L71

// send the packet with the compressed data to the decoder
int ret = avcodec_send_packet(this->codecCtx, packet);
if (ret < 0)
{
gzerr << "Error submitting the packet to the decoder" << std::endl;
return false;
}

// read all the output frames
// (in general there may be any number of them)
while (ret >= 0)
{
ret = avcodec_receive_frame(this->codecCtx, decodedFrame);
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
{
break;
}
else if (ret < 0)
{
gzerr << "Error during decoding" << std::endl;
return false;
}

// Total size of the data. Some padding can be added to
// decodedFrame->data[0], which is why we can't use
// decodedFrame->linesize[0].
int size = decodedFrame->nb_samples *
av_get_bytes_per_sample(this->codecCtx->sample_fmt) *
this->codecCtx->channels;

// Resize the audio buffer as necessary
if (*_outBufferSize + size > maxBufferSize)
{
maxBufferSize += size * 5;
*_outBuffer = reinterpret_cast<uint8_t*>(realloc(*_outBuffer,
maxBufferSize * sizeof(*_outBuffer[0])));
}

memcpy(*_outBuffer + *_outBufferSize, decodedFrame->data[0],
size);
*_outBufferSize += size;
}
#else
int gotFrame = 0;

packet1 = packet;
packet1 = *packet;
while (packet1.size)
{
// Some frames rely on multiple packets, so we have to make sure
Expand Down Expand Up @@ -144,11 +200,12 @@ bool AudioDecoder::Decode(uint8_t **_outBuffer, unsigned int *_outBufferSize)
packet1.data += bytesDecoded;
packet1.size -= bytesDecoded;
}
#endif
}
AVPacketUnref(&packet);
av_packet_unref(packet);
}

AVPacketUnref(&packet);
av_packet_unref(packet);

// Seek to the beginning so that it can be decoded again, if necessary.
av_seek_frame(this->formatCtx, this->audioStream, 0, 0);
Expand Down Expand Up @@ -214,7 +271,11 @@ bool AudioDecoder::SetFile(const std::string &_filename)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#if LIBAVFORMAT_VERSION_MAJOR >= 59
if (this->formatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
#else
if (this->formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
#endif
#ifndef _WIN32
# pragma GCC diagnostic pop
#endif
Expand All @@ -238,13 +299,61 @@ bool AudioDecoder::SetFile(const std::string &_filename)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#if LIBAVFORMAT_VERSION_MAJOR < 59
this->codecCtx = this->formatCtx->streams[audioStream]->codec;
#endif
#ifndef _WIN32
# pragma GCC diagnostic pop
#endif

// Find a decoder
#if LIBAVFORMAT_VERSION_MAJOR >= 59
const AVCodec * local_codec = avcodec_find_decoder(this->formatCtx->streams[
this->audioStream]->codecpar->codec_id);
if (!local_codec)
{
gzerr << "Failed to find the codec" << std::endl;
return false;
}
this->codecCtx = avcodec_alloc_context3(local_codec);
if (!this->codecCtx)
{
gzerr << "Failed to allocate the codec context" << std::endl;
return false;
}

// Copy all relevant parameters from codepar to codecCtx
if (avcodec_parameters_to_context(this->codecCtx,
this->formatCtx->streams[this->audioStream]->codecpar) < 0)
{
gzerr << "Failed to copy codec parameters to decoder context"
<< std::endl;
return false;
}

// This copy should be done by avcodec_parameters_to_context, but at least on
// conda-forge with 5.0.0 h594f047_1 this is not happening for some reason.
// As temporary workaround, we copy directly the data structures, taking the code from
// https://github.com/FFmpeg/FFmpeg/blob/n5.0/libavcodec/codec_par.c#L120
AVCodecParameters* par = this->formatCtx->streams[this->audioStream]->codecpar;
this->codecCtx->sample_fmt = static_cast<AVSampleFormat>(par->format);
this->codecCtx->channel_layout = par->channel_layout;
this->codecCtx->channels = par->channels;
this->codecCtx->sample_rate = par->sample_rate;
this->codecCtx->block_align = par->block_align;
this->codecCtx->frame_size = par->frame_size;
this->codecCtx->delay =
this->codecCtx->initial_padding = par->initial_padding;
this->codecCtx->trailing_padding = par->trailing_padding;
this->codecCtx->seek_preroll = par->seek_preroll;

// It would be better to just define codec as const AVCodec *,
// but that is not done to avoid ABI problem. Anyhow, as codec
// it is a private attribute there should be no problem
this->codec = const_cast<AVCodec *>(local_codec);
#else
this->codec = avcodec_find_decoder(codecCtx->codec_id);
#endif

if (this->codec == nullptr)
{
Expand Down
Loading

0 comments on commit 4822d47

Please sign in to comment.