You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* add device constructors that accept a WbDeviceTag rather than a name
* create populate Robot::deviceList by tag rather than name
* update python api
* remove duplicate Brake destructor
* define WbDeviceTag in Robot
* update java api
* add api test
* bug fixes
* fix Java getDevice implementation
* update documentation
* fix warnings in test
* run clang-format
* make test objects constant
Co-authored-by: Olivier Michel <Olivier.Michel@cyberbotics.com>
* update changelog
* minor clarification
* fix capitalization of API
Co-authored-by: Olivier Michel <Olivier.Michel@cyberbotics.com>
* allow checking if const pointers are null
* use non-const Robot
---------
Co-authored-by: Olivier Michel <Olivier.Michel@cyberbotics.com>
@@ -874,7 +876,7 @@ Devices are available through their services.
874
876
875
877
*get a unique identifier to a device*
876
878
877
-
The `wb_robot_get_device` function (available in C, Python and MATLAB) returns a unique identifier for a device corresponding to a specified `name`.
879
+
The `wb_robot_get_device` function returns a unique identifier for a device corresponding to a specified `name`.
878
880
For example, if a robot contains a [DistanceSensor](distancesensor.md) node whose `name` field is "ds1", the function will return the unique identifier of that device.
879
881
This `WbDeviceTag` identifier will be used subsequently for enabling, sending commands to, or reading data from this device.
880
882
If the specified device is not found, the function returns 0 in C and MATLAB or `None` in Python.
@@ -885,6 +887,8 @@ Depending on the called function, this object can be an instance of a `Device` s
885
887
For example, if a robot contains a [DistanceSensor](distancesensor.md) node whose `name` field is "ds1", the function `getDistanceSensor` will return a reference to a [DistanceSensor](distancesensor.md) object.
886
888
If the specified device is not found, the function returns `NULL` in C++ or `null` in Java.
887
889
890
+
Note that if any two devices share the same name, `wb_robot_get_device` will return the first one it finds. In order to distinguish between devices with the same name, users should consider iterating over a robot's devices using `wb_robot_get_device_by_index` and `wb_robot_get_number_of_devices`.
0 commit comments