A previous change didn't really ignore the return value of fread() and
a warning was still emitted:
-----------------------------------------------------------------------
[103/1571] Building C object src/xrt/drivers/CMakeFiles/drv_ns.dir/north_star/ns_hmd.c.o
../src/xrt/drivers/north_star/ns_hmd.c: In function ‘ns_config_load’:
../src/xrt/drivers/north_star/ns_hmd.c:512:8: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
512 | (void)fread(json, 1, file_size, config_file);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------------
Check the return value of fread to fix the warning for good, and declare
the return value of ftell as long as stated in the man page.
On some systems fread() is declared with attribute warn_unused_result
and this results in a build warning:
-----------------------------------------------------------------------
Building C object src/xrt/drivers/CMakeFiles/drv_ns.dir/north_star/ns_hmd.c.o
.../src/xrt/drivers/north_star/ns_hmd.c: In function ‘ns_config_load’:
.../src/xrt/drivers/north_star/ns_hmd.c:512:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
512 | fread(json, 1, file_size, config_file);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------------
Explicitly ignore the return value of that fread() to silence the
warning.
And while at it also close config_file in some error paths between
fopen() and fclose() which where leaking the file pointer when jumping
to the parse_error label.
The dy name was kept. It can now be thought of as "[d]erivative of [y]"
instead of the previous "change of y". Also, the beta parameters of the
one-euro users were adjusted by approximately multiplying them by 0.016
to compensate.
Useful for setups that need some tuning to their sensors before sending
data to a SLAM system.
Removes the submit_frames property from wmr_camera as this replaces it.
Commit 749723f0ba ("xrt: Remove xrt_view::display::{w|h}_meters")
accidentally removed some references to {w|h}_pixels as well as
{w|h}_meters. This resulted in recommended view image sizes of 0px*0px.
Revert those changes without reverting the rest of the commit.
Fixes: 749723f0ba ("xrt: Remove xrt_view::display::{w|h}_meters")
../src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp: In function ‘int cemu_devices_create(xrt_device*, xrt_device*, xrt_device**)’:
../src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp:439:102: warning: ‘ Left Hand’ directive output may be truncated writing 10 bytes into a region of size between 1 and 256 [-Wformat-truncation=]
439 | int ret = snprintf(cemud[i]->base.str, XRT_DEVICE_NAME_LEN, i ? "%s Right Hand" : "%s Left Hand", hands->str);
| ^~~~~~~~~~
../src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp:439:35: note: ‘snprintf’ output between 11 and 266 bytes into a destination of size 256
439 | int ret = snprintf(cemud[i]->base.str, XRT_DEVICE_NAME_LEN, i ? "%s Right Hand" : "%s Left Hand", hands->str);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp:439:84: warning: ‘ Right Hand’ directive output may be truncated writing 11 bytes into a region of size between 1 and 256 [-Wformat-truncation=]
439 | int ret = snprintf(cemud[i]->base.str, XRT_DEVICE_NAME_LEN, i ? "%s Right Hand" : "%s Left Hand", hands->str);
| ^~~~~~~~~~~
../src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp:439:35: note: ‘snprintf’ output between 12 and 267 bytes into a destination of size 256
439 | int ret = snprintf(cemud[i]->base.str, XRT_DEVICE_NAME_LEN, i ? "%s Right Hand" : "%s Left Hand", hands->str);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/xrt/drivers/wmr/wmr_config.h:15,
from ../src/xrt/drivers/wmr/wmr_config.c:16:
In function ‘wmr_config_parse_camera_config’,
inlined from ‘wmr_config_parse_calibration’ at ../src/xrt/drivers/wmr/wmr_config.c:422:8,
inlined from ‘wmr_hmd_config_parse’ at ../src/xrt/drivers/wmr/wmr_config.c:477:13:
../src/xrt/auxiliary/util/u_logging.h:84:25: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
84 | u_log(__FILE__, __LINE__, __func__, level, __VA_ARGS__); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/xrt/auxiliary/util/u_logging.h:220:38: note: in expansion of macro ‘U_LOG_IFL’
220 | #define U_LOG_IFL_E(cond_level, ...) U_LOG_IFL(U_LOGGING_ERROR, cond_level, __VA_ARGS__)
| ^~~~~~~~~
../src/xrt/drivers/wmr/wmr_config.c:22:35: note: in expansion of macro ‘U_LOG_IFL_E’
22 | #define WMR_ERROR(log_level, ...) U_LOG_IFL_E(log_level, __VA_ARGS__)
| ^~~~~~~~~~~
../src/xrt/drivers/wmr/wmr_config.c:267:17: note: in expansion of macro ‘WMR_ERROR’
267 | WMR_ERROR(log_level, "Invalid camera calibration block %d - unknown camera purpose %s", c->n_cameras,
| ^~~~~~~~~
../src/xrt/drivers/wmr/wmr_config.c: In function ‘wmr_hmd_config_parse’:
../src/xrt/drivers/wmr/wmr_config.c:267:100: note: format string is defined here
267 | WMR_ERROR(log_level, "Invalid camera calibration block %d - unknown camera purpose %s", c->n_cameras,
| ^~
Implement reading and logging of controller firmware blocks.
The main JSON configuration is obfuscated. The raw block can
be dumped to disk by setting the WMR_CONFIG_DUMP env var
to point to a directory to receive controller configs
Recognise the HP Reverb G2 WMR controller if it is directly
connected via bluetooth (instead of tunnelled through the
headset like it normally would be).
Instead of negating Y and Z readings from the IMU when
parsing, parse the native values, then apply the rotation
using the centerline transform before fusion.
Extract timestamp in source 100ns units and convert to
nanoseconds, then place them in the emitted xrt_frames.
Unwrap the 8-bit frame sequence counter to 64-bits, and
add that too.
Add some comments and debug for other fields in the
incoming data.
OpenHMD has a global variable wmr_config_key too which is exported in some
build configurations, causing Monado to fail linking openhmd and the wmr
driver together.
Add a debug report for 0x17 packets on Reverb G2 that
report controller statuses. The statuses seen so far
are 0x0 for unpaired, 0x1 for paired but offline, and
0x2 for online. Paired reports provide VID and PID for the
associated motion controller.
Handle the debug message packet from the bluetooth
interface on the HP G2. There might be other packet
types, but that's the only one I've seen so far.
Compute the frame size required for the cameras on a given
headset.
Copy the pixels out into an xrt_frame, then send it
to a debug sink - one for SLAM tracking exposures, and
1 for controller frames.
Based on a patch by Jakob Bornecrantz
Older linux kernels like 4.15 don't have V4L2_CID_DIGITAL_GAIN or
V4L2_CTRL_FLAG_MODIFY_LAYOUT, add conditional guards to build
successfully on systems with such kernels.
This matches the OpenXR usage: the array is the plural of the element type,
and the count is the singular element type plus "count" (usually CountOutput
because of the two-call idiom)
Includes fixes to other code to match API changes.
We now have a cmake-format config file.
We no longer use list variables for sources, instead using
target_sources when we need to add, in accordance with current
best practice. (This makes it a lot easier to edit too.) There's no more
include_directories(), add_definitions(), or other gently-deprecated
directory-scoped commands, nor any CMake scripts that include
a parent directory reference (named targets instead)
Use a similar "hardcoded" idea as in p_factory_ensure_frameserver.
This fix usage of SLAM sources in other contexts like calibration, at the
cost of requiring a device to call create_tracked_slam at least once.
(again, similar to how psmv/psvr/hand tracking work already)
- Prevent race conditions with a lock
- Check that timestamps "domains" are the same across samples
- Use faster sensor to push the IMU sample instead of always gyro
After using the structure a bit more, and realizing that while different components
sometimes use different units, it is easier to force them to send the imu_samples
in a standardized unit.
This device was tested on a D455 but should work on any other RealSense camera
that supports camera and IMU streams (even the T265), given that you properly
configure the external SLAM config file.
This commit introduces the term `ddev` for a "Device-SLAM tracked device",
it will be useful to differentiate itself from the `hdev`
("Host-SLAM tracked device") that will be introduced in next commits.
Note that "config_realsense" json field was renamed to "config_realsense_device"
and the device's serial (used for tracking overrides) changed from
"Intel RealSense 6-DOF" to "Intel RealSense Device-SLAM".
This discards the pose correction logic used that was for the D455 not for
an euroc dataset. It will be reintroduced in a later commit with an
appropriate device.
- Implement xrt_slam_source instead of xrt_fs
- Merge intermediate sink pointers into xrt_slam_sinks in_sinks
- Add out_sinks for downstream passage of data
- Make speed playback option a double (float was not precise enough)
- Add use_source_ts playback option to optionally use original dataset timestamps
- Fix colored datasets not working
On recent libsurvive versions, loading the config of the HMD takes quite
long when only a HMD is active without controllers.
Instead of adjusting the timeout value all the time, rework how we wait for
the device configs.
Previously we just waited for device configs to arrive until no new configs
arrive for a predefined timeout.
Now we count how many objects of interest libsurvive actually knows, and then
only wait until the configs for this many devices are loaded.
This should make initialization of the survive driver faster and more robust.
A squash of the following commits.
d/euroc: Add Euroc driver initial boilerplate
d/euroc: Implement xrt_frame_node interface
d/euroc: Implement mainloop thread start flow
d/euroc: Parse samples from data.csv files
d/euroc: Determine dataset information at start
Also use that information to provide a xrt_fs mode and to know if
right camera images are available to use.
d/euroc: Produce frames for left and right sinks
d/euroc: Implement xrt_imu_sink
d/euroc: Implement playback properties
d/euroc: Implement pausing with UI state machine
d/euroc: Show IMU and progress data in UI
d/euroc: Make sure to give in nullptr or valid pointers to wrapL8
d/euroc: Unreference frames when done with them
d/euroc: Fix leaks with debug sinks, and work around free issue
d/euroc: Refactor playback to produce samples with current timestamps
d/euroc: Fix double free by separating debug sinks from downstream sinks
../src/xrt/drivers/ultraleap_v2/ulv2_driver.cpp: In function 'void* leap_input_loop(void*)':
../src/xrt/drivers/ultraleap_v2/ulv2_driver.cpp:290:29: warning: 'hi' may be used uninitialized in this function [-Wmaybe-uninitialized]
290 | int hi; // hand index
| ^~
In release builds asserts will be disabled, so we should try to handle the
assert cases reasonably.
This commit fixes several unused variable warnings when asserts are disabled.
Take the parameters from the headset configuration and the existing
render FoV, and use them to instantiate a distortion mesh.
TODO: Reverse the distortion in order to calculate good FoV range
that covers the full view for each headset.
Sketch out some groundwork for parsing WMR config blocks,
using some hard-coded values from my headset for now. Later,
this will be parsed from the headset JSON blob.