Using MCAP for URDFs - foxglove-studio

I'm having trouble with the transportability of my URDF files. Specifically I'm unable to get them to load in Foxglove Studio. Is it possible to add a URDF as an attachment in an MCAP file so that it's somehow fully encapsulated and just opens by robot definition at the same time as visualizing my robot data?
I've tried opening my URDF file directly in Foxglove Studio's web client and it fails. I seem to be able to open it in the desktop tool.

See the work in progress here: https://github.com/foxglove/studio/pull/4725
The basic idea is all asset fetch() requests go through a proxy function in the Studio data source (player). For MCAP, the player checks for an attachment with the name equal to the requested URL, such as package://foo/bar.dae and returns that if present, otherwise falling back to fetch().

Related

cfapi: CfDehydratePlaceholder seems to be stucked

My target is, that files can be hydrated or dehydrated on user request via the Explorer "free up space" or "Always keep on Device" ContextMenu entry. In case I create a new placeholder file that is dehydrated from the beginning, everything works and I can hydrate it via the callback mechanics. But the way around does not work for me. Inside of the Explorer the file will be marked as UnPinned and the file will be marked as syncing, but my application does not receive any callback from CF_CALLBACK_TYPE_NOTIFY_DEHYDRATE or CF_CALLBACK_TYPE_NOTIFY_DEHYDRATE_COMPLETION. Then I wanted to do it manually with CfDehydratePlaceholder, but exactly the same behaviour. Nothing happens and the file remains in the state, syncing. Even if I used CfSetInSyncState to set the state to CF_IN_SYNC_STATE_IN_SYNC it remains to be in the state syncing.
Now I wanted to implement a minimal example with the help of Cloud Mirror Example, but I realized it has the same behaviour. When I try to dehydrate a file again exactly the same happens there as well. From my perspective, it feels for me like cfapi expects an ack from the cloud service, which it never gets.
But in OneDrive everything works like expected. What I am missing? Did I have to set some specific settings?
I had a misunderstanding of the whole API and here is how I understand the API now, to help other people, who are struggling with it.
You have to register your sync root and connecting your app to it. In case of connecting it, you will receive a CF_CONNECTION_KEY, which is needed to communicate with the virtual filesystem. Then you can add extended attributes to all files inside of your sync root. The most important are custom attributes you can choose by yourself to identify the file object by your app if needed and then the PinState and SyncState. Mostly the SyncState don't have to be changed by the app, besides marking a file as synced after it was processed by the app. (you can do it at the moment you update your custom attributes) Because in case a file changed, the SyncState will automatically be changed. The PinState declares which final state a file should have. For example UNPINNED means, that the file should be dehydrated, and PINNED the opposite. It does not mean, that the file necessarily has already this state. My misunderstanding was, that I thought in case I unpinned a file, it will be automatically dehydrated. Or in case I pinned a placeholder I will receive a request via the callback function I mentioned in my question. But this is not the case. Your app needs to find out via a FileWatcher (i can recommend my own created FileWatcher project: https://github.com/neXenio/panoptes) that the file attribute of specific files was changed. Then your app has to process every step. Like already mentioned in case of dehydrating, the app needs to call CfDehydratePlaceholder. In case of hydrating, you need to open a transfer session via CfGetTransferKey and then hydrate (send the data to the empty file) via the method CfExecute, where you need the connection key and the transfer key. And that's are the basics. There is much more to tell about it, but I guess with this beginning, everybody can figure it out by himself.

How can I replace an exising file into the assets folder with a refresh stuff?

I'm develepping a BB10 mobile application using the momentics IDE.
I'm trying to save somes images coming from server into the "assets/images" folder using the Qt QFile object (you can see the code below) :
m_file = new QFile(argSavingFilePath);
if (m_file->exists()) {
m_file->remove();
}
m_file->open(QIODevice::WriteOnly);
m_file->write(argDataLoaded);
m_file->close();
m_file->~QFile();
It seems that is working but even if I exit out of the screen in question with the back button and then return it still doesn't show the latest image. It only works when I exit the app completely and launch a new instance.
According to this forum [link], they said :
"What's happening is that when you first load the image it gets read from the file system and then cached in memory. The app never goes back to re-read the image from the file. You would have to initiate that yourself."
How should I initiate the cashed memory myself ? is this the only solution ?
Whether the data is cached in memory or not is immaterial. The asset directory, in fact everything below and including the app directory is protected and immutable.
If you want to store data from a server the place to put it would be in data if you want it to persist, or tmp if not. Data in the tmp director is subject to removal by the OS when storage is needed for other things.
See: https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_system.html

imediacontrol->run returns E_ACCESSDENIED while running the graph in c++

I am trying to understand direct show and filters.For that I have downloaded code (from here) and I am able to run it .exe given in release folder. But now when I try to run that using visual studio 2010, following line
hr = m_pMediaControl -> Run( );
returns E_ACCESSDENIED. I tried to find answer on internet but didn't get anything.
This error is untypical and what happens is the Filter Graph Manager is unable to perform once of its internal tasks and then it forwards the error code back from internal operation to the caller (you). One of the filters in the graph could report failure on its state transition.
To troubleshoot this problem, you need to check the topology of the filter graph and then attempt to remove some of the filter until you get rid of the error. You will isolate the problem to specific filter.
If the application works when running it one way but not another, then it could be related to accessing the directory from which it is executed, such as a permissions problem. For example, perhaps you have a file sink which is trying to write to the current directory? If the file sink cannot write its output file, it will return an error such as E_ACCESSDENIED once IMediaControl->Run() is invoked. So - check your output paths and make sure you can create files and write to that directory.
As Roman points out, systematically removing filters one by one is probably the best way to isolate the error. It can be very helpful to either save the graph you created to a GRF file and inspect it with GraphEdit where you can experiment with it, or register the objects at runtime and play with the graph dynamically. Both these techniques are described in the DirectShow documentation on MSDN.

How do I check if a swf file loaded correctly since put_Movie always returns S_OK?

I am using the latest flash player and have a swf file served locally from my dev machine. In one container test app I am able to play the swf and make calls to it, but in my "Real" application the same code path results in com errors (basically it looks like the swf isn;' loading properly)
Additionally this is made more challenging because no matter what nonsense I put in the call to put_Movie() the return is ALWAYS S_OK. This is confusing.
How am I supposed to determine if the swf file loaded and is working?
As a follow-on, what would cause a swf file (the same one) not to load in a different app? The code paths are the same (from what I can tell).
Obviousl something is going on, but I am not sure what.
So, I guess 2 questions
How to know when swf file doesn't load right
Why might it fail in a different container application?
I am using ATL in Visual studio 2008, latest flash, MS Vista
Thanks
Hmm, it seems that if I listen for the DISPID_READYSTATECHANGE events then that helps me.
A value of '4' seems to indicate it is ready to accept method calls.

How can I read the source URL of a file downloaded with FireFox from an external application?

I have an C++ app I built which is registered as the default handler for a file with a specific extension. So when I download one of these files with Firefox from a website, it downloads it to a temp directory and then shell executes my app while passing the full path to the downloaded file on the command line.
What is the best way to figure out from the external app what the original download url of the file was, given only it's path on disk? Can I use XPCOM API calls to inspect the FireFox download manager database?
I've figured out that this data get's stored in the "%APPData%\Mozilla\Firefox\($profile)\downloads.sqlite" file which is a SqlLite db file, but I really rather not try to open this file directly as FireFox has an open write handle to the file while running.
After perusing the Mozilla developer center for a while, I ran accross the nsIDownloadManager service, which seems to be just the thing. But I can't seem to get access to it from XPCOM in a separate process?
Here's the code I am using:
nsresult rv;
//init XPCOM
nsCOMPtr<nsIServiceManager> servMgr;
rv = NS_InitXPCOM2(getter_AddRefs(servMgr), nsnull, nsnull);
NS_ENSURE_SUCCESS(rv, rv);
//Get a download manager instance
nsCOMPtr<nsIDownloadManager> downloadMgr;
rv = servMgr->GetServiceByContractID(NS_DOWNLOADMANAGER_CONTRACTID,
nsIDownloadManager::GetIID(), getter_AddRefs(downloadMgr));
NS_ENSURE_SUCCESS(rv, rv);
When I run this, the GetServiceByContractID() call returns 0x8007000e, which is defined in nsError.h as NS_ERROR_OUT_OF_MEMORY. (which I find very weird).
Any ideas here? Am I barking up the right tree?
No, you can't access Firefox's XPCOM objects from an external process, and you also shouldn't open the sqlite database while Firefox has it open. I don't know that there's any straightforward way to do what you want without writing a Firefox extension that has access to the Firefox internals.
I'm a little hazy on the details right now, but, assuming that your download is served with a custom MIME type, it's possible to register a handler for that type; your handler can then cancel the download and pass the URL to your application.