diff --git a/.github/workflows/test_suite_linux.yml b/.github/workflows/test_suite_linux.yml index 58d0adfbd4c..128941b0bfe 100644 --- a/.github/workflows/test_suite_linux.yml +++ b/.github/workflows/test_suite_linux.yml @@ -68,14 +68,6 @@ jobs: export LIBGL_ALWAYS_SOFTWARE=true export ROS_DISTRO=${{ matrix.ROS_DISTRO }} xvfb-run --auto-servernum make distrib -j4 - - name: Prepare Webots Controller Deployment - if: ${{ (github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'deploy libcontroller')) && matrix.os == 'ubuntu-20.04' }} - uses: webfactory/ssh-agent@v0.5.3 - with: - ssh-private-key: ${{ secrets.WEBOTS_CONTROLLER_DEPLOY_KEY }} - - name: Deploy Webots Controller - if: ${{ (github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'deploy libcontroller')) && matrix.os == 'ubuntu-20.04' }} - run: scripts/packaging/sync_controller_lib.sh - name: Create/Update GitHub release if: ${{ matrix.os == 'ubuntu-20.04' && (github.event_name == 'push' || github.event_name == 'schedule') }} run: | diff --git a/.github/workflows/test_suite_linux_develop.yml b/.github/workflows/test_suite_linux_develop.yml index 7fb3f04a68c..2e1ad55704d 100644 --- a/.github/workflows/test_suite_linux_develop.yml +++ b/.github/workflows/test_suite_linux_develop.yml @@ -64,14 +64,6 @@ jobs: export LIBGL_ALWAYS_SOFTWARE=true export ROS_DISTRO=${{ matrix.ROS_DISTRO }} xvfb-run --auto-servernum make distrib -j4 - - name: Prepare Webots Controller Deployment - if: ${{ (github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'deploy libcontroller')) && matrix.os == 'ubuntu-20.04' }} - uses: webfactory/ssh-agent@v0.5.3 - with: - ssh-private-key: ${{ secrets.WEBOTS_CONTROLLER_DEPLOY_KEY }} - - name: Deploy Webots Controller - if: ${{ (github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'deploy libcontroller')) && matrix.os == 'ubuntu-20.04' }} - run: scripts/packaging/sync_controller_lib.sh - name: Create/Update GitHub release if: ${{ matrix.os == 'ubuntu-20.04' && (github.event_name == 'push' || github.event_name == 'schedule') }} run: | diff --git a/.github/workflows/test_suite_mac.yml b/.github/workflows/test_suite_mac.yml index a59d2161c07..3fef0c0f039 100644 --- a/.github/workflows/test_suite_mac.yml +++ b/.github/workflows/test_suite_mac.yml @@ -52,14 +52,6 @@ jobs: export JAVA_HOME="$(/usr/libexec/java_home -v 16)" export PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin/:$PATH make distrib -j4 - - name: Prepare Webots Controller Deployment - if: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'deploy libcontroller') }} - uses: webfactory/ssh-agent@v0.5.3 - with: - ssh-private-key: ${{ secrets.WEBOTS_CONTROLLER_DEPLOY_KEY }} - - name: Deploy Webots Controller - if: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'deploy libcontroller') }} - run: scripts/packaging/sync_controller_lib.sh - name: Create/Update GitHub release if: ${{ (github.event_name == 'push' || github.event_name == 'schedule') }} run: | diff --git a/.github/workflows/test_suite_mac_develop.yml b/.github/workflows/test_suite_mac_develop.yml index 63898bab043..f0e80bd3f97 100644 --- a/.github/workflows/test_suite_mac_develop.yml +++ b/.github/workflows/test_suite_mac_develop.yml @@ -48,14 +48,6 @@ jobs: export JAVA_HOME="$(/usr/libexec/java_home -v 16)" export PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin/:$PATH make distrib -j4 - - name: Prepare Webots Controller Deployment - if: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'deploy libcontroller') }} - uses: webfactory/ssh-agent@v0.5.3 - with: - ssh-private-key: ${{ secrets.WEBOTS_CONTROLLER_DEPLOY_KEY }} - - name: Deploy Webots Controller - if: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'deploy libcontroller') }} - run: scripts/packaging/sync_controller_lib.sh - name: Create/Update GitHub release if: ${{ (github.event_name == 'push' || github.event_name == 'schedule') }} run: | diff --git a/.github/workflows/test_suite_windows.yml b/.github/workflows/test_suite_windows.yml index efc597a7b1e..0589a664916 100644 --- a/.github/workflows/test_suite_windows.yml +++ b/.github/workflows/test_suite_windows.yml @@ -82,15 +82,6 @@ jobs: run: | export WEBOTS_HOME=$GITHUB_WORKSPACE make distrib -j4 - - name: Deploy Webots Controller - if: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'deploy libcontroller') }} - run: | - export SSH_AUTH_SOCK=/tmp/ssh_agent.sock - mkdir ~/.ssh - ssh-keyscan -H github.com > ~/.ssh/known_hosts - ssh-agent -a $SSH_AUTH_SOCK > /dev/null - ssh-add - <<< "${{ secrets.WEBOTS_CONTROLLER_DEPLOY_KEY }}" - scripts/packaging/sync_controller_lib.sh - name: Create/Update GitHub release if: ${{ (github.event_name == 'push' || github.event_name == 'schedule') }} run: | diff --git a/.github/workflows/test_suite_windows_develop.yml b/.github/workflows/test_suite_windows_develop.yml index 7694d022111..c5409af0de2 100644 --- a/.github/workflows/test_suite_windows_develop.yml +++ b/.github/workflows/test_suite_windows_develop.yml @@ -78,15 +78,6 @@ jobs: run: | export WEBOTS_HOME=$GITHUB_WORKSPACE make distrib -j4 - - name: Deploy Webots Controller - if: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'deploy libcontroller') }} - run: | - export SSH_AUTH_SOCK=/tmp/ssh_agent.sock - mkdir ~/.ssh - ssh-keyscan -H github.com > ~/.ssh/known_hosts - ssh-agent -a $SSH_AUTH_SOCK > /dev/null - ssh-add - <<< "${{ secrets.WEBOTS_CONTROLLER_DEPLOY_KEY }}" - scripts/packaging/sync_controller_lib.sh - name: Create/Update GitHub release if: ${{ (github.event_name == 'push' || github.event_name == 'schedule') }} run: | diff --git a/docs/guide/images/rosetta_setting.png b/docs/guide/images/rosetta_setting.png new file mode 100644 index 00000000000..3754d7d89c2 Binary files /dev/null and b/docs/guide/images/rosetta_setting.png differ diff --git a/docs/guide/installation-procedure.md b/docs/guide/installation-procedure.md index 82fffd3d76a..bd692bec0a8 100644 --- a/docs/guide/installation-procedure.md +++ b/docs/guide/installation-procedure.md @@ -304,6 +304,24 @@ open ~/Applications/Webots.app # to launch Webots using the open command Alternatively, you can double-click on the Webots icon to launch it. +#### Troubleshooting for Apple Silicon Users + +If you are getting errors like these: +```bash +...(mach-o file, but is an incompatible architecture (have (arm64), need (x86_64))) +``` + +This is likely caused by Rosetta loading Webots under the x86 architecture instead of the native ARM. Unless you really want to use x86 binaries with your Webots simulation, make sure to turn off Rosetta. Sometimes macOS may try to open the app using Rosetta by default, which may cause issues when it comes to run robot controllers with dependencies on ARM libraries. + +To check if it's opened using Rosetta, right click on the Webots application in Finder and select Get Info. + +Make sure that the "Open using Rosetta" setting is unchecked, like in the picture below: + +%figure "Rosetta setting" + +![rosetta_setting.png](images/rosetta_setting.png) + +%end #### From the Homebrew Package diff --git a/docs/guide/tutorial-7-your-first-proto.md b/docs/guide/tutorial-7-your-first-proto.md index 31ae5674f78..dcd5fd5fb7f 100644 --- a/docs/guide/tutorial-7-your-first-proto.md +++ b/docs/guide/tutorial-7-your-first-proto.md @@ -12,6 +12,7 @@ Create a new empty text file in the `protos` folder of your project called `Four Any PROTO file should at least respect the following structure: ``` +#VRML_SIM {{ webots.version.major }} utf8 PROTO protoName [ protoFields ] @@ -30,6 +31,7 @@ Finally, save the PROTO file. **Solution**: You should have something like this: ``` + #VRML_SIM {{ webots.version.major }} utf8 PROTO FourWheelsRobot [ ] @@ -80,6 +82,7 @@ And the `mass` field of the [Physics](../reference/physics.md) node of the [Robo ``` Save your PROTO file, it should now look like this: ``` +#VRML_SIM {{ webots.version.major }} utf8 PROTO FourWheelsRobot [ field SFVec3f translation 0 0 0 field SFRotation rotation 0 0 1 0 diff --git a/docs/reference/changelog-r2023.md b/docs/reference/changelog-r2023.md index 7ed4c3488ea..f50ee85b567 100644 --- a/docs/reference/changelog-r2023.md +++ b/docs/reference/changelog-r2023.md @@ -16,6 +16,7 @@ Released on ?? - Disable `Select..` button in SFString editor if the field has restricted values ([5663](https://github.com/cyberbotics/webots/pull/5663)). - Improved plot representation in default robot window when a NaN value is received from a device ([#5680](https://github.com/cyberbotics/webots/pull/5680)). - Bug Fixes + - Fixed crash in Python API when a robot controller was using several cameras with different resolutions ([#5705](https://github.com/cyberbotics/webots/pull/5705)). - Fixed Python API `Supervisor.setSimulationMode` which was failing ([#5603](https://github.com/cyberbotics/webots/pull/5603)). - Fixed Python API `Node.enableContactPointsTracking` which was failing ([#5633](https://github.com/cyberbotics/webots/pull/5633)). - Fixed Python API field getters sometimes returning an invalid Field object ([#5633](https://github.com/cyberbotics/webots/pull/5633)). @@ -30,6 +31,7 @@ Released on ?? - Fixed a crash when setting the `Robot.battery` after the simulation start ([#5669](https://github.com/cyberbotics/webots/pull/5669)). - Fixed crashes resulting from converting to base nodes a PROTO containing DEF and USE nodes ([#5676](https://github.com/cyberbotics/webots/pull/5676)). - Fixed crashes resulting from updating a DEF node whose USE node is contained in a PROTO field triggering the regeneration ([#5676](https://github.com/cyberbotics/webots/pull/5676)). + - Fixed crashes resulting from copy or DEF/USE update in [`Solid.boundingObject`](solid.md) field ([#5686](https://github.com/cyberbotics/webots/pull/5686)). ## Webots R2023a Released on November 29th, 2022. diff --git a/docs/reference/jointparameters.md b/docs/reference/jointparameters.md index e8a5d28c779..d084a50bb2d 100644 --- a/docs/reference/jointparameters.md +++ b/docs/reference/jointparameters.md @@ -90,8 +90,9 @@ The `springConstant` field specifies the value of the spring constant (or spring The `springConstant` must be positive or zero. If the `springConstant` is zero (the default), no spring torque/force will be applied to the joint. If the `springConstant` is greater than zero, then a spring force will be computed and applied to the joint in addition to the other forces (i.e., motor force, damping force). -The spring force is calculated according to Hooke's law: *F = -Kx*, where *K* is the `springConstant` and *x* is the current joint position as represented by the `position` field. +In case of a linear joint it is expressed in *N/m* and the spring force is calculated according to Hooke's law: *F = -Kx*, where *K* is the `springConstant` and *x* is the current joint position as represented by the `position` field. Therefore, the spring force is computed so as to be proportional to the current joint position, and to move the joint back to its initial position. +Similarly, in case of a rotational joint, the spring constant is expressed in *N.m/rad* and the resulting torque *T* is computed in from this formula: *T = -Kx*. When designing a robot model that uses springs, it is important to remember that the spring's resting position for each joint will correspond to the initial position of the joint. The only exception arises when the closest upper [Solid](solid.md) of the [Joint](joint.md) is passive, i.e. the `physics` field is not defined. In this case the spring force direction is inverted. @@ -100,7 +101,8 @@ The `dampingConstant` field specifies the value of the joint damping constant. The value of `dampingConstant` must be positive or zero. If `dampingConstant` is zero (the default), no damping torque/force will be added to the joint. If `dampingConstant` is greater than zero, a damping torque/force will be applied to the joint in addition to the other forces (i.e., motor force, spring force). -This damping torque/force is proportional to the effective joint velocity: *F = -Bv*, where *B* is the damping constant, and *v = dx/dt* is the effective joint velocity computed by the physics simulator. +This damping torque/force *F* is proportional to the effective joint velocity: *F = -Bv*, where *B* is the damping constant, and *v = dx/dt* is the effective joint velocity computed by the physics simulator. +The unit of the damping constant for a rotational joint is expressed in *N.m.s/rad* whereas the unit of the damping constant for a linear joint is expressed in *N.s/m*. %figure "Mechanical Diagram of a Slider Joint" diff --git a/lib/controller/python/controller/camera.py b/lib/controller/python/controller/camera.py index 2a86cb4ee61..9b16dfabf98 100644 --- a/lib/controller/python/controller/camera.py +++ b/lib/controller/python/controller/camera.py @@ -76,10 +76,6 @@ def __init__(self, name: Union[str, int], sampling_period: int = None): self._enable = wb.wb_camera_enable self._get_sampling_period = wb.wb_camera_get_sampling_period super().__init__(name, sampling_period) - width = self.width - height = self.height - wb.wb_camera_get_image.restype = ctypes.POINTER(ctypes.c_ubyte * (4 * width * height)) - wb.wb_camera_recognition_get_segmentation_image.restype = ctypes.POINTER(ctypes.c_ubyte * (4 * width * height)) def getExposure(self) -> float: return self.exposure @@ -161,10 +157,12 @@ def setFov(self, f: float): @property def image(self) -> bytes: + wb.wb_camera_get_image.restype = ctypes.POINTER(ctypes.c_ubyte * (4 * self.width * self.height)) return bytes(wb.wb_camera_get_image(self._tag).contents) @property def segmentation_image(self) -> bytes: + wb.wb_camera_recognition_get_segmentation_image.restype = ctypes.POINTER(ctypes.c_ubyte * (4 * self.width * self.height)) return bytes(wb.wb_camera_recognition_get_segmentation_image(self._tag).contents) @property diff --git a/scripts/packaging/sync_controller_lib.sh b/scripts/packaging/sync_controller_lib.sh deleted file mode 100755 index 0207a2d2850..00000000000 --- a/scripts/packaging/sync_controller_lib.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash - - -# WEBOTS_HOME has to be specified -if [ -z "${WEBOTS_HOME}" ]; then - WEBOTS_HOME=$(pwd) -fi - -VERSION=$(cat ${WEBOTS_HOME}/scripts/packaging/webots_version.txt | sed 's/ /-/g') - -# Dynamic libraries to be copied -DYNAMIC_LIBS="Controller CppController car CppCar driver CppDriver" - -# Don't publish the libcontroller if it hasn't changed since yesterday -LAST_COMMIT_YESTERDAY=$(git log -1 --pretty=format:"%H" --before=yesterday) -LAST_COMMIT=$(git log -1 --pretty=format:"%H") -INCLUDE_DIFF_SINCE_YESTERDAY=$(git diff ${LAST_COMMIT_YESTERDAY}..${LAST_COMMIT} -- include/controller) -SOURCE_DIFF_SINCE_YESTERDAY=$(git diff ${LAST_COMMIT_YESTERDAY}..${LAST_COMMIT} -- src/controller) -VEHICLE_DIFF_SINCE_YESTERDAY=$(git diff ${LAST_COMMIT_YESTERDAY}..${LAST_COMMIT} -- projects/default/librairies/vehicle) -if [ -z "${INCLUDE_DIFF_SINCE_YESTERDAY}" ] && [ -z "${SOURCE_DIFF_SINCE_YESTERDAY}" ] && [ -z "${VEHICLE_DIFF_SINCE_YESTERDAY}" ]; then - echo "There are no changes in 'include/controller', 'src/controller' and 'projects/default/librairies/vehicle' since yesterday" - echo "Last commit yesterday: ${LAST_COMMIT_YESTERDAY}" - echo "Last commit today: ${LAST_COMMIT}" - exit 0 -fi - -# Get the repo -rm -rf /tmp/webots-controller || true -if [ ! -z "${GITHUB_ACTOR}" ]; then - git config --global user.name ${GITHUB_ACTOR} - git config --global user.email ${GITHUB_ACTOR}@github.com -fi -git clone git@github.com:cyberbotics/webots-libcontroller.git /tmp/webots-controller -if [ ! -d /tmp/webots-controller ]; then - echo 'The repository is not properly cloned' - exit 1 -fi -cd /tmp/webots-controller - -if [ ! -z $(git branch -a | egrep "/${VERSION}$") ]; then - echo "Checkout to the existing branch ${VERSION}" - git checkout ${VERSION} -else - echo "Create a new branch ${VERSION}" - git checkout -b ${VERSION} -fi - -# Copy headers and C++ source code -if [ "${OSTYPE}" != "msys" ]; then - # don't copy the include files on Windows as they are the same as on other platforms, and they generate a huge diff due to Windows line endings which differ from Linux/macOS. - rm -rf include - mkdir -p include - cp -r ${WEBOTS_HOME}/include/controller/* include - cp ${WEBOTS_HOME}/include/controller/c/webots/plugins/robot_window/{robot_window.h,robot_wwi.h} include - - rm -rf source/cpp - mkdir -p source/cpp/vehicle - cp ${WEBOTS_HOME}/src/controller/cpp/*.cpp source/cpp - cp ${WEBOTS_HOME}/projects/default/libraries/vehicle/cpp/car/src/Car.cpp source/cpp/vehicle - cp ${WEBOTS_HOME}/projects/default/libraries/vehicle/cpp/driver/src/Driver.cpp source/cpp/vehicle -fi - -# Copy dynamic libs -rm -rf lib/${OSTYPE} -mkdir -p lib/${OSTYPE} -for filename in $DYNAMIC_LIBS; do - echo $filename - find ${WEBOTS_HOME}/lib/controller -maxdepth 1 -name "*${filename}*" | xargs -I{} cp {} lib/${OSTYPE} -done - -# Copy Python libs -cp -r ${WEBOTS_HOME}/lib/controller/python lib/${OSTYPE}/ - -# Push -git add -A -git commit -m "Automatic update" -git push origin ${VERSION} diff --git a/src/webots/nodes/WbGeometry.cpp b/src/webots/nodes/WbGeometry.cpp index a79d3a1d5f0..9a9b512afd0 100644 --- a/src/webots/nodes/WbGeometry.cpp +++ b/src/webots/nodes/WbGeometry.cpp @@ -470,7 +470,10 @@ void WbGeometry::setOdeData(dGeomID geom, WbMatter *matterAncestor) { if (!areOdeObjectsCreated()) createOdeObjects(); + if (mOdeGeom) + dGeomDestroy(mOdeGeom); mOdeGeom = geom; + WbSolid *s = dynamic_cast(matterAncestor); if (s) dGeomSetData(geom, new WbOdeGeomData(s, this));