forked from cyberbotics/webots
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Non-Swig Python API (cyberbotics#5297)
* simplified * Support more field operations * swiched API to PEP8 snake case * ENU fix * Update ansi_codes.c * Update __init__.py * Update ansi_codes.py * Update WB_CONSTANTS.py * Update camera.py * Update constants.py * Update distance_sensor.py * Update emitter.py * Update field.py * Update keyboard.py * Update motor.py * Update node.py * Update receiver.py * Update wb.py * Update mybot_simple.py * Update robot.py * Update sensor.py * Update supervisor.py * Fixed line endings * Fixed line endings * useless * progress with old API implementation * Working mybot_simple with legacy API * slave.py working with legacy API * progress with driver.py legacy support * Fixed imports * Fully working python example with legacy API * cleanup * clean-up * clean-up * Update mybot.wbt * Update .mybot.wbproj * Disabled old PYTHONPATH * Removed python swig build system * updated distribution and synchronization scripts * Led support * Support for accelerometer * Altimeter * Brake * Brake * Camera (unfinished) * Working camera example * Support for non-ascii user folders * Working camera_auto_focus * PEP8 * camera_recognition working * compass * connector * display * Display sample code * working display * clean-up * camera segmentation * Fixed lookup_table * distance sensor * emitter * gps * Better receiver * GPS & Receiver * Added deprecation message for Receiver.getData * gps * Better emitter * GPS examples * Support for tuples in emitter * gyro * InertialUnit * improved description * fixed restypes * Better parameter naming * Progress with Lidar * Update connector.py * Update connector.py * Update display.py * Update distance_sensor.py * Lidar (preliminary) * Fixed Camera.getImageArray * completed lidar * light sensor * Fixed line ending for lidar_point.py * Fixed PEP8 * Added battery support * motor * Removed python vehicle libraries * Removed Darwin-OP python manager library * motor * pen * position sensor * Propeller example * radar * RangeFinder * receiver * skin * speaker * bumper * force/force3d demos * Added mouse, keyboard and joystick * Fixed mouse * robot * supervisor node and field APIs * supervisor * Vehicle libraries skeleton * fixed line ending * Removed python library for manager * Motion API * Various fixes * Removed duplicates * Supervisor example * Fixed retrival of contact points * Fixed mouse * removed debug statement * Progress with Driver API * Increased robustness of node/field APIs * Progress with driver API * Progress with driver API * Driver API * Car API * replaced marathon Python controller with a C++ controller * battery device example * Coupled motors * display supervisor * encoders * hinge_joint_with_backlash * Removed binary controller: sick_cloud_point * clang-format * pep8 * Cross platform shared library loader * Updated change log * Cross-platform libcar/libdriver * Update driver.py * Added creation of python soft link on macOS installation * Update projects/samples/devices/controllers/altimeter/altimeter.py Co-authored-by: Benjamin Délèze <[email protected]> * Added missing methods * Fixed missing type annotation * Fixed missing setExposure method * Fixed return data type * Fixed Camera.getImageArray * Fixed Camera.getRecognitionSegmentationImageArray * Fixed example to use documented methods instead of getters * Update projects/samples/devices/controllers/compass/compass.py Co-authored-by: Benjamin Délèze <[email protected]> * Update projects/samples/devices/controllers/connector/connector.py Co-authored-by: Benjamin Délèze <[email protected]> * Fixed display polygon methods * Update projects/samples/robotbenchmark/humanoid_marathon/controllers/marathon/marathon.cpp Co-authored-by: Benjamin Délèze <[email protected]> * Update projects/samples/robotbenchmark/humanoid_marathon/controllers/marathon/marathon.cpp Co-authored-by: Benjamin Délèze <[email protected]> * Fixed missing Makefile target (marathon) * Update projects/samples/devices/controllers/emitter_receiver/emitter_receiver.py Co-authored-by: Benjamin Délèze <[email protected]> * Fixed emitter_receiver example * Fixed emitter range * type annotation clean-up * Added missing return type annotation * Add missing camera method to fix nao_demo_python * Remove debug statements in lidar example * Fixed Lidar.getLayerRangeImage * Fixed light sensor lookup table retrieval method * Fixed motor missing return values * Fixed missing PositionSensor.getType method * Update lib/controller/python/controller/range_finder.py Co-authored-by: Benjamin Délèze <[email protected]> * Receiver.getDataSize() * Fixed Lidar.getFrequency() * Fixed lidar example * Added lidar point cloud example * Fixed Lidar.getLayerPointCloud * Fixed setting of PYTHON_HOME path * Fixed PYTHON_PATH in Windows workflows * Fixed mouse state * Fixed Supervisor.getFromProtoDef * Fix LightSensor.getLookupTable * Fixed Camera.get*ImageArray() methods * Added default value for Robot.getUrdf() * Fixed support for Python versions > 10 * Update WbLanguageTools.cpp * Fixed compilation on macOS * Update src/webots/control/WbLanguageTools.cpp Co-authored-by: Yannick Goumaz <[email protected]> * Updated extern controller documentation * Update lib/controller/python/vehicle/driver.py Co-authored-by: Yannick Goumaz <[email protected]> * Update lib/controller/python/vehicle/driver.py Co-authored-by: Yannick Goumaz <[email protected]> * Update lib/controller/python/vehicle/driver.py Co-authored-by: Yannick Goumaz <[email protected]> * Update lib/controller/python/vehicle/driver.py Co-authored-by: Yannick Goumaz <[email protected]> Co-authored-by: Benjamin Délèze <[email protected]> Co-authored-by: Yannick Goumaz <[email protected]>
1 parent
0ca7cb5
commit a04d858
Showing
151 changed files
with
7,685 additions
and
2,380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright 1996-2022 Cyberbotics Ltd. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from controller.field import Field # noqa | ||
from controller.node import Node # noqa | ||
from controller.ansi_codes import AnsiCodes # noqa | ||
from controller.accelerometer import Accelerometer # noqa | ||
from controller.altimeter import Altimeter # noqa | ||
from controller.brake import Brake # noqa | ||
from controller.camera import Camera # noqa | ||
from controller.compass import Compass # noqa | ||
from controller.connector import Connector # noqa | ||
from controller.display import Display # noqa | ||
from controller.distance_sensor import DistanceSensor # noqa | ||
from controller.emitter import Emitter # noqa | ||
from controller.gps import GPS # noqa | ||
from controller.gyro import Gyro # noqa | ||
from controller.inertial_unit import InertialUnit # noqa | ||
from controller.led import LED # noqa | ||
from controller.lidar import Lidar # noqa | ||
from controller.light_sensor import LightSensor # noqa | ||
from controller.motor import Motor # noqa | ||
from controller.position_sensor import PositionSensor # noqa | ||
from controller.radar import Radar # noqa | ||
from controller.range_finder import RangeFinder # noqa | ||
from controller.receiver import Receiver # noqa | ||
from controller.robot import Robot # noqa | ||
from controller.skin import Skin # noqa | ||
from controller.speaker import Speaker # noqa | ||
from controller.supervisor import Supervisor # noqa | ||
from controller.touch_sensor import TouchSensor # noqa | ||
from controller.keyboard import Keyboard # noqa | ||
from controller.mouse import Mouse # noqa | ||
from controller.mouse import MouseState # noqa | ||
from controller.joystick import Joystick # noqa | ||
from controller.motion import Motion # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright 1996-2022 Cyberbotics Ltd. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from controller.sensor import Sensor | ||
from controller.wb import wb | ||
import ctypes | ||
import typing | ||
|
||
|
||
class Accelerometer(Sensor): | ||
wb.wb_accelerometer_get_values.restype = ctypes.POINTER(ctypes.c_double) | ||
wb.wb_accelerometer_get_lookup_table.restype = ctypes.POINTER(ctypes.c_double) | ||
|
||
def __init__(self, name: typing.Union[str, int], sampling_period: int = None): | ||
self._enable = wb.wb_accelerometer_enable | ||
self._get_sampling_period = wb.wb_accelerometer_get_sampling_period | ||
super().__init__(name, sampling_period) | ||
|
||
def getValues(self) -> typing.List[float]: | ||
return self.value | ||
|
||
def getLookupTable(self) -> typing.List[float]: | ||
return self.lookup_table | ||
|
||
@property | ||
def lookup_table(self) -> typing.List[float]: | ||
size = wb.wb_accelerometer_get_lookup_table_size(self._tag) | ||
return wb.wb_accelerometer_get_lookup_table(self._tag)[: 3 * size] | ||
|
||
@property | ||
def value(self) -> typing.List[float]: | ||
return wb.wb_accelerometer_get_values(self._tag)[:3] |
Oops, something went wrong.