Motive to ROS via NatNet

NatNet, VRPN, TrackD, and Plugins
Yan Zhang
Posts: 19
Joined: Fri May 15, 2015 8:26 am

Motive to ROS via NatNet

Post by Yan Zhang »

Hello,

We get a Motive 1.7.5 (NatNet Module v2.7) on a Windows and a ROS(hydro) on Ubuntu. Now we want to stream pose data from Motive to ROS. I tried the ROS package "mobcap_optitrack"http://wiki.ros.org/mocap_optitrack. I followed the instruction, but it seems to be written for the old version Motive. I am stuck at some places.

1. I am not familiar with the IP Multicast technique. How should I set the Multicast Address on Motive and the client codes? Now my Motive setting is the default value "239.255.42.99" and the client codes set the multicast IP as "224.0.0.1".

2. I am told to set the Trackable ID of rigid bodies on Motive by the package instruction. But I can't find where to set them under the current Motive version 1.7.5.

I am trying to use NatNet SDK sample codes to develop my own client on ROS now. But I guess above two questions will keep bothering me. Any help is extremely appreciated!

Thanks,
Yan
Yan Zhang
Posts: 19
Joined: Fri May 15, 2015 8:26 am

Re: Motive to ROS via NatNet

Post by Yan Zhang »

Hi everyone,

To follow up, the package works. For anyone who is interested, there is a new branch Motive17 for this mobcap_optitrack package which works well for me now. The multicast IP on Motive should be typed as the IP address of the client robot.

However, I still could not find where to define or change the trackable ID of rigid body on the 1.7.5 version Motive. Hope someone can point the right direction for me.

Thanks,
Yan
steven.andrews
NaturalPoint Employee
NaturalPoint Employee
Posts: 720
Joined: Mon Jan 19, 2015 11:52 am

Re: Motive to ROS via NatNet

Post by steven.andrews »

Hello Yan,

Happy to hear you worked out the IP addresses.

The Trackable ID is called User Data in Motive. If you select a rigid body and open the Rigid Bodies pane, you can find it under Rigid Bodies -> Advanced -> User Data.

Cheers,
Steven
--
Steven Andrews
OptiTrack | Customer Support Engineer
Yan Zhang
Posts: 19
Joined: Fri May 15, 2015 8:26 am

Re: Motive to ROS via NatNet

Post by Yan Zhang »

Hi Steven,

Appreciate the answer! The user data does work!

I get another problem here. I want to stream the pose of unidentified markers from Motive. I am currently thinking of trying the PacketClient.cpp file in the NatNet SDK. But when I try to compile it on Ubuntu, it returns fatal error message about losing the <tchar.h>, <conio.h> header files. These two files work under Windows. So I wonder if there are any replacement solutions for these files on Ubuntu? Furthermore, are there any more potential problems to run this cpp on Ubuntu?

For anyone who are also interested in this topic, there is a post https://forums.naturalpoint.com/viewtop ... nux#p57680 about this topic. It says we also need to take care of the <winsock2.h> and <ws2tcpip.h> header files.

Thanks,
Yan
steven.andrews
NaturalPoint Employee
NaturalPoint Employee
Posts: 720
Joined: Mon Jan 19, 2015 11:52 am

Re: Motive to ROS via NatNet

Post by steven.andrews »

Hi Yan,

Happy to hear that you've made some progress with NatNet streaming.

The packet client is meant to be an example of the basic calls that are needed to initiate a connection to the data stream and collect data, but it would have to be adapted for a linux environment. I do not believe it would run, as is, in Linux.

Other users have made a sample that works in Linux, but this is not an official OptiTrack package and is not officially supported. Still this may prove useful in your attempts to run in Ubuntu.
https://drive.google.com/file/d/0B5pHch ... sp=sharing

Cheers,
Steven
--
Steven Andrews
OptiTrack | Customer Support Engineer
Yan Zhang
Posts: 19
Joined: Fri May 15, 2015 8:26 am

Re: Motive to ROS via NatNet

Post by Yan Zhang »

Hi Steven,

Appreciate the share!

Since I have already worked for a while on the mocap_optitrack package, so it's easier for me to start from their package. The good news is tracking labeled markers' positions and unlabeled markers' positions both work out for me using this package on ROS!

Actually this package is very easy to use. For anyone who is also interested, to edit this package to track single markers, you need to make some changes to the mobcap_node, mocap_datapackets and mocap_config. It sounds a lot of works to do, but actually if you have some experience with how to write ROS publisher and ROS parameter server configuration, the codes are not hard to read and edit. Because the depacketization of the mocapdata has already been finished for us in the parse() function in the mocap_datapackets.cpp. What is left for us is just to find the data we want and publish them to some topic.

By the way, the marker location displayed on the "Rigid Bodies" pane on Motive 1.7.5 doesn't seem to be the absolute 3D position in the optitrack frame. It seems to be the relative position in the local rigid body frame. Can I display the absolute position of these markers?

Really appreciate your help a lot, Steven! Hope everyone is having fun with the Optitrack!

Best,
Yan
steven.andrews
NaturalPoint Employee
NaturalPoint Employee
Posts: 720
Joined: Mon Jan 19, 2015 11:52 am

Re: Motive to ROS via NatNet

Post by steven.andrews »

Hi Yan,

The Marker Positions in the Rigid Bodies pane are the marker positions in the space of the rigid body. This display is not meant to show realtime position information for those markers, it is just exposing that aspect of the Rigid Body definition.

The global position of those markers cannot be displayed in realtime. They will have to be accessed using the NatNet SDK to read the realtime data stream, or from a recorded Take by observing the graph or by exporting the data to the file type of your choice.

Cheers,
Steven
--
Steven Andrews
OptiTrack | Customer Support Engineer
Shusen
Posts: 3
Joined: Tue Feb 23, 2016 8:15 pm

Re: Motive to ROS via NatNet

Post by Shusen »

Exceuse me, Thank for your questions and replys. I have the same question as you had.
I am using Ubuntu 14.04 and ROS indigo, I want to connect Optitrack and ROS together, and then connect to pixhawk, then fly quadrotor indoors. but when I run

rosrun mocap_optitrack mocap_node

It comes
[ INFO] [1456283314.236077897]: Creating socket...
[ INFO] [1456283314.236243661]: Setting socket options...
[ INFO] [1456283314.236349167]: Local address: 0.0.0.0:1511
[ INFO] [1456283314.236426098]: Binding socket to local address...
[ INFO] [1456283314.236508380]: Joining multicast group 224.0.0.1...
[ INFO] [1456283314.236597180]: Enabling non-blocking I/O
[ INFO] [1456283314.243704565]: 826 bytes received from 192.168.1.100:1511
Segmentation fault (core dumped)

and crushed.

Why this happen?
I will appreciate if you could help. Thanks a lot!
Shusen
Posts: 3
Joined: Tue Feb 23, 2016 8:15 pm

Re: Motive to ROS via NatNet

Post by Shusen »

Can you give me some advice about how to change the code mocap_config.cpp, mocap_datapackets.cpp and mocap_node.cpp?
trackback
Posts: 4
Joined: Thu Mar 17, 2016 1:30 pm

Re: Motive to ROS via NatNet

Post by trackback »

Were you able to solve the seg fault problem Shusen?
Post Reply