ts-7000
[Top] [All Lists]

[ts-7000] Re: video transmission

To:
Subject: [ts-7000] Re: video transmission
From: "danjperron" <>
Date: Wed, 25 Oct 2006 19:23:16 -0000
--- In  "David Kadjo" <> wrote:
>
> Hi guys,
> 
> I am working on this project with my ts7200 board. I am building a
> robot to be controlled by a joystick from a remote computer (through
> wifi). The robot is to transmit video images from a USB camera hooked
> up to it to the remote computer (through wifi). Could you guys gives
> me hints on how this could be done or where to look at to find
> information.
> Thanks for your help.
> 
> Encloy
>


I'm planing to do the same thing.I did it using an x86 pc104.
But I need to convert the software  to  arm. Maybe this winter!


 I was using camserv  for the webcam server and I switched to palantir
when I bought a logitech orbit camera. The Orbit webcam is able to
tilt and pan remotely.  

For the control use socket connection on java. Java is only needed on
the desktop/laptop remote computer. Use firefox since Internet
explorer had problem with camserv  stream.


The TS-7000 will need to have the webcam server (camserv)and the
socket control server (server.c)

I was using my linux server to hold the webpage. It could be stored
into the ts-7000 also.(be sure to change the IP address and port to
try this).


This is a simplify example on how to do your control! I thing it
should be easy to use the joystick instead of  buttons. 


============  robot.html ================
<html>
<applet code=robot.class witdh=200 height=100>                       
                                                                     
                
</applet>                                                            
                                                                     
                
</html>   

============= robot.java ================
robot.java
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;

public class robot extends java.applet.Applet implements ActionListener {
 Button FwdButton = new Button("Avance");
 Button RevButton = new Button("Recule");
 TextField namefield = new TextField("init",30);
  public void init() {
   add(FwdButton);
   add(RevButton);
   FwdButton.addActionListener(this);
   RevButton.addActionListener(this);
 }

 public void paint(Graphics g)
  {
    g.drawString(namefield.getText(),20,100);
  }



 public void SendP( String text)
 {
    try {
       Socket skt = new Socket("10.11.12.1",13300);
       PrintWriter out = new PrintWriter(skt.getOutputStream(),true);
       out.println(text);
       out.close();
       skt.close();
       namefield.setText(text);
       }
       catch(Exception e)
       {
         namefield.setText("no socket");
       }
       repaint();
 }


 public void actionPerformed(ActionEvent evt)
  {
    if(evt.getSource() == FwdButton)
     SendP("fwd");
    else if(evt.getSource() == RevButton)
     SendP("rev");
  }

}



=========== server.c ==============

 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/un.h>
 #include <stdio.h>

 #define MAXLINE        4096
 #define MASOCKET        13300

 int
 main(int argc, char **argv)
 {
     int                listenfd, connfd;
     struct sockaddr_in    servaddr;
     char                buff[MAXLINE];
     time_t            tics;
    int n;

     if (    (listenfd = socket(AF_INET, SOCK_STREAM, 0)) < 0 ){
 //meme chose que pour le client

         perror("socket error");
         exit(1);
 //et si ca foire !

     }

     bzero(&servaddr, sizeof(servaddr));
 //meme chose que pour le client

     servaddr.sin_family = AF_INET;
     servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
 //INADDR_ANY signifie que le serveur va accepter une connection
 //client sur n'importe-quelle interface

     servaddr.sin_port = htons(MASOCKET);

 //on lie le port du serveur au socket en remplissant la "internet socket
 //adresse structure" et en appellant bind
     if (bind(listenfd, (struct sockaddr *) &servaddr,
sizeof(servaddr)) < 0){
         perror("bind error");
         exit(1);
 //au cas ou...
     }

     if (listen(listenfd, 5) < 0){
 //avec listen, le socket est converti en listening socket (ecoute)
 //sur lequel les demandes de connections vont etre acceptees par le
Kernel

         perror("listen error");
         exit(1);
 //ca peut merder aussi ici
     }

     while (1){        //boucle infinie, faut-il le preciser ? :oD
         if (    (connfd = accept(listenfd, (struct sockaddr *) NULL,
NULL)) < 0){
 //accept retourne un "descripteur de connection" (connected
descriptor) qui est
 //utilise pour la communication avec le nouveau client. Un nouveau
pour chaque client

             perror("accept error");
             exit(1);    //et aussi ici
         }
  /*       
      tics = time(NULL);    
             snprintf(buff, sizeof(buff), "blablabla %.24s\r\n",
ctime(&tics));
 //on recupere la date et l'heure
             
         if (write(connfd, buff, strlen(buff)) < 0){    
 //et on envoit le tout au client !
  
             perror("write error");
             exit(1);    //de meme ;)
         }
*/

    while( n = read(connfd,buff,MAXLINE) > 0)
    {

      // interpret  the text in buff
      // and control your robot using the i/o pins
      //  fputs(buff,stdout);
      //  fflush(stdout);

      ....
      ....
      ....

    }




         close(connfd);



   }
 }


Hope it help!

Daniel




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU