Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending commands to FCU #25

Closed
mhkabir opened this issue Jun 7, 2014 · 14 comments
Closed

Sending commands to FCU #25

mhkabir opened this issue Jun 7, 2014 · 14 comments

Comments

@mhkabir
Copy link
Member

mhkabir commented Jun 7, 2014

What would be best way we could implement sending of messages via Mavlink to a connected FCU?

I want to send the VISION_POSITION_ESTIMATE mavlink message, with data from another node.

@vooon
Copy link
Member

vooon commented Jun 7, 2014

  1. You can send/receive raw Mavlink messages via from/to topics from your node
  2. You can write custom plugin (check plugin loader documentation)
  3. You can wait some time for 0.4.0 release (general command plugin Command plugin #12 )

@mhkabir
Copy link
Member Author

mhkabir commented Jun 7, 2014

Can you suggest how I can send/receive raw Mavlink messages via from/to topics ?

@vooon
Copy link
Member

vooon commented Jun 7, 2014

See ros_udp.cpp, but additional encode/decode messages.

I want to implement command plugin today.

@mhkabir
Copy link
Member Author

mhkabir commented Jun 7, 2014

If you implement the command plugin, awesome :D In the meantime I'll check out the source.

vooon added a commit that referenced this issue Jun 7, 2014
@vooon
Copy link
Member

vooon commented Jun 7, 2014

CommandPlugin released!

I misunderstood your problem. I thought that this VISION_POSITION_ESTIMATE is value for COMMAND_LONG.command, rather than the message itself. However, the methods 1 and 2 are valid.

I would recommend method 2: coding is easier and less overhead (see dummy.cpp).
Your plugin can be stationed in a separate package (read pluginlib documentation).

@mhkabir
Copy link
Member Author

mhkabir commented Jun 8, 2014

I finished writing my own plugin. Can you please check if it is OK : http://pastebin.com/WbeSqvMH

Also it would be great if you could give me some simple example code on how to use plugins like Commander from another node. The pluginlib documentation is a bit confusing.

@vooon
Copy link
Member

vooon commented Jun 8, 2014

  1. Create new package by catkin_creage_pkg
    Example:

    cd ~/ros_ws/src
    catkin_create_pkg mavros_vision mavros
    
  2. Create src, srv, msg folders

  3. Edit CMakeLists.txt: add messages, servicies, and library for plugin, add this:

    add_definitions(
    -std=c++11
    -DMAVLINK_DIALECT=${MAVLINK_DIALECT}
    )

  4. Edit package.xml, add this:
    <mavros plugin="${prefix}/vision_plugins.xml" />

  5. Edit vision_plugins.xml, add definition like in mavros_plugins.xml

  6. Write code, messages and build via catkin_make in ~/ros_ws

Your plugin with my suggestions: mavros_vision_example_extplugin.tar.xz

@mhkabir
Copy link
Member Author

mhkabir commented Jun 8, 2014

Thanks a lot for your suggestions. I will build upon what you said.

@BabakAkbari
Copy link

BabakAkbari commented Aug 1, 2019

Hi @vooon,@mhkabir
I followed @vooon instruction and I was able to successfully build my custom plugin
But I am currently unable to run this plugin
Now I have .so file in my /devel directory
I don't know what to do further?

@vooon
Copy link
Member

vooon commented Aug 2, 2019

@BabakAkbari check that you sourced ~/ws/devel/setup.bash after the build.

@BabakAkbari
Copy link

After sourcing ~/ws/devel/setup.bash and
Launching mavros I should be able to see my topic I created? Does Mavros automatically find my package and plugin which is located in another workspace? @vooon

@vooon
Copy link
Member

vooon commented Aug 2, 2019 via email

@BabakAkbari
Copy link

BabakAkbari commented Aug 3, 2019

Hi @vooon thanks for your response
I ran "rospack plugins --attrib=plugin mavros"
And it returned the name of my plugin but when I launch apm I can't see my plugin's name in the list of plugins mavros shows
Also I ran "rostopic list" and my plugin's topic not shown as well. Am I doing something wrong?

@vooon
Copy link
Member

vooon commented Aug 3, 2019

Check that your plugin have same format as present mavros. That issue is quite old, so it describe older plugins.
Also check that you have all necessary macroses called. Check dummy.cpp.

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

No branches or pull requests

3 participants