Question with fly with vrpn system

Discussions and questions about the Crazyflie Nano Quadcopter
Post Reply
gpczygpczy
Beginner
Posts: 2
Joined: Tue Jan 12, 2021 11:00 am

Question with fly with vrpn system

Post by gpczygpczy »

Hello,everyone! I am a recruit to crazyflie.I fly the crazyflie under the motion capture,it neither vicon nor optical tracker, but it uses the vrpn agreemnet,can I use the hover_vrpn.launch file to let the crazyflie hover?
whoenig
Expert
Posts: 346
Joined: Mon Oct 27, 2014 2:55 am

Re: Question with fly with vrpn system

Post by whoenig »

Yes, that is possible. You can also you use the Crazyswarm with VRPN.
gpczygpczy
Beginner
Posts: 2
Joined: Tue Jan 12, 2021 11:00 am

Re: Question with fly with vrpn system

Post by gpczygpczy »

Thank you for your replay!
After several attempt(I'm following the Hoenig_Springer_ROS2017.pdf),when I press the XBbox360 controller to take off,it can start and always straight up but can't hover.I can't find the problem :( :( .
My launch file is like this

Code: Select all

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

  <arg name="uri" default="radio://0/80/2M/E7E7E7E705" />
  <arg name="frame" default="cf1" />
  <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="True" />
    </include>

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

    <include file="$(find crazyflie_demo)/launch/xbox360.launch">
    </include>

    <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>

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

    <!-- 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>
  </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>
When I run the launch file,input in the terminal is "roslaunch crazyflie_demo hover_vrpn.launch frame:= MCServer ",MCServer is the name of my motion capture.
whoenig
Expert
Posts: 346
Joined: Mon Oct 27, 2014 2:55 am

Re: Question with fly with vrpn system

Post by whoenig »

A frequent problem is that your VRPN coordinate system does not match the ROS coordinate system. Without flying, move your Crazyflie around while visualizing (e.g., using `rostopic echo` or `rviz`) the current coordinate system. Make sure that positive-z is indeed the upwards motion.
Post Reply