Skip to content

Commit ed0d149

Browse files
CoolSpy3sean85914
andauthored
Fix addTorque and addForceWithOffset Python Implementations (#6881)
* Fix python method implementations --------- Co-authored-by: sean85914 <[email protected]> * update the changelog --------- Co-authored-by: sean85914 <[email protected]>
1 parent 2f34918 commit ed0d149

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

docs/reference/changelog-r2025.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- Fixed a bug causing supervisors to occasionally read stale field values after the simulation was reset ([#6758](https://github.com/cyberbotics/webots/pull/6758)).
2020
- Fixed a bug causing Webots to occasionally crash when unloading a world ([#6857](https://github.com/cyberbotics/webots/pull/6857)).
2121
- Fixed a crash occurring when Python was not found on Windows ([#6870](https://github.com/cyberbotics/webots/pull/6870)).
22+
- Fixed `addForceWithOffset` and `addTorque` doing the same thing as `addForce` in Python ([#6881](https://github.com/cyberbotics/webots/pull/6881)).
2223

2324
## Webots R2025a
2425
Released on January 31st, 2025.

lib/controller/python/controller/node.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,11 @@ def addForce(self, force: typing.List[float], relative: bool):
218218
wb.wb_supervisor_node_add_force(self._ref, (ctypes.c_double * 3)(*force), 1 if relative else 0)
219219

220220
def addForceWithOffset(self, force: typing.List[float], offset: typing.List[float], relative: bool):
221-
wb.wb_supervisor_node_add_force(self._ref, (ctypes.c_double * 3)(*force), (ctypes.c_double * 3)(*offset),
222-
1 if relative else 0)
221+
wb.wb_supervisor_node_add_force_with_offset(self._ref, (ctypes.c_double * 3)(*force), (ctypes.c_double * 3)(*offset),
222+
1 if relative else 0)
223223

224224
def addTorque(self, torque: typing.List[float], relative: bool):
225-
wb.wb_supervisor_node_add_force(self._ref, (ctypes.c_double * 4)(*torque), 1 if relative else 0)
225+
wb.wb_supervisor_node_add_torque(self._ref, (ctypes.c_double * 3)(*torque), 1 if relative else 0)
226226

227227
@property
228228
def DEF(self) -> str:

0 commit comments

Comments
 (0)