Stage icon indicating copy to clipboard operation
Stage copied to clipboard

'speedup' command causing crash to Stage

Open amamory opened this issue 6 years ago • 1 comments

I was running the simple.cfg example and I realised that if the following line is commented, Stage crashes (randomly, not always) when a client connects to the server.

/# set the multiple of real time that Stage should try to achieve. Default is 1. /# set to 0 to go as fast as possible. speedup 0

Of course, one can always keep this line. The point is that I did my own Stage model without this line (before I realised the cause of the crashes) and I lost a lot of time on it. Perhaps this can help someone else.

This is the Server output

$ player simple.cfg Registering driver Player v.3.0.2

/* Part of the Player/Stage/Gazebo Project [http://playerstage.sourceforge.net]. /* Copyright (C) 2000 - 2009 Brian Gerkey, Richard Vaughan, Andrew Howard, /* Nate Koenig, and contributors. Released under the GNU General Public License. /* Player comes with ABSOLUTELY NO WARRANTY. This is free software, and you /* are welcome to redistribute it under certain conditions; see COPYING /* for details.

invoking player_driver_init()... [Stage plugin] Stage driver init

/** Stage plugin v4.3.0 ** /* Part of the Player Project [http://playerstage.sourceforge.net] /* Copyright 2000-2013 Richard Vaughan, Brian Gerkey and contributors. /* Released under the GNU General Public License v2.

success [Stage plugin] Loading world "simple.world"

[Loading ./simple.world][Include pioneer.inc][Include map.inc][Include sick.inc][Image > "bitmaps/cave.png"]

[Stage plugin] 6665.simulation.0 is "./simple.world" [Stage plugin] 6665.position2d.0 is "r0" [Stage plugin] 6665.ranger.0 is "r0.ranger:0" [Stage plugin] 6665.ranger.1 is "r0.ranger:1" listening on 6665 Listening on ports: 6665 accepted TCP client 0 on port 6665, fd 25 [Stage plugin] Stage driver setup Segmentation fault (core dumped)

and the Client output

$ ./test_rangers playerc warning : warning : [Player v.3.0.2] connected on [localhost:6665] with sock 3

playerc error : failed to get response terminate called after throwing an instance of 'PlayerCc::PlayerError' Aborted (core dumped)

The client to test code was meant to be as simple as possible:

#include <iostream>
#include <libplayerc++/playerc++.h>


int main(int argc, char *argv[]){
	using namespace PlayerCc;
	using namespace std;

	string host = "localhost";
	int port = 6665;

	PlayerClient robot(host,port);
	Position2dProxy pp(&robot,0);
	//RangerProxy	bodySonarProxy(&robot);
	RangerProxy	bodySonarProxy(&robot, 0);
	RangerProxy	headSonarProxy(&robot, 1);
	int i=0;
	float speed,turnrate;

	while(true){
		robot.Read();
		cout << "Qnt body:" << bodySonarProxy.GetRangeCount() << endl;
		//for(i=0;i<bodySonarProxy.GetRangeCount();i++) cout << bodySonarProxy[i] << " " << endl;
		cout << endl;
		
		cout << "Qnt head:" << headSonarProxy.GetRangeCount() << endl;
		//for(i=0;i<headSonarProxy.GetRangeCount();i++) cout << headSonarProxy[i] << endl;
		
		
        turnrate = dtor(-20); // turn 20 degrees per second
        speed = 0.100;
        // command the motors
        pp.SetSpeed(speed, turnrate);		
		cout << endl << endl;
		sleep(2);
	}

	return 0;
}

I am using Ubuntu 14.04 but the same issue also happens with 16.04.

It would be nice to investigate why this command cause this kind of crash.

amamory avatar Oct 11 '18 16:10 amamory

to reproduce the error, open simple.world and comment the line, then run $player simple.cfg.

/# set the multiple of real time that Stage should try to achieve. Default is 1. /# set to 0 to go as fast as possible. speedup 0

amamory avatar Oct 11 '18 16:10 amamory