LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-20-2011, 04:05 AM   #1
ksatyaki
LQ Newbie
 
Registered: May 2010
Posts: 19

Rep: Reputation: 1
Player-Stage and .cc (c++) files


Player-Stage uses .cc files.
I know how to compile them. But how do I actually execute my code?
There is an output file generated. There is nothing in the .cfg file or in the .world file that specifies what program to use to run the robot. Or is it not specified in the world or cfg files?

Then how to make the robot obey my compiled .cc file???
Please help.

If this question is silly or if I am asking stupid questions please bear with me and help me out!
 
Old 06-20-2011, 05:22 AM   #2
Ramurd
Member
 
Registered: Mar 2009
Location: Rotterdam, the Netherlands
Distribution: Slackwarelinux
Posts: 545

Rep: Reputation: 74
Normally, you compile things like gcc file.cc -o application (and a bunch of other parameters); Since you can compile multiple .cc files into one application (generating .o files which are later linked together) and this task usually is repetitive, Makefiles were invented, taking a big shortcut: a specific type of script that eases this compilation process.

After running the makefile (you run "make" which uses this makefile) you should have a new executable file, somewhere. It is specified in the makefile. Often, you'll find yourself running "make install" as well, which places the required files in their given location. (e.g. /usr/local/bin/ )

Your binary (executable code) will read the config files which tell it what to do.

Which part is your question about?
 
Old 06-21-2011, 10:22 PM   #3
ksatyaki
LQ Newbie
 
Registered: May 2010
Posts: 19

Original Poster
Rep: Reputation: 1
I have a g++ file something.cc. I know how to compile it using g++ <libraries> <filename> <etc>.

I know nothing more. I need to know how to use player-stage to run my program, just like it automatically runs laserobstacleavoid.cc........

Thanks in advance!
 
Old 06-30-2011, 07:02 PM   #4
ksatyaki
LQ Newbie
 
Registered: May 2010
Posts: 19

Original Poster
Rep: Reputation: 1
Please reply to my question
 
Old 07-01-2011, 02:17 AM   #5
Ramurd
Member
 
Registered: Mar 2009
Location: Rotterdam, the Netherlands
Distribution: Slackwarelinux
Posts: 545

Rep: Reputation: 74
well, for one I don't know Player Stage and I don't know what part is/was unclear. Is it this project: http://playerstage.sourceforge.net/ ?
So, you compiled player-stage and you have some binaries that were created by the Makefile.
Since there are so few replies, I think you'll have to dive into the documentation that is provided on the above site. But I think there's some sort of understanding needed:
is Player-Stage an API? If so, you'll have to figure out the libraries that have to be linked and header files to include to get your program getting compiled. If it is not an API, then I think this application uses a cusom "syntax" for the applications you can write for it, and not compile with gcc.

Again: it won't hurt you at all to read the documentation; you'll have to read that anyway, as you'll want to know the function calls you'll need.
 
Old 07-01-2011, 11:41 PM   #6
ksatyaki
LQ Newbie
 
Registered: May 2010
Posts: 19

Original Poster
Rep: Reputation: 1
ok. will do that. thanks
 
Old 09-01-2011, 07:37 AM   #7
benoitbenjamin
LQ Newbie
 
Registered: Sep 2011
Posts: 3

Rep: Reputation: Disabled
Quote:
Originally Posted by ksatyaki View Post
ok. will do that. thanks
Did you solve the problem? I have the same question for you.
Thank you in advance.
 
Old 09-02-2011, 07:20 AM   #8
ksatyaki
LQ Newbie
 
Registered: May 2010
Posts: 19

Original Poster
Rep: Reputation: 1
I actually didn't solve the problem, but I have an alternate solution. We can edit laserobstacleavoid.cc of any of the examples in the "/usr/local/share/player/examples/libplayerc++" or "....../libplayerc" and run "ccmake .", "cmake ." and "make" to compile the examples. Then run player "simple.cfg" or any cfg you want (with the 'wander' commented out - if you don't know about this, read Jennifer Owen's Player/Stage manual). Then, run your compiled example by typing "./laserobstacleavoid".................................
 
1 members found this post helpful.
Old 09-02-2011, 09:42 AM   #9
benoitbenjamin
LQ Newbie
 
Registered: Sep 2011
Posts: 3

Rep: Reputation: Disabled
Quote:
Originally Posted by ksatyaki View Post
I actually didn't solve the problem, but I have an alternate solution. We can edit laserobstacleavoid.cc of any of the examples in the "/usr/local/share/player/examples/libplayerc++" or "....../libplayerc" and run "ccmake .", "cmake ." and "make" to compile the examples. Then run player "simple.cfg" or any cfg you want (with the 'wander' commented out - if you don't know about this, read Jennifer Owen's Player/Stage manual). Then, run your compiled example by typing "./laserobstacleavoid".................................
Excuse me, I am a newbie for player/stage, and would like to know the way to use the examples which go with the software, such as ¨example0.cc¨ in the "/usr/local/share/player/examples/libplayerc++" (directory you've mentionned). As i said, like you, each time I compile the .cc file, i got a file with no extension. I do not know how to run it. When I use ./ the file to run it, i get the error as following:
¨playerc error : connect call on [localhost:6665] failed with error
[111:Connection refused] terminate called after throwing an instance of 'PlayerCc::PlayerError' Aborted¨
And thanks for your answer, i begin to see that ¨ctrl "wander"¨ in the simple.world file controls the Pioneer2DX's behaviour, but i don't see how the robot find the laserobstacleavoid.cc despite of the lack of information, because we have never told the robot to use this .cc file to "wander". Why don't it take the "example0.cc" or any other .cc file as command?
Thanks a lot to give me a hand!
 
Old 09-03-2011, 10:33 AM   #10
ksatyaki
LQ Newbie
 
Registered: May 2010
Posts: 19

Original Poster
Rep: Reputation: 1
Superb question: "Why does it run laserobstacleavoid.cc and why can we not specify any other example file....?"

I do not have the answer! I could never figure it out.

This is how you can run your compiled file using "./"

Comment out the wander thing and then run "player something.cfg"

Now you can see that the robot is stationary. So, open another terminal tab and run the compiled code using "./"

THAT IS IT! YOUR ROBOT IS NOW READY TO WORK FOR YOUR CODE!

Note: Sometimes the world file you are running (linked thru the .cfg file) may not contain the parameters for all sensors... In that case read that Jeniffer Owen's Guide and create a world file for that sensors you need. Eg. Camera, etc...
 
Old 09-05-2011, 09:47 AM   #11
benoitbenjamin
LQ Newbie
 
Registered: Sep 2011
Posts: 3

Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by ksatyaki View Post
Superb question: "Why does it run laserobstacleavoid.cc and why can we not specify any other example file....?"

I do not have the answer! I could never figure it out.

This is how you can run your compiled file using "./"

Comment out the wander thing and then run "player something.cfg"

Now you can see that the robot is stationary. So, open another terminal tab and run the compiled code using "./"

THAT IS IT! YOUR ROBOT IS NOW READY TO WORK FOR YOUR CODE!

Note: Sometimes the world file you are running (linked thru the .cfg file) may not contain the parameters for all sensors... In that case read that Jeniffer Owen's Guide and create a world file for that sensors you need. Eg. Camera, etc...

What you told me about using the "./" to run the generated file is exactly what i want to know. Thank you very very much!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Yet another Player-Stage problem ksatyaki Linux - Software 6 06-19-2011 08:16 AM
Error installing Player/Stage/Gazebo ksatyaki Linux - Software 1 01-24-2011 03:35 PM
Able to write files to MP3 player but no files written into actual device? olnex Linux - Hardware 0 11-11-2005 06:32 AM
Half of my applications are broken. I am using Gentoo stage 1 on 3 nptl (stage 1.5) dragonslay Linux - Games 3 04-01-2005 05:23 PM
Gentoo: Stage 1, Stage 2, or Stage 3 skorpi0wn Linux - Distributions 3 03-01-2005 07:47 PM


All times are GMT -5. The time now is 12:42 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration