Skip to content
This repository has been archived by the owner on Aug 3, 2021. It is now read-only.

Syntax error in the controller? #38

Closed
adaldo opened this issue Aug 23, 2016 · 10 comments
Closed

Syntax error in the controller? #38

adaldo opened this issue Aug 23, 2016 · 10 comments

Comments

@adaldo
Copy link

adaldo commented Aug 23, 2016

When

rosrun crazyflie_controller controller.cpp

I get

line 9: syntax error near unexpected token `('
line 9: `double get('
@whoenig
Copy link
Owner

whoenig commented Aug 23, 2016

You can only rosrun executables, not source files. Try
rosrun crazyflie_controller controller

@adaldo
Copy link
Author

adaldo commented Aug 23, 2016

When

rosrun crazyflie_controller controller

I get

[rosrun] Couldn't find executable named controller below /home/adaldo/catkin_ws/src/crazyflie_ros/crazyflie_controller

(To compile my project I catkin build and then I source /devel/setup.bash.)

However, I found out that if I

roslaunch crazyflie_controller crazyflie2.launch frame:="body"

then the controller node starts.

@whoenig
Copy link
Owner

whoenig commented Aug 23, 2016

The executable name is actually crazyflie_controller as well, so try
rosrun crazyflie_controller crazyflie_controller
The recommended usage is using launch files though, since this simplifies setting parameters etc.

@adaldo
Copy link
Author

adaldo commented Aug 23, 2016

How did I miss that!
Thank you so much.

@adaldo adaldo closed this as completed Aug 23, 2016
@gitsr-sys
Copy link

gitsr-sys commented Feb 2, 2018

Hi, @adaldo and @whoenig, I have a programming question about this issue.
Actually, I am a beginner, so it will be very thankful if you explain specifically.

I looked over hover_vicon.launch file, and found the line that file="$(find crazyflie_controller)/launch/crazyflie2.launch".
Also, when I looked over the crazyflie2.launch file in crazyflie_controller/launch folder, I found that the line
< node name="controller" pkg="crazyflie_controller" type="crazyflie_controller" output="screen" >.
However, I do not understand this line, because there is no crazyflie_controller file in crazyflie_controller/src folder, but controller.cpp file...
Even I cannot find crazyflie_controller file at all.

Could you explain about it?

Thank you in advance.

@whoenig
Copy link
Owner

whoenig commented Feb 5, 2018

crazyflie_controller refers to the package name and not a file name. The package name is (just in this case) identical to the folder name.

@gitsr-sys
Copy link

Thank you for your reply, @whoenig .
In fact, the text editor did not show "the line" what I attached.
The line in crazyflie2.launch file is the following
< node name="controller" pkg="crazyflie_controller" type="crazyflie_controller" output="screen" >

According to this line, I think the package name is defined in "pkg", so package name is what you said, crazyflie_controller.
But, it also said type has the same name with pkg name....
That is, type is defined as "crazyflie_controller".
This is what I do not understand... the file "crazyflie_controller" does not exist...but controller.cpp exists in crazyflie_controller package...
Could you please explain about it for me?

Thank you.

@whoenig
Copy link
Owner

whoenig commented Feb 6, 2018

This refers to the name of the executable defined here.

@netkimjh
Copy link

netkimjh commented Feb 7, 2018

Thank you for clear explanation.

But, I leant from tutorial that they use it like the following
add_executable(controller src/controller.cpp).
Then, you can use
< node name="controller" pkg="crazyflie_controller" type="controller" output="screen" >

I am curious if you have any special reason for changing the name.
If there is no reason, then just ignore my question...

Thank you anyway.

@whoenig
Copy link
Owner

whoenig commented Feb 8, 2018

No reason.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants