Emlid

Navio 2 With Matlab ROS


(Alexis Offermann) #1

Hello,

I’m new using ROS and I have an issue while trying to use my navio2 (RPI3) with the ROS toolbox of Matlab.
My goal is to get the IMU information of the navio2 in my simulink workspace.
What is working :

  • I am connected to the navio2 with matlab
  • I can create publisher and subscribers in matlab and see them active in my navio workspace
    (using ‘rostopic info /mavros/imu/data’)
  • I started to stream the IMU infos and can access to them in the navio2 workspace (using the echo command)

What is not working :
I can’t access to the imu informations in the matlab workspace
When i try to ping the node, i got no response in any direction (matlab to navio and vice versa)
when i ping the matlab node in the matlab workspace i got a response…

Can anyone help me please ?
Thanks !

Regards

Alexis


(Andrew Yushkevich) #3

Hi @alexis.offermann,

Unfortunately, we haven’t tested ROS with Matlab.
I’d recommend looking at this post.

You’ve got an interesting project. I’ll appreciate if you share your results after.

Thanks.


(Alexis Offermann) #4

hi @andrew.yushkevich

Eventually I fixed my problem, here the solution :

  • In the File /etc/environemment add a command line

ROS_IP=192.168.1.1

with the IP adress corresponding to the one used by the Navio

  • Then you have to edit following file in

nano /lib/systemd/system/mavros.service

I copy here the eventuall mavros.service file i used :

[Unit]
Description=mavros
Wants=network-online.target
After=network-online.target

[Service]
EnvironmentFile=/etc/environment
Type=simple
ExecStart=/bin/bash -c “source /opt/ros/kinetic/setup.bash; /usr/bin/python /opt/ros/kinetic/bin/roslaunch mavros apm.launch”
Restart=on-failure

[Install]
WantedBy=multi-user.target

Now that this point is fixed i finally get the IMU data directly in matlab, by subscribing to the /mavros/imu/data node, what is very powerfull. Happy so far.

This brings me to another question :
What node has to be used to control the PWM’s, and how ? I guess I only have to publish on a node like mavros/rcout and send some data ? Can you please help me on that.

Thanks beforehand

Alexis


(Andrew Yushkevich) #5

Hi @alexis.offermann,

Unfortunately, I can’t recommend anything particular but maybe ROS forum can be helpful.