Help me please using gazebo with player

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Help me please using gazebo with player

Mauro1

I need to simulate a robot equipped with odometry, gps and imu in a 3D
environment.
I installed player-Gazebo under linux (ubuntu 8.04) and tried to use the
example world file pioneer2dx with a dummy c++ application, but it doesn't
work. ( I reported my files and related errors here below).
Is there somebody who can help me with my files or send me a working
player-gazebo example files and a dummy application so that I can start
using this powerful tool?

Thanks in advance

Mauro

Gazebo world file:

<gazebo:world>
<verbosity>5</verbosity>

<physics:ode>
<stepTime>0.03</stepTime>
<gravity>0 0 -9.8</gravity>
<cfm>10e-5</cfm>
<erp>0.3</erp>
</physics:ode>

<rendering:gui>
<type>fltk</type>
<size>800 600</size>
<pos>0 0</pos>
<xyz>0 0 0</xyz>
<rpy>0 0 0</rpy>
</rendering:gui>

<rendering:ogre>
<ambient>0.5 0.5 0.5 1.0</ambient>

<sky>
<material>Gazebo/CloudySky</material>
</sky>

<fog>
<color>1.0 1.0 1.0</color>
<linearStart>10</linearStart>
<linearEnd>100</linearEnd>
</fog>
</rendering:ogre>
<!-- Ground Plane -->

<model:physical name="plane1_model">
<xyz>0 0 0</xyz>
<rpy>0 0 0</rpy>
<static>true</static>

<body:plane name="plane1_body">

<geom:plane name="plane1_geom">
<normal>0 0 1</normal>
<size>2000 2000</size>
<segments>10 10</segments>
<uvTile>100 100</uvTile>
<material>Gazebo/Grey</material>
</geom:plane>
</body:plane>
</model:physical>

<model:physical name="sphere1_model">
<xyz>2.15 -1.68 .3</xyz>
<rpy>0.0 0.0 0.0</rpy>
<static>true</static>

<body:sphere name="sphere1_body">

<geom:sphere name="sphere1_geom">
<size>0.1</size>

<visual>
<scale>0.1 0.1 0.1</scale>
<mesh>unit_sphere</mesh>
<material>Gazebo/Rocky</material>
</visual>
</geom:sphere>
</body:sphere>
</model:physical>

<!--
 
  Include the complete model described in the .model file
  This assumes the root node is a <model:...>
 
-->

<!--
  <include embedded="false">
    <xi:include href="pioneer2dx.model" />
  </include>
 
-->

<model:physical name="pioneer2dx_model1">
<xyz>0 0 0.145</xyz>
<rpy>0.0 0.0 0.0</rpy>

<controller:differential_position2d name="controller1">
<leftJoint>left_wheel_hinge</leftJoint>
<rightJoint>right_wheel_hinge</rightJoint>
<wheelSeparation>0.39</wheelSeparation>
<wheelDiameter>0.15</wheelDiameter>
<torque>5</torque>
<interface:position name="position_iface_0"/>
</controller:differential_position2d>

<model:physical name="laser">
<xyz>0.15 0 0.18</xyz>

<attach>
<parentBody>chassis_body</parentBody>
<myBody>laser_body</myBody>
</attach>

<include embedded="true">
<xi:include href="../sensors/sicklms200.model"/>
</include>
</model:physical>

<include embedded="true">
<xi:include href="../positions/pioneer2dx.model"/>
</include>
</model:physical>
<!-- White Directional light -->

<model:renderable name="directional_white">

<light>
<type>directional</type>
<direction>0 -0.6 -0.4</direction>
<diffuseColor>1.0 1.0 1.0</diffuseColor>
<specularColor>0.2 0.2 0.2</specularColor>
<attenuation>1000 1.0 0.0 0</attenuation>
</light>
</model:renderable>
</gazebo:world>


Player configuration file:

# Desc:
# Author:  
# Date: 1

# load the Stage plugin simulation driver
driver
(
  name "gazebo"
  provides ["simulation:0" ]
  plugin "libgazeboplugin"

# load the named file into the simulator
#  worldfile "pioneer2dx.world"
)

# Export the map
#driver
#(
#  name "stage"
#  provides ["map:0" ]
#  model "square"
#)

# Create a Stage driver and attach position2d and laser interfaces
# to the model "robot1"
driver
(
  name "gazebo"
  provides ["position2d:0" "laser:0" ]
  model "robot1"
)


My dummy application:

#include <iostream>
#include <fstream>
#include <string.h>
#include <stdio.h>

#include <stdlib.h>
#include <Time.h>

#include <CommonOptions.h>

#include <libplayerc++/playerc++.h>
#include <libplayercore/player.h>

#define DEBUG 0

using namespace PlayerCc;
using namespace std;


int main(int argc,const char* argv[])
{
       
        cout << "test Gazebo" << endl;

        static const int MY_PLAYER_CLIENT_START_PORT = 6665;
        static const int MY_PLAYER_CLIENT_TIMEOUT_USECS = 150000;
        int n = 0;
        Decimal XPos;
        Decimal YPos;
        Decimal ZPos;
        Decimal Roll;
        Decimal Pitch;
        Decimal Yaw;

        string _hostname; /**< hostname, ip of the machine in which robot-player
runs*/
        uint _port; /**< port, port which robot-player use */
        Position2dProxy *_position2dProxy;/** proxy of the position2d*/
        PlayerClient* _playerClient;    /**< playerClient, pointer to the
playerstructure*/
        string playerHost = string("localhost");
        int playerTrans = PLAYERC_TRANSPORT_TCP;
        unsigned int playerPort = 6665;
// unsigned int playerPort = MY_PLAYER_CLIENT_START_PORT +
commonOptions.robotId->getValue();
// int playerTrans = PLAYERC_TRANSPORT_TCP;
               
        cout << "Creating Player Client object" << endl;
        _playerClient = new PlayerClient(playerHost,playerPort,playerTrans);
        _hostname = _playerClient->GetHostname();
        _port = _playerClient->GetPort();
        cout << "host name = " << _hostname << endl;
        cout << "host port = " << _port << endl;
        cout << "_playerClient value = " << _playerClient << endl;
// cout << "Going to sleep 5 seconds." << _port << endl;
        sleep(5);

        cout << "Creating Position2dProxy object" << endl;

        _position2dProxy = new Position2dProxy(_playerClient,0);
        cout << "Position2dProxy object Created." << endl;

// for(n=0;n++;n<10)
// {
// cout << "Acquiring data from pioneer robot. Step: " << n << endl;
// XPos = _position2dProxy->GetXPos();
// YPos = _position2dProxy->GetYPos();
// ZPos = _position2dProxy->GetZPos();
// Roll = _position2dProxy->GetRoll();
// Pitch = _position2dProxy->GetPitch();
// Yaw = _position2dProxy->GetYaw();
// cout << "XPos = " << XPos << endl;
// cout << "YPos = " << YPos << endl;
// cout << "ZPos = " << ZPos << endl;
// cout << "Roll = " << Roll << endl;
// cout << "Pitch = " << Pitch << endl;
// cout << "Yaw = " << Yaw << endl;
// sleep(5);
// }
// by default in push mode with thread activated
// _playerClient->SetDataMode(PLAYER_DATAMODE_PUSH );
// _playerClient->StartThread();
       
        cout << "END" << endl;

        return 0;
}


Generated errors:

Gazebo


mauro@mauro-linux:~/Desktop/Tesi/MIP/gazeboWorlds/environments$ gazebo
pioneer2dx.world
Gazebo multi-robot simulator, version 0.8-pre3
Part of the Player/Stage Project [http://playerstage.sourceforge.net].
Copyright (C) 2003 Nate Koenig, Andrew Howard, and contributors.
Released under the GNU General Public License.
[server/GazeboConfig.cc:101]
Unable to find the file ~/.gazeborc. Using default paths. This may cause
OGRE to fail.
creating /tmp/gazebo-mauro-0
found a pid file: pid=9345
The gazebo process is not alive.
creating /tmp/gazebo-mauro-0/simulation.default 112 144496
creating /tmp/gazebo-mauro-0/position.position_iface_0 112 228
creating /tmp/gazebo-mauro-0/laser.laser_iface_0 112 12444
creating /tmp/gazebo-mauro-0/fiducial.fiducial_iface_0 112 20932
Killed
mauro@mauro-linux:~/Desktop/Tesi/MIP/gazeboWorlds/environments$


Player
mauro@mauro-linux:~/Desktop/Tesi/MIP/gazeboWorlds/environments$ player
pioneer2dx.cfg
Registering driver
Player v.2.1.1
* Part of the Player/Stage/Gazebo Project
[http://playerstage.sourceforge.net].
* Copyright (C) 2000 - 2006 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.
trying to load
/home/mauro/Desktop/Tesi/MIP/gazeboWorlds/environments/./libgazeboplugin...
failed
(/home/mauro/Desktop/Tesi/MIP/gazeboWorlds/environments/./libgazeboplugin.so:
cannot open shared object file: No such file or directory)
trying to load /usr/local/lib/libgazeboplugin...
success
invoking player_driver_init()...
 * Part of the Player/Stage Project [http://playerstage.sourceforge.net]
 * Copyright 2000-2006 Richard Vaughan, Andrew Howard, Brian Gerkey, Nathan
Koenig
 * and contributors. Released under the GNU General Public License v2.
success
 Gazebo Plugin driver creating 1 device
    6665.31.0 is  a simulation interface.
opening /tmp/gazebo-mauro-0
opening /tmp/gazebo-mauro-0/simulation.default 112 144496
  Gazebo Plugin driver creating 2 devices
    6665.4.0 is  a position2d interface.
    6665.6.0 is  a laser interface.
listening on 6665
Added file watch 5
Added file watch 6
Listening on ports: 6665
Added file watch 7
accepted TCP client 0 on port 6665, fd 7
Error Subscribing to Gazebo Position2d Interface
error opening device file /tmp/gazebo-mauro-0/position. : No such file or
directory
mauro@mauro-linux:~/Desktop/Tesi/MIP/gazeboWorlds/environments$

testGazebo
mauro@mauro-linux:~/Desktop/Tesi/MIP/bin$ ./testGazebo
test Gazebo
Creating Player Client object
host name = localhost
host port = 6665
_playerClient value = 0x804f9e0
Creating Position2dProxy object
playerc error   : failed to get response
terminate called after throwing an instance of 'PlayerCc::PlayerError'
Aborted
mauro@mauro-linux:~/Desktop/Tesi/MIP/bin$



--
View this message in context: http://www.nabble.com/Help-me-please-using-gazebo-with-player-tp22606398p22606398.html
Sent from the playerstage-gazebo mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Playerstage-gazebo mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
Reply | Threaded
Open this post in threaded view
|

Re: Help me please using gazebo with player

Peter Nordin-2
Hello

This is just a quick reply, I have not had time to read through all your
code.
The first errors you get when you start Gazebo should not happen.

The .gazeborc file should be in your home directory. If not then maybe
Gazebo is incorrectly installed.
When you start Gazebo it is supposed to open a window where you see the
pioneer2dx robot. After that you can start the player server and your
client. But if Gazebo wont even start then the rest wont work either.

I hope this helps a little at least.

/Peter



Mauro1 wrote:

> I need to simulate a robot equipped with odometry, gps and imu in a 3D
> environment.
> I installed player-Gazebo under linux (ubuntu 8.04) and tried to use the
> example world file pioneer2dx with a dummy c++ application, but it doesn't
> work. ( I reported my files and related errors here below).
> Is there somebody who can help me with my files or send me a working
> player-gazebo example files and a dummy application so that I can start
> using this powerful tool?
>
> Thanks in advance
>
> Mauro
>
> Gazebo world file:
>
> <gazebo:world>
> <verbosity>5</verbosity>
> −
> <physics:ode>
> <stepTime>0.03</stepTime>
> <gravity>0 0 -9.8</gravity>
> <cfm>10e-5</cfm>
> <erp>0.3</erp>
> </physics:ode>
> −
> <rendering:gui>
> <type>fltk</type>
> <size>800 600</size>
> <pos>0 0</pos>
> <xyz>0 0 0</xyz>
> <rpy>0 0 0</rpy>
> </rendering:gui>
> −
> <rendering:ogre>
> <ambient>0.5 0.5 0.5 1.0</ambient>
> −
> <sky>
> <material>Gazebo/CloudySky</material>
> </sky>
> −
> <fog>
> <color>1.0 1.0 1.0</color>
> <linearStart>10</linearStart>
> <linearEnd>100</linearEnd>
> </fog>
> </rendering:ogre>
> <!-- Ground Plane -->
> −
> <model:physical name="plane1_model">
> <xyz>0 0 0</xyz>
> <rpy>0 0 0</rpy>
> <static>true</static>
> −
> <body:plane name="plane1_body">
> −
> <geom:plane name="plane1_geom">
> <normal>0 0 1</normal>
> <size>2000 2000</size>
> <segments>10 10</segments>
> <uvTile>100 100</uvTile>
> <material>Gazebo/Grey</material>
> </geom:plane>
> </body:plane>
> </model:physical>
> −
> <model:physical name="sphere1_model">
> <xyz>2.15 -1.68 .3</xyz>
> <rpy>0.0 0.0 0.0</rpy>
> <static>true</static>
> −
> <body:sphere name="sphere1_body">
> −
> <geom:sphere name="sphere1_geom">
> <size>0.1</size>
> −
> <visual>
> <scale>0.1 0.1 0.1</scale>
> <mesh>unit_sphere</mesh>
> <material>Gazebo/Rocky</material>
> </visual>
> </geom:sphere>
> </body:sphere>
> </model:physical>
> −
> <!--
>  
>   Include the complete model described in the .model file
>   This assumes the root node is a <model:...>
>  
> -->
> −
> <!--
>   <include embedded="false">
>     <xi:include href="pioneer2dx.model" />
>   </include>
>  
> -->
> −
> <model:physical name="pioneer2dx_model1">
> <xyz>0 0 0.145</xyz>
> <rpy>0.0 0.0 0.0</rpy>
> −
> <controller:differential_position2d name="controller1">
> <leftJoint>left_wheel_hinge</leftJoint>
> <rightJoint>right_wheel_hinge</rightJoint>
> <wheelSeparation>0.39</wheelSeparation>
> <wheelDiameter>0.15</wheelDiameter>
> <torque>5</torque>
> <interface:position name="position_iface_0"/>
> </controller:differential_position2d>
> −
> <model:physical name="laser">
> <xyz>0.15 0 0.18</xyz>
> −
> <attach>
> <parentBody>chassis_body</parentBody>
> <myBody>laser_body</myBody>
> </attach>
> −
> <include embedded="true">
> <xi:include href="../sensors/sicklms200.model"/>
> </include>
> </model:physical>
> −
> <include embedded="true">
> <xi:include href="../positions/pioneer2dx.model"/>
> </include>
> </model:physical>
> <!-- White Directional light -->
> −
> <model:renderable name="directional_white">
> −
> <light>
> <type>directional</type>
> <direction>0 -0.6 -0.4</direction>
> <diffuseColor>1.0 1.0 1.0</diffuseColor>
> <specularColor>0.2 0.2 0.2</specularColor>
> <attenuation>1000 1.0 0.0 0</attenuation>
> </light>
> </model:renderable>
> </gazebo:world>
>
>
> Player configuration file:
>
> # Desc:
> # Author:  
> # Date: 1
>
> # load the Stage plugin simulation driver
> driver
> (
>   name "gazebo"
>   provides ["simulation:0" ]
>   plugin "libgazeboplugin"
>
> # load the named file into the simulator
> #  worldfile "pioneer2dx.world"
> )
>
> # Export the map
> #driver
> #(
> #  name "stage"
> #  provides ["map:0" ]
> #  model "square"
> #)
>
> # Create a Stage driver and attach position2d and laser interfaces
> # to the model "robot1"
> driver
> (
>   name "gazebo"
>   provides ["position2d:0" "laser:0" ]
>   model "robot1"
> )
>
>
> My dummy application:
>
> #include <iostream>
> #include <fstream>
> #include <string.h>
> #include <stdio.h>
>
> #include <stdlib.h>
> #include <Time.h>
>
> #include <CommonOptions.h>
>
> #include <libplayerc++/playerc++.h>
> #include <libplayercore/player.h>
>
> #define DEBUG 0
>
> using namespace PlayerCc;
> using namespace std;
>
>
> int main(int argc,const char* argv[])
> {
>
> cout << "test Gazebo" << endl;
>
> static const int MY_PLAYER_CLIENT_START_PORT = 6665;
> static const int MY_PLAYER_CLIENT_TIMEOUT_USECS = 150000;
> int n = 0;
> Decimal XPos;
> Decimal YPos;
> Decimal ZPos;
> Decimal Roll;
> Decimal Pitch;
> Decimal Yaw;
>
> string _hostname; /**< hostname, ip of the machine in which robot-player
> runs*/
> uint _port; /**< port, port which robot-player use */
> Position2dProxy *_position2dProxy;/** proxy of the position2d*/
> PlayerClient* _playerClient;    /**< playerClient, pointer to the
> playerstructure*/
> string playerHost = string("localhost");
> int playerTrans = PLAYERC_TRANSPORT_TCP;
> unsigned int playerPort = 6665;
> // unsigned int playerPort = MY_PLAYER_CLIENT_START_PORT +
> commonOptions.robotId->getValue();
> // int playerTrans = PLAYERC_TRANSPORT_TCP;
>
> cout << "Creating Player Client object" << endl;
> _playerClient = new PlayerClient(playerHost,playerPort,playerTrans);
> _hostname = _playerClient->GetHostname();
> _port = _playerClient->GetPort();
> cout << "host name = " << _hostname << endl;
> cout << "host port = " << _port << endl;
> cout << "_playerClient value = " << _playerClient << endl;
> // cout << "Going to sleep 5 seconds." << _port << endl;
> sleep(5);
>
> cout << "Creating Position2dProxy object" << endl;
>
> _position2dProxy = new Position2dProxy(_playerClient,0);
> cout << "Position2dProxy object Created." << endl;
>
> // for(n=0;n++;n<10)
> // {
> // cout << "Acquiring data from pioneer robot. Step: " << n << endl;
> // XPos = _position2dProxy->GetXPos();
> // YPos = _position2dProxy->GetYPos();
> // ZPos = _position2dProxy->GetZPos();
> // Roll = _position2dProxy->GetRoll();
> // Pitch = _position2dProxy->GetPitch();
> // Yaw = _position2dProxy->GetYaw();
> // cout << "XPos = " << XPos << endl;
> // cout << "YPos = " << YPos << endl;
> // cout << "ZPos = " << ZPos << endl;
> // cout << "Roll = " << Roll << endl;
> // cout << "Pitch = " << Pitch << endl;
> // cout << "Yaw = " << Yaw << endl;
> // sleep(5);
> // }
> // by default in push mode with thread activated
> // _playerClient->SetDataMode(PLAYER_DATAMODE_PUSH );
> // _playerClient->StartThread();
>
> cout << "END" << endl;
>
> return 0;
> }
>
>
> Generated errors:
>
> Gazebo
>
>
> mauro@mauro-linux:~/Desktop/Tesi/MIP/gazeboWorlds/environments$ gazebo
> pioneer2dx.world
> Gazebo multi-robot simulator, version 0.8-pre3
> Part of the Player/Stage Project [http://playerstage.sourceforge.net].
> Copyright (C) 2003 Nate Koenig, Andrew Howard, and contributors.
> Released under the GNU General Public License.
> [server/GazeboConfig.cc:101]
> Unable to find the file ~/.gazeborc. Using default paths. This may cause
> OGRE to fail.
> creating /tmp/gazebo-mauro-0
> found a pid file: pid=9345
> The gazebo process is not alive.
> creating /tmp/gazebo-mauro-0/simulation.default 112 144496
> creating /tmp/gazebo-mauro-0/position.position_iface_0 112 228
> creating /tmp/gazebo-mauro-0/laser.laser_iface_0 112 12444
> creating /tmp/gazebo-mauro-0/fiducial.fiducial_iface_0 112 20932
> Killed
> mauro@mauro-linux:~/Desktop/Tesi/MIP/gazeboWorlds/environments$
>
>
> Player
> mauro@mauro-linux:~/Desktop/Tesi/MIP/gazeboWorlds/environments$ player
> pioneer2dx.cfg
> Registering driver
> Player v.2.1.1
> * Part of the Player/Stage/Gazebo Project
> [http://playerstage.sourceforge.net].
> * Copyright (C) 2000 - 2006 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.
> trying to load
> /home/mauro/Desktop/Tesi/MIP/gazeboWorlds/environments/./libgazeboplugin...
> failed
> (/home/mauro/Desktop/Tesi/MIP/gazeboWorlds/environments/./libgazeboplugin.so:
> cannot open shared object file: No such file or directory)
> trying to load /usr/local/lib/libgazeboplugin...
> success
> invoking player_driver_init()...
>  * Part of the Player/Stage Project [http://playerstage.sourceforge.net]
>  * Copyright 2000-2006 Richard Vaughan, Andrew Howard, Brian Gerkey, Nathan
> Koenig
>  * and contributors. Released under the GNU General Public License v2.
> success
>  Gazebo Plugin driver creating 1 device
>     6665.31.0 is  a simulation interface.
> opening /tmp/gazebo-mauro-0
> opening /tmp/gazebo-mauro-0/simulation.default 112 144496
>   Gazebo Plugin driver creating 2 devices
>     6665.4.0 is  a position2d interface.
>     6665.6.0 is  a laser interface.
> listening on 6665
> Added file watch 5
> Added file watch 6
> Listening on ports: 6665
> Added file watch 7
> accepted TCP client 0 on port 6665, fd 7
> Error Subscribing to Gazebo Position2d Interface
> error opening device file /tmp/gazebo-mauro-0/position. : No such file or
> directory
> mauro@mauro-linux:~/Desktop/Tesi/MIP/gazeboWorlds/environments$
>
> testGazebo
> mauro@mauro-linux:~/Desktop/Tesi/MIP/bin$ ./testGazebo
> test Gazebo
> Creating Player Client object
> host name = localhost
> host port = 6665
> _playerClient value = 0x804f9e0
> Creating Position2dProxy object
> playerc error   : failed to get response
> terminate called after throwing an instance of 'PlayerCc::PlayerError'
> Aborted
> mauro@mauro-linux:~/Desktop/Tesi/MIP/bin$
>
>
>
>  


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Playerstage-gazebo mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo