Ask Your Question
0

roslaunch: using ampersand (&) in gscam config

asked 2015-07-21 21:32:11 -0500

frankb gravatar image

Hi guys, I am trying to use an ampersand (&) in my launch file for gscam but it's apparently bad syntax. Here's the output:

 Invalid roslaunch XML syntax: not well-formed (invalid token): line 7, column 92
The traceback for the exception was written to the log file

Here is my launch file:

<launch>
  <arg name="cam_name" value="my_camera" />

  <!-- Start the GSCAM node -->
  <env name="GSCAM_CONFIG" 
      value="souphttpsrc location=http://10.16.63.224/control/faststream.jpg?stream=full&fps=0 timeout=5 ! jpegdec ! ffmpegcolorspace" />
  <node pkg="gscam" type="gscam" name="$(arg cam_name)">
    <param name="camera_name" value="$(arg cam_name)" />
    <remap from="camera/image_raw" to="$(arg cam_name)/image_raw" />
  </node>

</launch>

If I remove the "&fps=0" from the end of location, then the launch file works, but I need it there to operate my camera properly. Is there a way to use "&" in a launchfile? maybe a delimiter?

Thanks, -Frank

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-07-22 10:17:43 -0500

frankb gravatar image

I figured it out. I googled the issue under general XML syntax, not just a roslaunch problem.

You can use "& amp;" for the "&". So my code now becomes this and it works!

<launch>
  <arg name="cam_name" value="my_camera" />

  <!-- Start the GSCAM node -->
  <env name="GSCAM_CONFIG" 
      value="souphttpsrc location=http://10.16.63.224/control/faststream.jpg?stream=full&amp;fps=0 timeout=5 ! jpegdec ! ffmpegcolorspace" />
  <node pkg="gscam" type="gscam" name="$(arg cam_name)">
    <param name="camera_name" value="$(arg cam_name)" />
    <remap from="camera/image_raw" to="$(arg cam_name)/image_raw" />
  </node>

</launch>
edit flag offensive delete link more
0

answered 2015-07-22 08:29:15 -0500

How about using another kind of expression:

<launch>
  <arg name="cam_name" value="my_camera" /> 
  <arg name="FPS" default="0"/>

  <!-- Start the GSCAM node -->
  <env name="GSCAM_CONFIG" 
      value="souphttpsrc location=http://10.16.63.224/control/faststream.jpg?stream=full ! framerate=$(arg FPS) ! timeout=5 ! jpegdec ! ffmpegcolorspace" />
  <node pkg="gscam" type="gscam" name="$(arg cam_name)">
    <param name="camera_name" value="$(arg cam_name)" />
    <remap from="camera/image_raw" to="$(arg cam_name)/image_raw" />
  </node>

</launch>

I am not sure if this works. But I see similar expression in my v4l.launch:

<launch>
  <arg name="DEVICE" default="/dev/video0"/>
  <arg name="FPS" default="30/1"/>

  <node ns="v4l" name="gscam_driver_v4l" pkg="gscam" type="gscam" output="screen">
    <param name="camera_name" value="default"/>
    <param name="camera_info_url" value="package://gscam/examples/uncalibrated_parameters.ini"/>
    <param name="gscam_config" value="v4l2src device=$(arg DEVICE) ! video/x-raw-rgb,framerate=$(arg FPS) ! ffmpegcolorspace"/>
  </node>

</launch>
edit flag offensive delete link more

Comments

Unfortunately, this does not work. I am sending params to my camera over http through the "location" variable of the form <camera_stream>?<param1>&<param2>. Your method is changing the framerate of the gstreamer image pipeline rather than the internal params of the camera itself. I need the "&" :(

frankb gravatar imagefrankb ( 2015-07-22 09:29:34 -0500 )edit

Is there a way to use the ampersand "&" in a roslaunch file? Thanks!

frankb gravatar imagefrankb ( 2015-07-22 09:31:15 -0500 )edit

wow, I haven't seen this kind of technique before. Although the problem is solved, I still want to ask is there any recommended resource to learn sending params to camera over http?

Po-Jen Lai gravatar imagePo-Jen Lai ( 2015-07-22 10:55:50 -0500 )edit

You need to be using an IP (ethernet) camera. In my case, the parameters were defined by the camera manufacturer in their documentation. The format was provided by them. So you can't do it for any camera out there.

frankb gravatar imagefrankb ( 2015-07-22 12:12:16 -0500 )edit

Got it. Thanks a lot~

Po-Jen Lai gravatar imagePo-Jen Lai ( 2015-07-22 18:45:56 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-07-21 21:32:11 -0500

Seen: 546 times

Last updated: Jul 22 '15