LinuxMCE Forums

Archive => Archive => Pluto Main General Issues => Topic started by: archived on March 09, 2005, 11:09:03 am

Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 09, 2005, 11:09:03 am
Hi,

I've installed and setup Pluto home but have some newbie problems and questions:
- Motion : I have put Hauppage WinTV in computer (I yet don't have proper video capture card) for video surveillance (use the composite input, where surveillance cam is connnected).

- Where are configuration files for motion, to see how to set it up ?
- I have also some USB cams I'm really satisfied with quality (Quickam PRO 4000). If I may suggest adding support also for those cameras with pwc module - I had motion running with this module and usb webcam (in Linux world almost all supported webcams are on pwc or ovxxx modules) ... This support will also be good for video conferencing.

- Hybrid Media director:
- I wonder how to add media files to Pluto (are there any samba shares that could be used?) Should I add more users ?
- I've slide in DVD but it won't play. Where are appropriate logs to take a look what happened ?
- How is IR remote control set up ? I have ATI wireless remote wonder - it was detected OK, but don't know where to look for related files...


- Mobile orbiter
- it looks nice, but some texts are hardly readable. I guess this comes from resizing of GUI pictures. Are there any better settings to solve this ?

- How to troubleshoot Pluto in general ? Logs, debugs, etc...


- Debian Sarge
Whoooh, I have quite some problems with HW detection and set up. Also shutdown is not made properly (machine still consumes 80 Watts after it says power off). Hercules Digifire card was crashing Pluto installation (now after it is installed, I can put it back in).
I've just clicked on pictures and Media director crashed (it's trying to run X, but it just won't go)... How to restart Orbiter ?

- How to enable Pluto as Firewall (2 network cards) ?

I guess doing Sarge and Pluto on different HW configs is little bit adventureous. Do you have any HW recomendations to go along ?

I have Asus p4p800-e Deluxe, but it seems like it is not love on first sight with Debian Sarge...

Sorry, I probably sound a little disapointed, but will try to get over this newbie problems. Thanks for great work - I hope it will work for me either...

Regards,

Rob.
Title: Re: Here we go - Pluto started but quite some of features de
Post by: archived on March 10, 2005, 10:37:09 am
Quote from: "tinia"
Hi,

I've installed and setup Pluto home but have some newbie problems and questions:
- Motion : I have put Hauppage WinTV in computer (I yet don't have proper video capture card) for video surveillance (use the composite input, where surveillance cam is connnected).

- Where are configuration files for motion, to see how to set it up ?


/etc/motion/motion.conf. I had to change it to suit WinTV PCI and camera on composite input. Can I solve this problem for all future Pluto users with generating device template? How ?

Necessary changes were :
input 1
norm 0     (it's for PAL)
frequency 0


Quote from: "tinia"
- I have also some USB cams I'm really satisfied with quality (Quickam PRO 4000). If I may suggest adding support also for those cameras with pwc module - I had motion running with this module and usb webcam (in Linux world almost all supported webcams are on pwc or ovxxx modules) ... This support will also be good for video conferencing.


This suggestion still stands and I guess it's easy solvable. I just don't know how to generate proper templates and additional motion configuration needed. This is where Pluto comes to test ...

Quote from: "tinia"
- Hybrid Media director:
- I wonder how to add media files to Pluto (are there any samba shares that could be used?) Should I add more users ?
- I've slide in DVD but it won't play. Where are appropriate logs to take a look what happened ?
- How is IR remote control set up ? I have ATI wireless remote wonder - it was detected OK, but don't know where to look for related files...

I guess adding users still doesn't function properly - I've added some users, but nothing happend (no new shares, home directories, etc...).
For remotes - LIRC is in action. Will take a look later...


Quote from: "tinia"
- Mobile orbiter
- it looks nice, but some texts are hardly readable. I guess this comes from resizing of GUI pictures. Are there any better settings to solve this ?


I will add some more questions:
- Mobile orbiter is now connecting to Pluto via Bluetooth. What do I need to be able to connect over GPRS ?

Quote from: "tinia"
- How to troubleshoot Pluto in general ? Logs, debugs, etc...


/var/log/pluto ...


Quote from: "tinia"
- Debian Sarge
Whoooh, I have quite some problems with HW detection and set up. Also shutdown is not made properly (machine still consumes 80 Watts after it says power off). Hercules Digifire card was crashing Pluto installation (now after it is installed, I can put it back in).
I've just clicked on pictures and Media director crashed (it's trying to run X, but it just won't go)... How to restart Orbiter ?

- How to enable Pluto as Firewall (2 network cards) ?

I have two cards in it, but would like to use Firewall in reverse order of cards - can I change that (Now , I'm forced to use Gigabit card for outside - ADSL and 100Mb on inner network - but would like to switch them...).


Quote from: "tinia"

I guess doing Sarge and Pluto on different HW configs is little bit adventureous. Do you have any HW recomendations to go along ?

I have Asus p4p800-e Deluxe, but it seems like it is not love on first sight with Debian Sarge...

Sorry, I probably sound a little disapointed, but will try to get over this newbie problems. Thanks for great work - I hope it will work for me either...

Regards,

Rob.  


Regards,

Rob.
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 12, 2005, 02:38:34 pm
I'm not familiar with motion, but I asked someone else to respond to it.

I filed a bug report with a programmer (Radu) about the users issue.  It should add those automatically.

Regarding the mobile orbiter, when you're not in the house, click the 'menu' button and choose Pluto MO.  That will show you the "VMC" files.  A VMC is essentially like a mini application, similar to a flash file.  When you're at home, the system automatically creates an 'away.vmc' that has menus to control the stuff in your home.  You can choose away.vmc to bring up the menu, and as you choose items, they're sent over whatever internet connection your phone has (gprs) to the server.

We're working on the cosmetics for the phone.  

Under Advanced, Devices, when you choose the Core, there is a device data which has the network settings.  You should be able to change that on the network settings page.  I'll send a bug report to the php guy.

The ripping functions aren't implemented yet.  You will be able to just put the disc in and chooes 'copy'.  In the meantime, it should have created samba shares for the users.  In /home/public/data is the public share (everyone shares that media), and /home/users_X/data for each user's private media.

Check the DVD logs in /var/log/pluto/*Xine*.newlog and also in /var/log/pluto/*dvd*.

Pluto doesn't ship with a dvd css decryptor.  But as open source, some users have included instructions on adding dvdcss:
http://www.geocities.com/download2kx01/

You may also need to a check the region your drive is set to.

Regarding debugging, in addition to the logs, core dumps are in /usr/pluto/coredumps.  If you look at the /var/log/pluto_deviceid log file, you'll see all the devices as they're being spawned.  If any device crashes, it will automatically respawn it.  See /usr/pluto/bin/Spawn_Device.sh.

Sorry about the Debian issues.  There's not much we can do.  As we get closer to release we'll have "certified compatible" hardware that is known to work without issues.

We use another model of the Asus p4p800 and it works.  The only big problem is usually with SATA drives and non-legacy mode.  There's a "Linux Compatible" web site that has more info on compatible hardware.
There's an advanced Firewall page for the firewall.
Title: Motion related
Post by: archived on March 17, 2005, 08:51:55 am
Hello, i have fixed the problem with the motion, the bigest problem it was the incorect spelling of the frequency  :oops: . I know i have a bad english, and so far for the input option in the motion config file, i have added a new parameter, for that when creating a new device ... it will require the Input Type (as a number) the Video Type (as a number <- this was a string until now and it was wrong). I don't know for sure how fast my changes will propagate, but i hope you will get the new motion related soft soon.
Title: Re: Motion related
Post by: archived on March 17, 2005, 11:32:24 am
Quote from: "dan.h"
Hello, i have fixed the problem with the motion, the bigest problem it was the incorect spelling of the frequency  :oops: . I know i have a bad english, and so far for the input option in the motion config file, i have added a new parameter, for that when creating a new device ... it will require the Input Type (as a number) the Video Type (as a number <- this was a string until now and it was wrong). I don't know for sure how fast my changes will propagate, but i hope you will get the new motion related soft soon.


I'd like to discuss some more about motion and Pluto. There are some important points that needs to be solved :

1. main /etc/motion/motion.conf

That file could be written with some default data, but what is more important it has to include #thread conf files for each thread for motion.
Devices that are threads to motion are :
- usb camera
- analog capture card (with 1 or more inputs)
- net camera ? (i'm not sure about that cause I'm not using them)

I'm not sure how to deal with this and templates. USB cam template should be something like analog capture card, ...

2. other config option for motion

I guess it would be wise to incorporate some other config possibilities that can be specified overall and for each thread separately (filters, screen texts, picture size, etc...). That could certainly be next step. Partially it could be dealt also in templates, where best settings for each device could be found, but screen texts could be left to user to change some prepared default values (cam1, cam2 ....) ...

3. using web server

I know that main remote control device is Orbiter or Media director. But I guess having some basic web interface would also be beneficial... Motion has already built in web streaming server and has several web interfaces that are in work, so I guess it would't be bad to include...

4. How to properly add device(device template) to Pluto

I'd be glad if I can help in adding usb cam support to Pluto. But since there are no easy documents how to do that, I'd kindly ask for some guidance here, and will document procedure for the rest of bunch going same way.

Since usb cam template won't be much different from analog_capture_card what is better way to add template :
- edit existing analog_capture_card
- add template/generate/ etc...

When template is ready it can be compiled. What are next steps to add it in Pluto system, to appear in web interface ? What to do to share with other Pluto users ?


Thanks in advance for answers,

regards,

Rob.
Title: Motion related reply
Post by: archived on March 17, 2005, 12:16:21 pm
1) on first issue, it suports thread in config file, and this is done when adding a new Capture Cammera. When adding a Capture Card all thread are commented, and when the user ads a new Capture Camera that will controled by the Capture Card, it will modify the config file adding a thread for every capture camera. When creating a new Capture Card device, it comes with some default values. That are in the database, and are showed when creating that device, so the motion config file is filled with those default values if the user do not modify them.

2) On the options for the cammera, i agree with you on the next step we will implement filters, picture size, screen text and so on.

3) About this issue is not related to me, because it's not my job the web page, but i will relay this issue to the one that is taking care of the web part. If you are reffering to the fact that you would like to access the motion web streaming server from a remote location, this will be solved fast and easy, modifing the firewall.

4)About the device template issue, this could be solved like that. There are few steps that if you follow them you will make a driver fast and easy. First you click on Device Template from the web interface, select a category and a manufacturer and add a new device template. Edit the template Device Data that represents the parameters that a device will receive when created and runned. Modify the commands that suports, and their parameters. After finishing the device template. Then go where you have the binarys and run DCEGen -d <device template number> and/or with other options. This will create a project with source code and headers for your devicetemplate. Using the project implement what you whant you driver to do. Build it and run it. About the issue of propagation to other users.. hmm this i don't know..

If you are interested in more details creating a device template and/or a device, i will gladly guide you.
Title: Re: Motion related reply
Post by: archived on March 17, 2005, 01:57:30 pm
Hi,

thanks for prompt response. I have some comments below:

Quote from: "dan.h"
1) on first issue, it suports thread in config file, and this is done when adding a new Capture Cammera. When adding a Capture Card all thread are commented, and when the user ads a new Capture Camera that will controled by the Capture Card, it will modify the config file adding a thread for every capture camera. When creating a new Capture Card device, it comes with some default values. That are in the database, and are showed when creating that device, so the motion config file is filled with those default values if the user do not modify them.

So I guees that usb web camera (that is its own /dev/video device) should behave similar to analog capture card (but only one device instead of 4) and create separate thread file for it...

Quote from: "dan.h"

4)About the device template issue, this could be solved like that. There are few steps that if you follow them you will make a driver fast and easy. First you click on Device Template from the web interface, select a category and a manufacturer and add a new device template. Edit the template Device Data that represents the parameters that a device will receive when created and runned. Modify the commands that suports, and their parameters. After finishing the device template. Then go where you have the binarys and run DCEGen -d <device template number> and/or with other options. This will create a project with source code and headers for your devicetemplate. Using the project implement what you whant you driver to do. Build it and run it. About the issue of propagation to other users.. hmm this i don't know..

If you are interested in more details creating a device template and/or a device, i will gladly guide you.  


Is there any possibility to clone some device template and start  from there? I guess some device templates (for instance web cams) will be quite similar, so it would be good to have option to create new template out of existing...  

Ok, I'l take your word for guidance:
I'd like to add usb web cam template that will create separate thread in motion.conf where I can specify /dev/videox device. I guess everything else (picture directory etc...) will be handled automatically.

So question is:
- should I start looking analog_capture_card template and learn from there ?
- what are crucial parameters for motion devices - cameras ?

Thanks in advance,

regards,

Rob.
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 17, 2005, 02:18:21 pm
Hello again. Yes usb should behaive simmilar, but the Capture Card does not suport usb cam's yet.

I don't know if there is any method to clone a device template.

Quote
Ok, I'l take your word for guidance:
I'd like to add usb web cam template that will create separate thread in motion.conf where I can specify /dev/videox device. I guess everything else (picture directory etc...) will be handled automatically.


As i sad if you whant to work with usb cameras, i never tested with the Analog Capture Card device, i think you may need to build a template the will be alike Analog Capture Card, but for USB cameras, and then build a template for USB cammeras. Ass about the options, that depends on you what they will be, because I, in the Capture Card Template i write the options what i consder to be default, you will never know what defaults are in the motion config file.

Yes you should look into the Generic Analog Capture Card template and source code and inspire from there. This would help you I think.

I think that the most important options for a video divice, is the device option, the video type option and number of cammeras. I hope you understood what i sad in here :)
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 18, 2005, 08:05:51 am
Hi,

I have quick questions about analog_capture_card - maybe I understood sources wrong, but would like to clear this out:
- analog_capture_card overwrites /etc/motion/motion.conf if it finds one. What if there are two cards in system? I guess they will write over each other so only one will remain ?

- I guess that something else should write generic motion.conf, and all devices should only add threads (analog capture card 4, usb and ip cams 1). Simple solution would be to have default motion.conf already and then just add threads for devices.... Or if motion.conf exists, it will only add threads...

- Where could I find code for IP cameras ? Can they exist by themselves (do they write their own motion.conf) ?

Am I wrong in my understanding ?


Regards,

Rob.
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 18, 2005, 08:45:57 am
Helo,

Yes it will overwrite the file, and on one system it will be only one capture card, and this is because all the child cameras of the card are controled via the card, and that means that only one card should have control over the motion.conf. This could be fixed as you said using thread option, but imagine more than one device controling the main motion config in the same time, it would be disaster. The only viable solution would be to make a Wrapper for the motion server, and then all the capture devices will be controled by the wrapper, and this way only one device will have to deal with the motion configs. About IP cameras i don't know anything. If you find out something, please let us know. You are not wrong in your understanding.  :wink:
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 18, 2005, 11:45:30 am
Quote from: "radu.c"
Helo,

Yes it will overwrite the file, and on one system it will be only one capture card, and this is because all the child cameras of the card are controled via the card, and that means that only one card should have control over the motion.conf. This could be fixed as you said using thread option, but imagine more than one device controling the main motion config in the same time, it would be disaster. The only viable solution would be to make a Wrapper for the motion server, and then all the capture devices will be controled by the wrapper, and this way only one device will have to deal with the motion configs. About IP cameras i don't know anything. If you find out something, please let us know. You are not wrong in your understanding.  :wink:


Hi,

thanks for info. Please don't get me wrong, I don't want to pressure you in any kind of different thinking - just giving my opinions in positive manner.

Drawback of analog_capture_card is that most of cards control 4 inputs (some of them only 1 like wintv) - so situation with more cards in same system is not so unusual (also I have system where usb cameras and analog are used in motion). I still think that this will be easier to deal now, than later, when support will expand to other devices...

I still think that motion.conf is not such problem. It could just be there in default manner from the start. All devices added would just add their own threads instead of overwritting whole motion.conf... If any devices are in system, then motion is started, otherwise not. But motion.conf could be there....

I probably am missing something, but there are some problems ahead:
- what if I want to have only USB camera - in this case:
  a. I need analog_capture card to write motion.conf
  b. write own motion.conf - but that will overwrite any other motion.conf from other devices.

I still think that writting motion.conf from devices is not so good idea for motion.conf, cause it's dead container, where threads are added for each device....

Hope this helps a little bit,

regards,

Rob.
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 18, 2005, 12:15:04 pm
The motion module is by no means complete.  It's really just a tiny wrapper 1 programmer wrote in a couple of days to get the cameras working.  Admittedly it will need to be re-thought.  Normally, we're promoting users buy IP based cameras instead--much cleaner solution.  But, we will need a better solution for Motion.
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 18, 2005, 12:51:28 pm
Quote from: "aaron.b"
The motion module is by no means complete.  It's really just a tiny wrapper 1 programmer wrote in a couple of days to get the cameras working.  Admittedly it will need to be re-thought.  Normally, we're promoting users buy IP based cameras instead--much cleaner solution.  But, we will need a better solution for Motion.


I'd like to cooperate, cause would like to add usb cam support. But I guess it would be better that actual changes are performed by your guys.

I guess that proposed way (devices write only threads to existing default motion.conf) would be a fast start, so we can add support for other devices quickly - each one will just add thread.conf file for its own and that's it.

I'd modifiy analog_capture_card to just add threads and leave motion.conf as default file in /etc/motion...

I guess that would be cleaner start, but I could be wrong (as always :-) )...

I have another small question:
- if I add Device template, generate project and compile it. What do I have to do to use this device on local system and what to share with other pluto users ?

Thanks,

regards,

Rob.
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 18, 2005, 01:05:23 pm
Regarding sharing the new devices you create....  You can do whatever you like with motion and the analog capture card, including something else that suits you better.  We haven't put effort into this module at all since our focus is exclusively on the media at this point.

To share new devices you create, you first tell us the name of the project.  We'll set you up with svn access to that directory.  When you're ready, we can include that module in our automated build process.

You will also need to do sqlCVS -r dce checkin

which checks in the tables in the DCE repository on your local machine.  That includes the sql table for DeviceTemplate and so on, which define the device, the commands, etc.

Whenever you make changes to the device templates, you're modifying your local copy of the database.  After the sqwlCVS checkin, you will be given a batch number, which contains all your changes to the database.

You just give us your batch number, and then one of us 'approves' it, which merges it in to the master database.

Usually we found that once you setup the device, there are very few changes to the database (ie the structure), and it's mostly just code changes checked in with svn.
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 25, 2005, 06:08:11 pm
Since pluto is using OSS solutions, have you looked at ZoneMinder to handle the camera survelliance part of pluto?  It supports quite a few cameras out of the box and has quite a few other things that Im sure users of pluto would want.  Just a thought.
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 25, 2005, 06:45:55 pm
That looks like a great project.  I just forwarded the link to the Dan H., who is our in-house guy for video surveillance, and who wrote the interface to Motion.
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 25, 2005, 09:12:38 pm
Quote from: "aaron.b"
That looks like a great project.  I just forwarded the link to the Dan H., who is our in-house guy for video surveillance, and who wrote the interface to Motion.


Hi,

I'l add my 2 cents. I'm using motion for quite some time. It just sits there doing its job - no complains, no huge cpu resources, no crashes. Detection engine is improving all the time. But it lacks decent web interface to look at recordings, settings, etc....

Then I saw Zoneminder and it attracted my attention. I've tried to use it for few months, but more and more basic drawbacks came at me. Ok, web interface is great, but detection engine was at that time IMHO much worse. Try to point camera outside and you'll see... Also motion works with video loopback devices (that means that you can connect another app to output of motion - you can get PIP with TV and video from motion camera on mythtv)...

It surely looks like more mature system, but GUI interface is not what is needed in Pluto. I guess we need realiable, good detection engine, everything else is handled by Pluto.

Of course I could be waaaaay wrong. But the current motion support is missing only few minor changes (that I proposed in other threads) and Pluto will have decent security support. Of course I wouldn't mind using Zoneminder, but I guess that will mean a new start... Could be great alternative, though.

I think that maybe there are some more hot areas to put efforts in them (telephony-asterisk (maybe integrating AMP), mythtv, daily news, RSS, family calendar with some light family-groupware (www.egroupware.com), motion videos, multizone audio, using media director as computing environment - KDE desktop, as document writting machine,  etc...).

I think that the best for Pluto will be to integrate best OSS partial solutions into one great product.

Regarding web camera support: for USB cameras zoneminder and motion support same cameras, maybe at the time, zoneminder is ahead on IP cameras, but intense development is going on in motion (snapshots are out every few days). But the main measure of quality is IMHO number of false triggers, reliability, robustness to wind, object reflections, light turning on/off, etc.....

I'd like to try to contribute proposed changes to motion interface, but I'm still stuck on problem, that despite definition of 4 child cameras I don't get threads properly activated and started with motion - so I could do further steps... I've submitted bug report 2 days ago...

Just my opinions,

regards,

Rob.
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 25, 2005, 10:06:43 pm
Sorry about the lack of response to your bug report.  Do you have a link to it?  Or the bug id?  I did a search but didn't see it.  I'll be sure it gets assigned to the right person.

You said "despite definition of 4 child cameras I don't get threads properly activated and started with motion".  I assume that means the problem is something particular to motion (which I know nothing about).  So it should go to Dan H.  You can also email him directly at "dan.h" to remind him.  He'll be in the office on Monday.

If the problem you're having is related to the framework or DCE (ie DCEGen, the internal creation of the classes, DCE messages, etc.) then I can help you.  I'll be at my computer this weekend too, and we can troubleshoot with instant messenger or a phone call.  Just let me know. (my email is aaron.b)
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 25, 2005, 11:37:52 pm
Quote from: "aaron.b"

Sorry about the lack of response to your bug report.  Do you have a link to it?  Or the bug id?  I did a search but didn't see it.  I'll be sure it gets assigned to the right person.

No worries, :-) .

ID 745:

http://plutohome.com/support/mantis/view.php?id=745

Quote from: "aaron.b"

You said "despite definition of 4 child cameras I don't get threads properly activated and started with motion".  I assume that means the problem is something particular to motion (which I know nothing about).  So it should go to Dan H.  You can also email him directly at "dan.h" to remind him.  He'll be in the office on Monday.

Well, motion and Pluto work in following manner. motion.conf in /etc/motion includes separate thread pointers for each child camera - those points to separate "threadx.conf" configuration files for each camera. Now generic_analog_capture_card (I already call it "Motion wrapper") writes "num of ports" threads pointers, but comments out all of them. Now when you define and start child camera, it uncomment its thread pointer in motion.conf and writes its own threadx.conf, so motion spawns separate thread for this device.

I already set "num of ports" parameter to 16 (that represents max video surveillance devices) and then add only real existing devices... In this way we can add analog camera on capture card with same template as usb cam and IP cam - only some parameters will differ...

My problem is that child camera devices don't do their work, don't uncomment and don't write their own threads - so only 1 camera is wokring at the time (from default motion.conf).

Do you know how to start those devices by hand ? That would help me a lot, cause I could get further into changes I already proposed in another forum threads about motion support...

Also I guess there is another problem - I've added 4 camera view scenarion, but don't see any picture (I guess I could see 1 working camera ?)
 
Quote from: "aaron.b"

If the problem you're having is related to the framework or DCE (ie DCEGen, the internal creation of the classes, DCE messages, etc.) then I can help you.  I'll be at my computer this weekend too, and we can troubleshoot with instant messenger or a phone call.  Just let me know. (my email is aaron.b)


Yes, I guess more of work will be DCE, DCEGen , parameter, DCE messages related (BTW, did you get anywhere with automatic wrapper generator - "swig" that was proposed in another thread - BTW2 which library should be wrapped ?).

I guess getting DCE messages and devices engines into scripting languages (Perl, Python) could boost contribution from other developers (for sure also Misterhouse community - recently we discussed this and Bruce (MH Master) said he's interested).

I'd really like to get motion into working state, so can proceed to media and Asterisk part...

I'm looking forward to cooperation - will get in touch. For now I need to know how to start those child cameras by hand... So can trace where the problem lies....

Regards,

Rob.
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 26, 2005, 10:44:19 am
I don't know how Dan wrote his code for motion.  I know that he didn't spend much time on it, so we don't have much invested in Motion.  If you can think of a better way, we don't have to stick to the current implementation much.

I can comment, though, on the structure as I see it from DCE's standpoint.  If you look at the Device Template for "Generic Analog Camera", you'll see that Implements DCE is *not* checked.  That means this is a dumb device--dumb in the sense that there is no code that will be run for this device.  Some other device--an intelligent device--will need to be responsible for all the code.  That device will be the 'Controlled Via' device, or the parent device when you look at the tree in Advanced Devices.  A device is responsible for handling all the code for it's children that do not implement DCE.

You see that the Camera has: This device is controlled via category:  Category: Generic Analog Capture Card.  That section of the device template page is where you specify what are the valid choices for the parent (or controlled via).  If you don't specify anything in either of the "This device is controlled via", then when the user creates this device, he can pick any parent/controlled via device he wants.  He could stuck a camera underneath the Xine DVD Player, for example.  If the Camera was an intelligent device that *did* implement DCE, this actually would be okay.  According to the framework, each device just spawns all of it's intelligent children as separate devices.  So, if the camera implemented DCE (meaning had it's own binary executible), you could make the parent anything you wanted.  If it was Xine, Xine would just spawn the program 'Camera' and let it take care of itself.

But since the 'Camera' is not an intelligent device, the parent/Controlled Via must be specified since that device needs to know what to do with it, and if the user put a dumb Camera as a child of Xine, Xine would just ignore it not knowing what it was.

So, the first question is: Is this structure with an intelligent device (the capture card) and dumb children (the cameras) correct?  With the structure the way it is now, that means there is only 1 binary, 1 thread that is going to be spawned--the Capture Card (the intelligent device that implements DCE).  The capture card's child devices (the cameras), as dumb devices, are really nothing more than a 'for your information' for the capture card.  So, when you wrote: "I don't get threads properly activated and started" for the cameras, understand that with this structure the Pluto DCE framework will not spawn any threads or devices for the cameras--Pluto will only spawn 1 thread for the capture card, which must do whatever it needs to do internally to support the cameras.

Going back to the issue of 'is this the right approach', note that it's possible to mix.  You can have some cameras that are intelligent devices, with their own binaries, and others that are not.

We have this same mixture throughout Pluto.  For example, most of the time light switches are dumb devices.  With X10, there's only 1 intelligent device--the CM11A interface--and that's the only thread that's run.  A light switch called "Living Room Light" is actually just a dumb device.  When the user hits the button to run on the Living Room Light, the "ON" command ends up in the CM11A device, which has the code to handle the "ON" command--it just looks up the child device, looks up the house code from it's data, and then sends the X10 command.  But, later, someone may add an intelligent light switch that acts independently, without needing a cm11a interface.  In this case, the light swith would be "intelligent" (ie implement DCE) and would get it's commands itself.  From the users standpoint, there is no difference.  Whether a device implements DCE isn't even shown on any of the wizard pages--it's too technical.  The user just adds light switches and knows that they can turn any switch on.  Where the code resides is unimportant.

So, it sounds like there may be a similar mix for motion, where some cameras are intelligent and some are dumb.  When you're using a single capture board, like the Grandtek BT878-based 16-port analog board we use, it seems to make the most sense that the cameras are dumb.  You don't want to run 16 different programs for each of the cameras--you just want 1 program that runs for the capture board.  When a command is sent to provide a video frame from camera #5, then you want that command to go to the single device for the capture board, and the capture board device will grab a frame from port #5.

However, in the case of USB cameras, perhaps the cameras should be intelligent (implement DCE and have their own device) since there is no 'capture board' device that will handle the logic for them.

Therefore, from a hardware standpoint, the way I would see the devices is as follows (smart devices shown in caps, dumb in lower case).

GRANDTEK BT878 CAPTURE BOARD
  generic analog camera #1
  generic analog camera #2
  generic analog camera #3
USB CAMERA
IP BASED CAMERA

From the user's standpoint (ie the wizard), this arrangement is very clean.  When they add a USB camera or IP Camera, as an intelligent device, the parent/Controlled Via device is just the PC that the software runs on.  But when the user adds a "generic analog camera" device, the wizard pages will automatically require him to first add the capture board, and will make the capture board the parent device.  In the above example, then, 3 separate programs would be run by the framework: the capture board, the USB camera, and the IP Camera.

However, this whole situation does get a little more fuzzy in my mind when Motion enters the picture.  If there were only the GRANDTEK capture board and it's analog cameras, it wouldn't be so difficult.  The Grandtek capture board would be both the wrapper for motion, as well as having the logic for controlling the analog cameras.  However, in the above example, where does motion enter the picture?  In that example, there are 3 intelligent devices, which will therefore all be spawned as 3 completely separate devices.  Should all 3 of them have their own copy of motion, making them completely independent?  That's one possibility.  But what if you want only 1 copy of motion for both the analog cameras, USB cameras, and IP Cameras?  In that case, I can think of two possibilities.  First, leave them as shown, with 3 separate devices.  However, each of the 3 devices (GRANDTEK, USB, IP CAM) will attempt to connect with a Motion back-end, starting it if it's not already started, and each will work with motion.  In that case motion doesn't exist as a separate device, but rather a tool that all 3 devices will use.  The second possibility would be to create a device called Motion that was a wrapper for motion, and then make the 3 devices children of motion (the analog cameras would be grand-children then).

Normally, when we're creating a new, major module, the senior developers get together and brainstorm to be sure we come up with the most logical structure that will grow with us.  At the moment we're all pretty busy with Media, Orbiter, the Installer, and our focus has been on getting 1 piece--the media--to work flawlessly before branching out too much, so we just kind of gave Dan H the task of getting a motion interface going--something basic that would work for our demo.  It hasn't been really thought out, and I haven't even looked at Dan's code before to see what he did.  But, from peeking at it now, it seems this was his intention:

There's only 1 intelligent device which a combination of both a motion wrapper, and an interface for the analog capture board we gave him (the bt878 based Grandtek).  The child devices (the cameras) are dumb devices.  In the constructor, Generic_Analog_Capture_Card::Generic_Analog_Capture_Card, he doesn't appear to actually look at his list of child devices (cameras), which one would normally expect of a device that has dumb children.  The children are in m_pData->m_vectDeviceData_Impl_Children.  Normally I would have expected him to see what kind of children he had and how many there were.  But it appears that the capture card device has a device data parameter, DATA_Get_Number_of_ports(), and so he just creates a generic threadX conf file for each port.  This isn't really complete.  There are likely parameters that should be specific to each camera, such as sensitivity to motion, etc.  So the dumb camera device should have a device data parameter like 'sensity level', and the constructor should iterate through it's children, reading DATA_Get_Sensitivity_Level() for each of the child cameras, and write out the specific settings for each camera.

There's only 1 command involved, "Get Video Frame".  Since the child cameras are dumb devices, any commands to them come in this, the parents, Generic_Analog_Capture_Card::ReceivedCommandForChild function.  Here he find the child device (the camera) that is the target of the command.  // find child device  There's only 1 command: case COMMAND_Get_Video_Frame_CONST:  He gets the port number of the camera: string sPortNumber = pDeviceData->mapParameters_Find(DEVICEDATA_Port_Number_CONST);

So the framework that's there is really simple.  He's got about 65 lines for the constructor, and 50 lines to get a frame, and that's the whole extent.  What he wrote would seem to work okay if there's only 1 capture card in the system, but doesn't really have any means to account for USB cameras, IP Cameras, or be a full-fledged video monitoring solution.  BTW, that's ok--that was Dan's instructions, to throw something together quick for the video surveillance since we had to do a demo.

In terms of a more robust solution, without knowing much about how motion works, my gut feeling would be to use a structure like that shown above, with no specific device for motion, and then let all the devices that need motion to either spawn their own copy of motion, or attach to a shared one.  I remember from series 1 that Motion can require a lot of CPU, particularly with lots of cameras.  So, we were directing customers with lots of cameras away from the analog capture card in favor of IP cameras which had their own motion detection built-in.  Making motion a separate device, and making the user decide what cameras use motion and what don't might be complicated.  So, by taking Motion out of the picture, then in the example above, the DCE Device for the Grandtek capture board may use motion, as may the USB Camera, but the IP Camera may not, if it has its own motion detection built-in.

I'll talk to Dan about it, and since you understand motion (and hopefully after this long discourse more about DCE), let me know your ideas too.
Title: Here we go - Pluto started but quite some of features dead
Post by: archived on March 26, 2005, 11:01:29 am
Per your comment about manually compiling and starting and debugging the startup:

With the current layout, the only device that will be started automatically is Generic Analog Capture.  The parent/controlled via should be your Core or a Media Director.  In that case, the script "Start Local Devices" in /usr/pluto/bin should try to spawn it automatically, and spawn it in a continuosly looping screen session that will keep restarting it over and over if it dies.  If you want to start it manually, run Generic_Analog_Capture -d [device] -r [router's ip].  If you want to see why it's not starting automatically, look in /var/log/pluto/pluto.log -- everything that StartLocalDevices tries to spawn is logged tehre.

To compile from SVN...  I assume you already have an svn checkout in  your /usr/pluto/sources, right?  If so, run 'make' in the PlutoUtils, and DCE directories, and then run 'make bin' in the Generic_Analog_Capture directory.  You can then run the binary from right there for testing.  Before you do, though, do a "screen -ls" to see what devices are running in screen sessions, and if the same Generic_Analog_Capture is already running in a screen session, do a screen -r [pid] to attach to it, and then a Ctrl+C to kill it.

If you have 2 devices running with the same device id, they will 'fight' and continuously disconnect each other.  For example, if you run GAC twice with 2 different device id's, that's ok.  But twice with the same device ID means that the first one will connect to the router (say as device #1000), and when the second one also connects as device #1000, the router will drop the connection to the first #1000, which will then re-attempt a connection, causing the 2nd one to drop, and so on.