Motive to Ros

Hi, I want to send the position to ROS, but I have a question:

I have been reading and lots of people use mocap_optitrack, but This package can only be installed in ros indigo.

Is there another way to send position data to ros?
I have Ros Kinetic. Can I use mocap_optitrack?

Greetings and please answer

This will be helpful for you. http://wiki.ros.org/mavros
Have a look at ā€œsetpoint_positionā€.

Thanks for answering, Actually I am reading the tutorial ROS, I have a problem, Motive (Optitrack program) only is available for windows, so, I have two laptops (windows and ubuntu).

I would like to know: how can I send the drone position (windows pc to mavros (ubuntu pc)?

Hey, I use Motive Tracker as well with OptiTrack cameras. You have two options - 1) Build the mocap_optitrack package from source or 2) Use the vrpn_client_ros package to publish vrpn data from Motive Tracker. All you have to do with the vrpn package is provide it the mocap server IP (see the sample.launch file that comes with the package). In Motive, make sure you are streaming VRPN data by going to View > Streaming > Check the box in front of Stream VRPN Data. Lastly, make sure you either turn off the Windows Firewall or create outbound rules for the VRPN port (recommended).

I hope that helps.

Hi friend. Thanks for replying, I install vrpn_client_ros and and when I run the .launch file I get the following error:

mario1577@MarioPC:~$ roslaunch vrp_client_ros sample.launch[sample.launch] is neither a launch file in package [vrp_client_ros] nor is [vrp_client_ros] a launch file name
The traceback for the exception was written to the log file

In the same way, I install mocap_optitrack and when I run the .launch file I get the same error.

Why should I get this error?

I incorrectly install vrpn_clien_ros or mocap_optitrack?

Greetings.

Yea it looks like the package didnā€™t install properly. The command to install the package should look something like sudo apt-get install ros-kinetic-vrpn-client-ros. To make sure you have the package installed properly, you can do a roscd vrpn_client_ros and then type ls to see the contents of the folder. There should be a sample.launch file in the launch folder. You might have to open another terminal for the bash auto completion to work.

hi another possibility is you dint source right configuration files(files) to bash
try something like this

source /opt/ros//setup.bash

Thanks for replying, I was able to solve the previous problem. When I am running the launch file this appears:

ā€¦ logging to /home/mario1577/.ros/log/4e23dd78-2638-11e7-a5a6-b88198a5c17f/roslaunch-MarioPC-10731.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://MarioPC:34071/

SUMMARY
========

PARAMETERS
** * /rosdistro: kinetic**
** * /rosversion: 1.12.7**
** * /vrpn_client_node/broadcast_tf: True**
** * /vrpn_client_node/frame_id: world**
** * /vrpn_client_node/port: 3883**
** * /vrpn_client_node/refresh_tracker_frequency: 1.0**
** * /vrpn_client_node/server: 239.255.42.99**
** * /vrpn_client_node/update_frequency: 100.0**
** * /vrpn_client_node/use_server_time: False**

NODES
** /**
** vrpn_client_node (vrpn_client_ros/vrpn_client_node)**

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[vrpn_client_node-1]: started with pid [10749]
[ INFO] [1492741354.223457937]: Connecting to VRPN server at 239.255.42.99:3883
[ INFO] [1492741355.224083775]: Connection established
vrpn_connect_udp_port: canā€™t bind udp socket.
vrpn_udp_request_lob_packet: send() failed: Bad file descriptor
vrpn_Endpoint: mainloop: Canā€™t lob UDP request
vrpn_connect_udp_port: canā€™t bind udp socket.

In motive optitrack I have Option enabled ā€œVRPN Sreaming dataā€ with IP and port: 239.255.42.99 and 3883"
When I execute the rostopic instruction, I do not appear the Published Topics of VRPN, so:

Why can not I display the position data in a new terminal?
Do I have to configure the networks of my ubutu machine? (I am a noob in ubuntu) :frowning:

I have the two computers (windows and ubuntu) connected an ethernet cable (Is necessary a router?)

Regards!!!

How can I use the vrpn_print_devices command to receive messages from your VRPN Tracker ??

I could not find the solution :confused:

Hi, making more experimental tests, now I get the following error:

roslaunch vrpn_client_ros sample.launch server:=ā€œ192.168.1.2ā€
ā€¦ logging to /home/mario1577/.ros/log/57663458-2c5a-11e7-aa33-b88198a5c17f/roslaunch-MarioPC-32508.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://MarioPC:33475/

SUMMARY

PARAMETERS

  • /rosdistro: kinetic
  • /rosversion: 1.12.7
  • /vrpn_client_node/broadcast_tf: True
  • /vrpn_client_node/frame_id: world
  • /vrpn_client_node/port: 3883
  • /vrpn_client_node/refresh_tracker_frequency: 1.0
  • /vrpn_client_node/server: 192.168.1.2
  • /vrpn_client_node/update_frequency: 100.0
  • /vrpn_client_node/use_server_time: False

NODES
/
vrpn_client_node (vrpn_client_ros/vrpn_client_node)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[vrpn_client_node-1]: started with pid [32526]
[ INFO] [1493416155.374921537]: Connecting to VRPN server at 192.168.1.2:3883
check_vrpn_cookie(): VRPN Note: minor version number doesnā€™t match: (prefer ā€˜vrpn: ver. 07.33ā€™, got ā€˜vrpn: ver. 07.20 0ā€™). This is not normally a problem.
[ INFO] [1493416155.381228171]: Connection established
[ INFO] [1493416156.389104326]: Found new sender: RigidBody 1
[ INFO] [1493416156.389466996]: Creating new tracker RigidBody 1
[ERROR] [1493416156.389756511]: Invalid tracker name RigidBody 1, not creating topics : Character [ ] at element [9] is not valid in Graph Resource Name [RigidBody 1]. Valid characters are a-z, A-Z, 0-9, / and _.
^C[vrpn_client_node-1] killing on exit
Connection was deleted while 1 references still remain.
shutting down processing monitorā€¦
ā€¦ shutting down processing monitor complete
done

Do I have to modify the launch file??

Hello,

I am using optitrack as well and Motive software to stream vrpn.
I am using px4 and compile it using make px4fmu-v2_lpe

I also use vrpn_client_ros to receive position of my tracked object successfully.

I am using mavros to connect to the drone, mocap pose is enabled by default.
I simply added the remap to fwd my /vrpn_client_ros/tracked_object/pose to /mavros/mocap/pose

As my lpe position is never init, I donā€™t seem to receive the att_pose_mocap msg on px4 side.
@kPanesar and others do you have any idea on what I may miss please ?

Did I understand properly that doing the remapping from vrpn to mavros should be sufficient so that mavros fwd this back to the drone ?
Or do I need to set some other parameters of the px4_config file for that ?

Thanks for your help.
Have a nice day !

Hello,

I forget to mention yesterday that I am connecting directly to a 3DR radio.
Do I need to connect the 3DR radio on the drone on port TELEM 2 or it should also work smoothly in 1 ?

I have mavros version 0.17.4
Should I upgrade it or it should be all right ?

Thanks in advance for your advises !
Have a nice day

@Mario1577
I guess that your problem is due to the space character in the tracker name. It is not a valid character.
You juste have to rename it using Motive, in object properties: ā€œrename assetsā€

@GregoireH Hello!

I imagine that we are doing the same project, I have enabled in the px4: External position (ATT_EXT_HDG_M) and the estimator (LPE) and disabled the estimator (EKF).

I am using vrpn to send position datas of motive to ROS.

Similary, I have two PC (Windows and Ubuntu) and Iā€™m going to transmit position data to my 3dr Iris drone using telemetry (TELEM1) boudrate 57600.

Reading in the forum, if you want to send the position data to px4 you have to use the mavros plugin (MOCAP_POSE_ESTIMATE).

I am in this process, but I do not know how to use this plugin and I am searching how to use it.

Hello!

I am also working with a very similar setup. I have:

One Windows computer running Motive 1.10, streaming data using the vrpn broadcast.

One Ubuntu computer connected via LAN to the first, running ROS (including MAVROS and vrpn_client_ros).

I can launch vrpn_client_node with the Motive IP as an argument. This node will auto-detect trackers and send positions to /tf.

$ roslaunch vrpn_client_ros sample.launch server:=192.168.1.148

I then launch px4.launch in the mavros package. In my (unchanged) installation of the latest version, it launches the mavros_mocap_pose plugin. So no changes have to be done here.

$ roslaunch mavros px4.launch fcu_url:=ā€œudp://:14550@192.168.4.1:14555ā€ gcs_url:="udp://@192.168.4.2:14556

(iā€™m connected over wi-fi to the FCU. The second argument is the IP of my Ubuntu computer within the FCUā€™s wifi. This enables QGroundControl to run without crashing mavros.)

Finally, to have the pose data sent to mavros, I use a relay node from the topic_tools:

$ rosrun topic_tools relay /vrpn_client_node/(tracker name)/pose /mavros/mocap/pose

(notice there is a space between the name of the two topics. Also, make sure the topics are of the same type!)
I can then check that the FCU receives the data by echoing the following topic:

$ rostopic echo /mavros/local_position/pose

I can also verify it in QGroundControl.

I hope this helps you, if not, I hope it helps the next guy :slight_smile:

Thierry

1 Like

Hello @Thierry_B

Thanks for helping!

At this time I am having a trouble, I am remapping the mocap data of vrpn_client_ ros to mocap/pose, so I am getting in mavros a time out.

Matbe the solution to my trouble is use a relay node ike the one you used.

What is a relay node?
How did you make the relay node?

I am using two telemetry with 57600 Boudrate, Regads!!

Hello @Mario1577

I realized that lowering the tracking camera frequency to lower than 100Hz helps a lot for removing the timeout in my cases.

I used the same setup as @Thierry_B. Thanks for your tips, works well for me.
Best

Hello both,

@Mario1577 A relay node is a very simple node that submits to one topic and remaps it to another. I did not make it, as I said itā€™s part of the topic_tools package, included by default in ROS. If you type the command I wrote on my previous post, it will create such a relay node between the two topics put as arguments.

The reason I used that in the first place is that I was not able to remap the topics using a remap in the launch files. Maybe it adds some delay, but i am pretty sure it is negligible.

@GregoireH You are welcome, any time!

Now I have a question: What do you use to send the position commands to the drone? I see there is an example code in the devguide, but it does not allow for input. Right?

Also, ever ten seconds or so, I receive a warning that there is a time shift detected, and that the FCU hard-resyncs itā€™s clock. I think I understand what it means, I am just curious if it will cause issues in the futureā€¦ Does the same happen to you?

Cheers,

Thierry

Hello both!!

@Thierry_B Sometimes I get a resync message: [ WARN] [1496967624.310625901]: TM: Clock skew detected (-0.015507201 s). Hard syncing clocks.

I sole the problem by restarting the roscore.

@GregoireH Do you use a companion computer?

Hello! @Thierry_B
I used the topic_tools package and it works well !!, I solve the timeout problem by setting the 3dr radio telemetry- 915Mhz parameters: low latency mode and increasing the air-rate.

Now I am researching how to send commands position and I found this: https://404warehouse.net/2015/12/20/autopilot-offboard-control-using-mavros-package-on-ros/

The pub_setpoints.cpp file is similar to offboard example in the dev-guide px4.

Greetings and thanks for your help
.