GithubHelp home page GithubHelp logo

Comments (14)

MartyG-RealSense avatar MartyG-RealSense commented on May 16, 2024 1

I will discuss your issue with my Intel RealSense colleagues. Thanks very much for your patience.

from librealsense.

MartyG-RealSense avatar MartyG-RealSense commented on May 16, 2024

Hi @oscarthorn If one of the existing Visual Presets (jsons) provided by the RealSense SDK is close to your custom json then you could try applying that preset instead of loading your custom json as a string by using the C++ code at the link below.

https://www.intel.com/content/www/us/en/support/articles/000028416/emerging-technologies/intel-realsense-technology.html

Here is a list of the parameter names of the presets so that you can amend the code in the above link to use the appropriate preset.

RS2_RS400_VISUAL_PRESET_CUSTOM
RS2_RS400_VISUAL_PRESET_DEFAULT
RS2_RS400_VISUAL_PRESET_HAND
RS2_RS400_VISUAL_PRESET_HIGH_ACCURACY
RS2_RS400_VISUAL_PRESET_HIGH_DENSITY
RS2_RS400_VISUAL_PRESET_MEDIUM_DENSITY
RS2_RS400_VISUAL_PRESET_REMOVE_IR_PATTERN
RS2_RS400_VISUAL_PRESET_COUNT

from librealsense.

oscarthorn avatar oscarthorn commented on May 16, 2024

Hi @MartyG-RealSense, no none of the presets are suitable

from librealsense.

MartyG-RealSense avatar MartyG-RealSense commented on May 16, 2024

In addition to the C++ json cases that you linked to at the beginning, there is also another example of using dev.asrs400::advanced_mode(); at #3277 (comment)

A less efficient alternative to json may be to investigate whether the settings that you are using in the json can be applied with C++ script code instead.

If your preference is to use the custom json file then you could investigate whether using threads and putting the record function on a separate thread from the json loading code might make a difference. There is a C++ threads example at #6865 though I would personally recommend against using threading unless there is no other option as it makes programs more complex.

from librealsense.

oscarthorn avatar oscarthorn commented on May 16, 2024

The problem is not with the json loading the problem is that dev.as<rs400::advanced_mode>(); returns a nullptr. Could you clarify if #3277 is relevant to that?

I have no problem setting them manually, are the settings available without accessing advanced mode with dev.as<rs400::advanced_mode>();?

There is no recording function to put on a separate thread, please clarify if there is something I could change. This problem occurs regardless of if dev.as<rs400::advanced_mode>(); is called before or after pipe.start().

from librealsense.

MartyG-RealSense avatar MartyG-RealSense commented on May 16, 2024

It would depend on which settings you want to change. If they are Advanced Mode settings then there is little available documentation for controlling those options, unfortunately. If it is non-Advanced Mode options such as exposure then it is straightforward to change those with C++ code.

There is not enough information available about this particular nullptr issue (using json + record in the same script) for me to offer advice about the relevancy of #3277 unfortunately. I do apologize.

#3802 is a C++ discussion about implementing threading for recording a bag with cfg.enable_record_to_file()

from librealsense.

oscarthorn avatar oscarthorn commented on May 16, 2024

Is there a way to get a hold of the developer team for librealsense to get the bug resolved? So far I have traced it to the serializable_device constructor setting the device to null.

from librealsense.

oscarthorn avatar oscarthorn commented on May 16, 2024

My findings so far
dev.as<rs400::advanced_mode>(); calls as() in rs_device.hpp which tries to construct the correct type advanced_mode. The advanced_mode constructor calls the serializable_device constructor which in turn sets _dev (the member variable that holds the actual rs2_device struct) to nullptr since rs2_is_device_extendable_to(_dev.get(), RS2_EXTENSION_SERIALIZABLE, &e) returns 0.

I will try to determine why that is, my assumption is that there is some interface/inheritance missing somewhere which causes the VALIDATE_INTERFACE_NO_THROW, macro to fail but it would be good to get input from someone involved in this code.

from librealsense.

oscarthorn avatar oscarthorn commented on May 16, 2024

Okey, so the main issue seems to be that in VALIDATE_INTERFACE_NO_THROW_ADV the statement ext->extend_to(TypeToExtension<T>::value, (void**)&p) evaluates to false since extend_to in record_device does not implement RS2_EXTENSION_SERIALIZABLE as an extension it can extend to. Not sure if this is an oversight or on purpose.

from librealsense.

oscarthorn avatar oscarthorn commented on May 16, 2024

Just adding the serializable extension and making it extend to advanced seems to resolve the issue. Though I'm not sure if this is a valid solution. I tried extending it to serializable but that interface does not have create_snapshot which is expected by write_device_extension_changes. So I would love clarification from a developer if this is a valid solution that you can implement (or I can open a PR).

case RS2_EXTENSION_SERIALIZABLE:
case RS2_EXTENSION_ADVANCED_MODE   : return extend_to_aux<RS2_EXTENSION_ADVANCED_MODE  >(m_device, ext);

from librealsense.

oscarthorn avatar oscarthorn commented on May 16, 2024

Don't have time to investigate that also but dev.first<rs2::color_sensor>().as<rs2::roi_sensor>() also seems to return nullptr if you have enabled recording.

Used to set region of interest for exposure with .set_region_of_interest(roi);

from librealsense.

MartyG-RealSense avatar MartyG-RealSense commented on May 16, 2024

Hi @oscarthorn My colleagues were able to replicate the issue and created an internal Intel report so that it can be investigated as a possible bug. They also said that you are more than welcome to submit a PR.

I have added an Enhancement label to this case to signify that it should be kept open.

from librealsense.

oscarthorn avatar oscarthorn commented on May 16, 2024

Hi @MartyG-RealSense Thanks, sounds good!

For now I found a workaround after realizing that realsense-viewer does not seem to have the same problem. After looking at the code the it seems to use the recorder class directly and not setting the record setting on the pipeline. Just instantiating with recorder = std::make_shared<recorder>(path, dev); seems to do the trick without polluting the device interface. You can then use the usual functions and if you want to stop recording you can just run recorder.reset(); and the restart again (possibly to a different file) with recorder.reset(new rs2::recorder(path, dev)); Perhaps this method of recording could be added to the examples or documentation?

Thanks for the help!

from librealsense.

MartyG-RealSense avatar MartyG-RealSense commented on May 16, 2024

You are very welcome. Thanks so much for sharing the details of your workaround!

from librealsense.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.