cyberbotics / webots

Webots Robot Simulator
https://cyberbotics.com
Apache License 2.0
3.26k stars 1.7k forks source link

ForceSensor seems not to work on prismatic joints #6237

Closed correll closed 1 year ago

correll commented 1 year ago

Describe the Bug I try to enable the force sensor on the "gripper_left_finger_joint" of the Tiago Steel robot

Steps to Reproduce

  1. Open a world with a Tiago Steel and a Python controller (error should be reproducable for any prismatic joint)

  2. Use the following code snippet

    leftfinger = robot.getDevice('gripper_left_finger_joint') leftfinger.enableForceFeedback(32)

  3. The error is

Traceback (most recent call last): File "/Users/correll/Library/CloudStorage/OneDrive-UCB-O365/Materials_Lectures_Labs_HWs/coursera/part iii/webots/controllers/manipulation/manipulation.py", line 95, in leftfinger.enableForceFeedback(32) TypeError: enableForceFeedback() takes 1 positional argument but 2 were given WARNING: 'manipulation' controller exited with status: 1.

Expected behavior I should be able to provide the timestep. This only works when using enableTorqueFeedback(32), but the finger joint is a linear actuator.

System

stefaniapedrazzi commented 1 year ago

I suppose you are using Webots R2023a. In Webots R2023a, the Motor.enableForceFeedback function in the Python API was buggy and the sampling period argument was missing. This has already been fixed (see https://github.com/cyberbotics/webots/pull/5797). The nightly builds of R2023a-rev1 are no longer available, so if you don't want to upgrade to R2023b (that will be released very soon), you can also simply patch the lib/controller/python/controller/motor.py in your Webots installation.