Revision: 7015
http://playerstage.svn.sourceforge.net/playerstage/?rev=7015&view=rev
Author: natepak
Date: 2008-09-09 22:02:13 +0000 (Tue, 09 Sep 2008)
Log Message:
-----------
Added libgazebo bumper example
Added Paths:
-----------
code/gazebo/trunk/examples/libgazebo/bumper/
code/gazebo/trunk/examples/libgazebo/bumper/SConstruct
code/gazebo/trunk/examples/libgazebo/bumper/bumper.cc
Added: code/gazebo/trunk/examples/libgazebo/bumper/SConstruct
===================================================================
--- code/gazebo/trunk/examples/libgazebo/bumper/SConstruct
(rev 0)
+++ code/gazebo/trunk/examples/libgazebo/bumper/SConstruct 2008-09-09
22:02:13 UTC (rev 7015)
@@ -0,0 +1,17 @@
+
+# 3rd party packages
+parseConfigs=['pkg-config --cflags --libs libgazebo',
+ 'pkg-config --cflags --libs libgazeboServer']
+
+
+env = Environment (
+ CC = 'g++',
+ CCFLAGS = Split ('-pthread -pipe -W -Wall -O2'),
+)
+
+
+# Parse all the pacakge configurations
+for cfg in parseConfigs:
+ env.ParseConfig(cfg)
+
+env.Program('bumper','bumper.cc')
Added: code/gazebo/trunk/examples/libgazebo/bumper/bumper.cc
===================================================================
--- code/gazebo/trunk/examples/libgazebo/bumper/bumper.cc
(rev 0)
+++ code/gazebo/trunk/examples/libgazebo/bumper/bumper.cc 2008-09-09
22:02:13 UTC (rev 7015)
@@ -0,0 +1,55 @@
+#include <gazebo/gazebo.h>
+#include <gazebo/GazeboError.hh>
+
+int main()
+{
+ gazebo::Client *client = new gazebo::Client();
+ gazebo::BumperIface *bumperIface = new gazebo::BumperIface();
+
+ int serverId = 0;
+
+ /// Connect to the libgazebo server
+ try
+ {
+ client->ConnectWait(serverId, GZ_CLIENT_ID_USER_FIRST);
+ }
+ catch (gazebo::GazeboError e)
+ {
+ std::cout << "Gazebo error: Unable to connect\n" << e << "\n";
+ return -1;
+ }
+
+ /// Open the bumper Interface
+ try
+ {
+ bumperIface->Open(client, "bumper_iface");
+ }
+ catch (std::string e)
+ {
+ std::cout << "Gazebo error: Unable to connect to the bumper interface\n"
<< e << "\n";
+ return -1;
+ }
+
+ for (int i=0; i< 10; i++)
+ {
+ bumperIface->Lock(1);
+ int bump_count = bumperIface->data->bumper_count;
+
+ printf("Bump Count[%d]\n", bump_count);
+
+ for (int c = 0; c < bump_count; c++)
+ {
+ printf(" State[%d]\n", bumperIface->data->bumpers[c]);
+ }
+
+ bumperIface->Unlock();
+
+ usleep(100000);
+ }
+
+
+ bumperIface->Close();
+ delete bumperIface;
+ return 0;
+}
+
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit