Re: laser with stage 4

irobo <[email protected]> Tue, 4 Jun 2013 23:45:41 -0700 (PDT)
Newsgroups gmane.science.robotics.playerstage
Message-ID <[email protected]>
Hii light86,

Here is the simple to test laser in stage 4.1.1 with .cc,.world and .cfg
files. May be it will help u. While runnning .cc file, change the position
of robo with the mouse and see the change in laser readings. The other
functions to access laser can be found from the below link:

http://playerstage.sourceforge.net/doc/Player-svn/player/classPlayerCc_1_1RangerProxy.html

*****************************************************************************
empty.cfg::
------------------
driver
(
name "stage"
plugin "stageplugin"
provides ["simulation:0"]
# load the named file into the simulator
worldfile "empty.world"
)


driver
(
name "stage"
provides ["6665:position2d:0" "6665:ranger:0" "6665:ranger:1"]
model "r0"
)

driver
(
  name "rangertolaser"
  provides [ "laser:0" ]
  requires [ "ranger:1" ]
)
*************************************************************************
empty.world::
-------------------

include "map.inc"
include "pioneer.inc"
include "sick.inc"

resolution 0.02

floorplan
(
bitmap "cave.png"
size [25 17 1]
)

window
(
size [700.000 700.000]
scale 20
show_data 1
)

pioneer2dx
(		  
  # can refer to the robot by this name
  name "r0"
  pose [-4 6 0 -90] 

  # pioneer2dx's sonars	will be ranger:0 and the laser will be ranger:1
  sicklaser( pose [ 0 0 0 0 ] ) 
 
  # demonstrate a plugin controller, implemented in examples/ctrl/wander.cc
  # you probably should comment this out when using simple.cfg with Player
  #ctrl "wander"

  # report error-free position in world coordinates
  localization "gps"
  localization_origin [ 0 0 0 0 ]
)

*****************************************************************************
test.cc::
-----------
#include <stdio.h>
#include <libplayerc++/playerc++.h>
#include<time.h>
#include<unistd.h>
#include<iostream>

using namespace PlayerCc;
using namespace std;

int main(int argc, char *argv[])
{
	PlayerClient robot("localhost");
	Position2dProxy p2dProxy(&robot,0);
	RangerProxy sonarProxy(&robot,0);	
	RangerProxy laserProxy(&robot,1);   	
	p2dProxy.SetMotorEnable(1);
	p2dProxy.RequestGeom();
	laserProxy.RequestGeom();
	sonarProxy.RequestGeom();
	
	double forwardSpeed, turnSpeed;
	uint32_t count;
	player_pose3d_t pose;
	double range;
	srand(time(NULL));
	
	//some control code
	robot.Read();
	//laserProxy.RequestConfigure();
	while(true)
	{
		// read from the proxies
		robot.Read();
		cout << laserProxy << std::endl;
		sleep(1);
	}

	return 0;
}
******************************************************************************


Best Regards.



--
View this message in context: http://player-stage-gazebo.10965.n7.nabble.com/laser-with-stage-4-tp18842p18861.html
Sent from the playerstage-developers mailing list archive at Nabble.com.

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j