whoenig / crazyflie_ros

ROS Driver for Bitcraze Crazyflie
MIT License
192 stars 205 forks source link

Roslaunch vrpn_hover.launch occurs some errors #114

Open lkyfly0765 opened 5 years ago

lkyfly0765 commented 5 years ago

Hi Whoenig: We are going to do some research on crazyflies, and we have the Optitrack as the mocap system. I following the instructions which provide in Flying Multiple UAVs Using ROS, and we are trying to let the single crazyflie to hover at a specified coordinate.

I have correctly configured the network on my laptop which runs the Ubuntu 14.05 caring the ROS system, and I have established the vrpn connections between the server computer which runs the Motive and my computer.The rigid body data can be attained by the ROS system.

Then I use eric@eric-ThinkPad-S2:~$ roslaunch crazyflie_demo hover_vrpn.launchthe Rviz open as expect, and the crazyflie connected to the Crazyradio successfully. The I press the green button on the Xbox360 joystick, it occurs some errors, and the connection between Crazyflie and crazyradio lost. What's wrong with it? How can I figure it out?

Thanks very much!

HERE IS THE LOG I COPIED FROM THE TERMINAL eric@eric-ThinkPad-S2:~$ roslaunch crazyflie_demo hover_vrpn.launch ... logging to /home/eric/.ros/log/3d764118-feaf-11e8-a4ec-34f64bc13130/roslaunch-eric-ThinkPad-S2-18643.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.

xacro: Traditional processing is deprecated. Switch to --inorder processing! To check for compatibility of your document, use option --check-order. For more infos, see http://wiki.ros.org/xacro#Processing_Order xacro.py is deprecated; please use xacro instead started roslaunch server http://eric-ThinkPad-S2:46519/

SUMMARY

PARAMETERS

NODES /crazyflie/ baselink_broadcaster (tf/static_transform_publisher) controller (crazyflie_controller/crazyflie_controller) crazyflie_add (crazyflie_driver/crazyflie_add) joy (joy/joy_node) joystick_controller (crazyflie_demo/controller.py) pose (crazyflie_demo/publish_pose.py) vrpn (ros_vrpn_client/ros_vrpn_client) / crazyflie_server (crazyflie_driver/crazyflie_server) rviz (rviz/rviz)

ROS_MASTER_URI=http://localhost:11311

process[crazyflie_server-1]: started with pid [18663] process[crazyflie/crazyflie_add-2]: started with pid [18664] process[crazyflie/joy-3]: started with pid [18671] process[crazyflie/joystick_controller-4]: started with pid [18683] process[crazyflie/controller-5]: started with pid [18696] process[crazyflie/pose-6]: started with pid [18708] process[crazyflie/baselink_broadcaster-7]: started with pid [18715] ERROR: cannot launch node of type [ros_vrpn_client/ros_vrpn_client]: ros_vrpn_client ROS path [0]=/opt/ros/kinetic/share/ros ROS path [1]=/home/eric/crazyflie_ws/src ROS path [2]=/opt/ros/kinetic/share process[rviz-9]: started with pid [18721] [ INFO] [1544693916.676692342]: wait_for_service /add_crazyflie [ INFO] [1544693916.682308135]: found /addcrazyflie [ INFO] [1544693916.707744086]: Adding radio://0/99/2M as crazyflie with trim(0.000000, 0.000000). Logging: 1, Parameters: 0, Use ROS time: 1 [ INFO] [1544693916.787465893]: Opened joystick: /dev/input/js0. deadzone: 0.050000. [ WARN] [1544693916.820802795]: Received unrequested data for block: 0 [ WARN] [1544693916.822350875]: Received unrequested data for block: 0 [ WARN] [1544693916.823745598]: Received unrequested data for block: 0 [ WARN] [1544693916.826007066]: Received unrequested data for block: 0 [ WARN] [1544693916.829378873]: Received unrequested data for block: 0 [ WARN] [1544693916.830813201]: Received unrequested data for block: 0 [ WARN] [1544693916.832184832]: Received unrequested data for block: 0 [ WARN] [1544693916.833636089]: Received unrequested data for block: 0 [ WARN] [1544693916.835150110]: Received unrequested data for block: 1 [ WARN] [1544693916.836619250]: Received unrequested data for block: 0 [ WARN] [1544693916.838049663]: Received unrequested data for block: 0 [ WARN] [1544693916.840200255]: Received unrequested data for block: 0 [ WARN] [1544693916.841728012]: Received unrequested data for block: 0 [ WARN] [1544693916.843188294]: Received unrequested data for block: 0 [ WARN] [1544693916.844647729]: Received unrequested data for block: 0 [ WARN] [1544693916.846238137]: Received unrequested data for block: 0 [ WARN] [1544693916.847640199]: Received unrequested data for block: 0 [ WARN] [1544693916.849004644]: Received unrequested data for block: 0 [ WARN] [1544693916.850367412]: Received unrequested data for block: 0 [ WARN] [1544693916.851850372]: Received unrequested data for block: 1 [ WARN] [1544693916.854193381]: Received unrequested data for block: 0 [ WARN] [1544693916.855649713]: Received unrequested data for block: 0 [ WARN] [1544693916.857100051]: Received unrequested data for block: 0 [ WARN] [1544693916.858516980]: Received unrequested data for block: 0 [ WARN] [1544693916.859962727]: Received unrequested data for block: 0 [ WARN] [1544693916.861451174]: Received unrequested data for block: 0 [ WARN] [1544693916.862899770]: Received unrequested data for block: 0 [ WARN] [1544693916.864420015]: Received unrequested data for block: 0 [ WARN] [1544693916.865940701]: Received unrequested data for block: 0 [ WARN] [1544693916.867415151]: Received unrequested data for block: 1 [ WARN] [1544693916.868855552]: Received unrequested data for block: 0 [ WARN] [1544693916.870346789]: Received unrequested data for block: 0 [ WARN] [1544693916.871844061]: Received unrequested data for block: 0 [ WARN] [1544693916.873259971]: Received unrequested data for block: 0 [ WARN] [1544693916.874836076]: Received unrequested data for block: 0 [ WARN] [1544693916.876564620]: Received unrequested data for block: 0 [ WARN] [1544693916.878132221]: Received unrequested data for block: 0 [ WARN] [1544693916.879506459]: Received unrequested data for block: 0 [ WARN] [1544693916.880893125]: Received unrequested data for block: 0 [ WARN] [1544693916.882299534]: Received unrequested data for block: 0 [ WARN] [1544693916.883705146]: Received unrequested data for block: 1 [ WARN] [1544693916.885132496]: Received unrequested data for block: 0 [ WARN] [1544693916.886479128]: Received unrequested data for block: 0 [ WARN] [1544693916.887875758]: Received unrequested data for block: 0 [ WARN] [1544693916.889314749]: Received unrequested data for block: 0 [ WARN] [1544693916.890733090]: Received unrequested data for block: 0 [ WARN] [1544693916.892180609]: Received unrequested data for block: 0 [ WARN] [1544693916.893665615]: Received unrequested data for block: 0 [ WARN] [1544693916.895126503]: Received unrequested data for block: 0 [ WARN] [1544693916.896664663]: Received unrequested data for block: 0 [ WARN] [1544693916.898109100]: Received unrequested data for block: 0 [ WARN] [1544693916.899634969]: Received unrequested data for block: 1 [ WARN] [1544693916.901091987]: Received unrequested data for block: 0 [ WARN] [1544693916.902522150]: Received unrequested data for block: 0 [ WARN] [1544693916.903947394]: Received unrequested data for block: 0 [ WARN] [1544693916.905336536]: Received unrequested data for block: 0 [ WARN] [1544693916.906822018]: Received unrequested data for block: 0 [ WARN] [1544693916.910211220]: Received unrequested data for block: 0 [ WARN] [1544693916.912117693]: Received unrequested data for block: 0 [ WARN] [1544693916.913842304]: Received unrequested data for block: 0 [ WARN] [1544693916.915498667]: Received unrequested data for block: 0 [ INFO] [1544693916.916537921]: Requesting parameters... [crazyflie/crazyflie_add-2] process has finished cleanly log file: /home/eric/.ros/log/3d764118-feaf-11e8-a4ec-34f64bc13130/crazyflie-crazyflie_add-2*.log [ INFO] [1544693919.126246717]: Found variables in cache. [ INFO] [1544693919.392705502]: Requesting memories... [ INFO] [1544693919.401282020]: Memories: 2

[ INFO] [1544693919.422402363]: Elapsed: 2.603216 s [INFO] [1544693919.668016]: found update_params service [INFO] [1544693919.668775]: waiting for emergency service [INFO] [1544693919.671867]: found emergency service [INFO] [1544693919.672730]: waiting for land service [INFO] [1544693919.677472]: found land service [INFO] [1544693919.678094]: waiting for takeoff service [INFO] [1544693919.680637]: found takeoff service [ INFO] [1544693949.963402421]: Takeoff requested! [ERROR] [1544693949.963801181]: Exception thrown while processing service call: Could not find a connection between 'world' and 'crazyflie' because they are not part of the same tree.Tf has two or more unconnected trees. [ERROR] [1544693949.966671]: bad callback: <bound method Controller._joyChanged of <main.Controller instance at 0x7f01a26333f8>> Traceback (most recent call last): File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback cb(msg) File "/home/eric/crazyflie_ws/src/crazyflie_ros/crazyflie_demo/scripts/controller.py", line 46, in _joyChanged self._takeoff() File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 435, in call return self.call(*args, **kwds) File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 515, in call responses = transport.receive_once() File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 727, in receive_once p.read_messages(b, msg_queue, sock) File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 353, in read_messages self._read_ok_byte(b, sock) File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 336, in _read_ok_byte raise ServiceException("service [%s] responded with an error: %s"%(self.resolved_name, str)) ServiceException: service [/crazyflie/takeoff] responded with an error: Could not find a connection between 'world' and 'crazyflie' because they are not part of the same tree.Tf has two or more unconnected trees.

terminate called after throwing an instance of 'tf2::ConnectivityException' what(): Could not find a connection between 'world' and 'crazyflie' because they are not part of the same tree.Tf has two or more unconnected trees. [crazyflie/controller-5] process has died [pid 18696, exit code -6, cmd /home/eric/crazyflie_ws/devel/lib/crazyflie_controller/crazyflie_controller name:=controller log:=/home/eric/.ros/log/3d764118-feaf-11e8-a4ec-34f64bc13130/crazyflie-controller-5.log]. log file: /home/eric/.ros/log/3d764118-feaf-11e8-a4ec-34f64bc13130/crazyflie-controller-5*.log

whoenig commented 5 years ago

The error message

Could not find a connection between 'world' and 'crazyflie' because they are not part of the same tree.Tf has two or more unconnected trees.

indicates that there is an issue with your transformations. You can visualize the transformations using rosrun tf view_frames && evinces frames.pdf. Is there a world frame and a crazyflie frame that are connected by an arrow?

lkyfly0765 commented 5 years ago

I have used the command you provided and I got a pdf file which contains a arrow connect the world and cf1.

whoenig commented 5 years ago

You add the crazyflie using the name "crazyflie", so your rigid body should be named "crazyflie" and not "cf1".

lkyfly0765 commented 5 years ago

I have figure it out. The key is that I need to change the channel and the bandwidth in all related launchfiles. Another problem I am facing it that when the crazyflie take off using the hover-vrpn.launch file, it is not stable. In the launch file, the hover point is set to (0,0,0.5), but actually the crazyflie float at about (0,0,0.3) to (0,0,1). It’s altitude is not stable. What’s wrong with it? Does this problem relate to the PID parameters?

whoenig commented 5 years ago

The crazyflie now has an onboard position controller that can follow waypoints or trajectories at a much higher accuracy than the off-board controller you are using now. There is no documentation in crazylie_ros for that yet (although it is described in some of the older issues), but you can check out the crazyswarm project: https://crazyswarm.readthedocs.io (which also works if you are interested in just using a few CFs).

shmpwk commented 5 years ago

Hi, @lkyfly0765 @whoenig

I have a same error.

Could not find a connection between 'world' and 'crazyflie' because they are not part of the same tree.Tf has two or more unconnected trees.

How to change program like

to change the channel and the bandwidth in all related launchfiles.

Which file should I change or should I make another file?

I read #85 but I couldn't solve the problem yet.

lkyfly0765 commented 5 years ago

Hi Shumpei:

During my test, the solution is that in the launch file, in line 8, the ‘’like, you should confirm that the <default =“ xxxx” >match the rigid body name in Optitrack Motive application.

If you have any questions please contact me and I am very glad to solve it together.

Best regards, Eric Liu

On Mar 20, 2019, at 7:48 PM, Shumpei Wakabayashi notifications@github.com wrote:

Hi I have a same error.

Could not find a connection between 'world' and 'crazyflie' because they are not part of the same tree.Tf has two or more unconnected trees.

How did you change

to change the channel and the bandwidth in all related launchfiles.

?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

shmpwk commented 5 years ago

Thank you for your quick response, Eric. I'll try it tomorrow.

Best regards, Shumpei

lkyfly0765 commented 5 years ago

It’s my pleasure.

Sent from Mail for Windows 10

From: Shumpei Wakabayashi Sent: Wednesday, March 20, 2019 9:58 PM To: whoenig/crazyflie_ros Cc: lkyfly0765; Mention Subject: Re: [whoenig/crazyflie_ros] Roslaunch vrpn_hover.launch occurs someerrors (#114)

Thank you for your quick response, Eric. I'll try it tomorrow. Best regards, Shumpei — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

shmpwk commented 5 years ago

Hi, Eric,

I changed as you said, but cannot connect 'world' and 'crazyflie1'. Looking at tf view_frame, there are still two 'crazyflie1'. Did you change other program?
My launch file is this.

<?xml version="1.0"?>
<launch>
  <arg name="joy_dev" default="/dev/input/js0" />
  <arg name="ip" default="vicon" />
  <arg name="port" default="3883" />

  <arg name="uri" default="radio://0/80/250K" />
  <arg name="frame" default="crazyflie1" />
  <arg name="x" default="0" />
  <arg name="y" default="0" />
  <arg name="z" default="0.5" />

  <include file="$(find crazyflie_driver)/launch/crazyflie_server.launch">
  </include>

  <group ns="crazyflie">
    <include file="$(find crazyflie_driver)/launch/crazyflie_add.launch">
      <arg name="uri" value="$(arg uri)" />
      <arg name="tf_prefix" value="crazyflie" />
      <arg name="enable_logging" value="False" />
    </include>

    <node name="joy" pkg="joy" type="joy_node" output="screen">
      <param name="dev" value="$(arg joy_dev)" />
    </node>

    <node name="joystick_controller" pkg="crazyflie_demo" type="controller.py" output="screen">
      <param name="use_crazyflie_controller" value="True" />
    </node>

    <include file="$(find crazyflie_controller)/launch/crazyflie2.launch">
      <arg name="frame" value="$(arg frame)" />
    </include>

    <node name="pose" pkg="crazyflie_demo" type="publish_pose.py" output="screen">
      <param name="name" value="goal" />
      <param name="rate" value="30" />
      <param name="x" value="$(arg x)" />
      <param name="y" value="$(arg y)" />
      <param name="z" value="$(arg z)" />
    </node>
  <!-- run vrpn client -->
    <node pkg="vrpn_client_ros" name="vrpn" output="screen" type="vrpn_client_node" required="true">
      <param name="ip" value="$(arg ip)" />
      <param name="port" value="$(arg port)" />
      <param name="frame_id" value="/world" />
      <param name="child_frame_id" value="$(arg frame)" />
    </node>

    <node pkg="tf" type="static_transform_publisher" name="baselink_broadcaster" args="0 0 0 0 0 0 1 $(arg frame) /crazyflie/base_link 100" />

  </group>

  <!-- run rviz -->
  <param name="robot_description" command="$(find xacro)/xacro.py $(find crazyflie_description)/urdf/crazyflie.urdf.xacro" />
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(find crazyflie_demo)/launch/crazyflie_pos.rviz" required="true" />

</launch>
lkyfly0765 commented 5 years ago

I cannot confirm where the error comes from. I will check my launch file and give you a reply a few hours later, I am out now. It seems that your view_frame pdf file is now same as mine. And I will check it at noon.

Best Regard, Eric Liu

On Mar 21, 2019, at 7:58 AM, Shumpei Wakabayashi notifications@github.com wrote:

Hi, Eric,

I changed as you said, but cannot connect 'world' and 'crazyflie1'. Looking at tf view_frame, there are still two 'crazyflie1'. Did you change other program?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

lkyfly0765 commented 5 years ago

Hi, I have check the frames.pdf and I send it in the attachment. It seems that your connection between world and crazyflie1 has someting wrong. Please check: 1.You have already run the vrpn client using roslaunch ros-vrpn-client sample.launch server:xxx.xxx.xxx.xxx:3883

  1. In the hover_vrpn.launch file, line 4 and line 5 ,the IP and the port has been correctly configured. In line 7,the crazyflies's uri has been correctly configured.

  2. The firewall both on your conputer and the Optitrack server computer has been shutdown completely.

  3. In the Optitrack Motive, at the data streaming board, you have change the axis to Z-up.

That's all I can infer.

At 2019-03-21 07:58:52, "Shumpei Wakabayashi" notifications@github.com wrote:

Hi, Eric,

I changed as you said, but cannot connect 'world' and 'crazyflie1'. Looking at tf view_frame, there are still two 'crazyflie1'. Did you change other program?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

shmpwk commented 5 years ago

Thank you very much for super thorough explaining!

I chacked 1 by 1, and found all things correct. So, the cause of the problem is not what you told me.

Actually, I use Cortex as the motion capture system. It can also use VRPN connection. So now I'll chack its program carefully again.