Difference between revisions of "ROS Hood Teleop Video Script"

From wikidb
Jump to: navigation, search
(Capturing Video in ROS Using image_view on the Client)
(Configuration 2)
Line 111: Line 111:
 
This was unusable. There was substantial delay in the video display and real-time joystick control. This Asus 1000 EEE PC net book was introduced in 2008. It does not have sufficient video throughput.
 
This was unusable. There was substantial delay in the video display and real-time joystick control. This Asus 1000 EEE PC net book was introduced in 2008. It does not have sufficient video throughput.
  
=== Configuration 2 ===
+
=== Configuration 2 - preferred so far ===
  
 
* Master teleop on Hood  
 
* Master teleop on Hood  

Revision as of 11:57, 7 January 2016

Master Script

 #!/bin/bash
 
 DATE=$(date '+%Y%m%dT%H%M')       
 LOGDIR=~/log
 LAUNCHDIR=~/catkin_ws_indigo/launch
   
 case "$1" in
 
 start)
   echo START
   roscore > $LOGDIR/roscore$DATE.log &
   sleep 5
   pgrep -a roscore
   rosrun phidgets motor_control_hc > $LOGDIR/motors$DATE.log &
   sleep 5
   pgrep -a motor_control
   roslaunch $LAUNCHDIR/usb_cam_server.launch > $LOGDIR/usb_cam$DATE.log &
   sleep 5
   pgrep -a usb_cam 
   rosrun web_video_server web_video_server > $LOGDIR/video_server$DATE.log &
   sleep 5
   pgrep -a web_video_server 
   ;;
 
 stop)
   echo STOP
   killall -SIGINT web_video_server
   killall -SIGINT usb_cam_node
   killall -SIGINT motor_control_hc
   killall -SIGINT roscore
   killall -SIGINT rosmaster
   ;;
 esac
 
 echo DONE

Web Cam Launch Script

In usb_cam_server.launch. See server script for launch command.

 <launch>
   <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
     <param name="video_device" value="/dev/video0" />
     <param name="image_width" value="320" />
     <param name="image_height" value="240" />
     <param name="pixel_format" value="mjpeg" />
     <param name="camera_frame_id" value="usb_cam" />
     <param name="io_method" value="mmap"/>
   </node>
 </launch>

Client Script

Runs on Adams and is the same as ROS Hood Teleop Script.

 #!/bin/bash
  
 DATE=$(date '+%Y%m%dT%H%M')       
 LOGDIR=~/log
  
 case "$1" in
  
 start)
    echo START
    roslaunch ~/catkin_ws/launch/teleop.launch > $LOGDIR/teleop$DATE.log &
    sleep 5
    pgrep -a joy
    pgrep -a teleop
    ;;
  
 stop)
    echo STOP
    killall -SIGINT teleop_node
    killall -SIGINT joy_node
    ;;
 esac
  
 echo DONE

Teleop Launch Script

 <launch>
   <arg name="joy_config" default="floorHugger" />
   <arg name="joy_dev" default="/dev/input/js0" />
   
   <node pkg="joy" type="joy_node" name="joy_node">
     <param name="dev" value="$(arg joy_dev)" />
     <param name="deadzone" value="0.3" />
     <param name="autorepeat_rate" value="20" />
   </node>
 
   <node pkg="teleop_twist_joy" name="teleop_twist_joy" type="teleop_node">
     <rosparam command="load" file="$(find teleop_twist_joy)/config/$(arg joy_config).config.yaml" />
   </node>
 </launch>

Capturing the Video in a browser

In web browser and click on image_raw

http://localhost:8080/

Configuration 1

  • Master teleop on Hood
  • Client teleop on Adams
  • Video capture in an Adams browser

This was unusable. There was substantial delay in the video display and real-time joystick control. This Asus 1000 EEE PC net book was introduced in 2008. It does not have sufficient video throughput.

Configuration 2 - preferred so far

  • Master teleop on Hood
  • Client teleop on Adams
  • Video capture in an iMac browser.

The video delay was substantially reduced. The Mac is a late 2009 with a 3.06 GHz Intel Core 2 Duo.

The real-time joystick control from the Asus web tablet had substantial delays. It made the robot nearly uncontrollable. TBD - Root cause. Is this a configuration (for example, see the joystick configurations in the above teleop launch script), processor or network latency issue?

Capturing Video in ROS Using image_view on the Client

Using image_view on Adams had severe latencies. Option 2 above is an attempt to remove load from Adams.

Configuration 3

  • Master teleop on Hood
  • Client teleop on Adams
  • Video capture on Adams with image_view

Client Script

This script adds the impage_view lanch to the above client script.

 eepp@adams:~/catkin_ws/scripts$ cat teleop_client_init_video.sh 
 #!/bin/bash
  
 DATE=$(date '+%Y%m%dT%H%M')       
 LOGDIR=~/log
 LAUNCHDIR=~/catkin_ws/launch
 case "$1" in
  
 start)
    echo START
    roslaunch $LAUNCHDIR/teleop.launch > $LOGDIR/teleop$DATE.log &
    sleep 5
    pgrep -a joy
    pgrep -a teleop
    roslaunch $LAUNCHDIR/usb_cam_client.launch > $LOGDIR/image_view$DATE.log &
    sleep 5
    pgrep -a image_view
    ;;
  
 stop)
    echo STOP
    killall -SIGINT image_view
    killall -SIGINT teleop_node
    killall -SIGINT joy_node
    ;;
 esac
  
 echo DONE

image_view Launch Script

In usb_cam_client.launch. See client script immediately above.

 <launch>
   <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
     <remap from="image" to="/usb_cam/image_raw"/>
   </node>
 </launch>