Possible Stage issue

Bryan Burke bburke at eecs.utk.edu
Thu Sep 15 21:02:35 UTC 2011

Got this message from one of my users about the player/stage packages. They asked me to
forward along this message to you guys for review and inclusion in the PPA which hosts the
stage v3 packages (http://ppa.launchpad.net/thjc/ppa/ubuntu).

If you need anything else from me (or the user who did this), just let me know.


------ BEGIN MESSAGE ------

I've done a little digging in the Stage 3.2.2 source code just now, and I have found a way
to turn off the trail fading. In the world file, adding:
show_trailfast 1
to the window section will cause the trails to persist. Unfortunately, it also causes the
laser arcs to stick around as well, so in a few minutes the robot will paint the whole
screen blue with red stripes running through it.

I did a little more checking into the drawing of the trails in the non-fast mode, and I
discovered the offending lines of code. Namely, there is a fadeout factor which is a
function of the length of the trail:

double darkness = 0;
double fade = 0.5 / (double)(trail_length+1);

Later on in the code there is a modification to "darkness" which is actually the opacity
setting for the OpenGL colors:
darknes += fade;

So, as each trail checkpoint is drawn, the opacity is increased. The odd thing is, the
system still remembers all the checkpoints, and in fact it submits them all for rendering.
This definitely looks like just a bit of window dressing as it does not save any
computation or render cycles by doing this. Modifying lines 53 and 54 of
libstage/model_draw.cc to read:

double darkness = 1;
/* remove the fade line */

and then removing line 75 of the same file eliminates trail fading, and the laser arcs
stay with the robot. (this is assuming the 3.2.2 tarball of Stage's code). However,
nothing short of patching the libstage source code can prevent the fading from taking

Because there is nothing to be gained by the fading, I can't help but shake my head at
whoever put this in without making a way to deactivate it!

Hope that helps on the trail front.

------ END MESSAGE ------

Bryan Burke
IT Administrator
Department of Electrical Engineering and Computer Science
University of Tennessee, Knoxville
bburke at eecs.utk.edu
(865) 974-4694

More information about the Ubuntu-motu mailing list