Raw accelerometer data from Crazyflie_ROS

Firmware/software/electronics/mechanics
Post Reply
DougC
Beginner
Posts: 3
Joined: Tue Jul 25, 2017 9:32 pm

Raw accelerometer data from Crazyflie_ROS

Post by DougC »

Hi guys,

I'm trying to develop an off-board controller for the Crazyflie 2.0 that uses the linear acceleration of the quad as a measurement. I'm using the crazyflie_ROS package and successfully echoing the /crazyflie/imu msg. Thing is, the part of the message called "LinearAcceleration" seems to be giving me the angular rates and ''AngularVelocity" returns the orientation of the quad in Euler angles. I was wondering if there was any way to access the raw accelerometer data without any firmware hacks.. Any help would be appreciated!

Thanks,

Doug
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Raw accelerometer data from Crazyflie_ROS

Post by arnaud »

The ROS driver allows to setup log blocks and publish them as topic. You can log the accelerometer log variables that way. You can see an example of the logging in our LPS launch files: https://github.com/bitcraze/lps-ros/blo ... ch#L14-L18. You can find the available log variables (the accelerometer is in already) using the Crazyflie client.
DougC
Beginner
Posts: 3
Joined: Tue Jul 25, 2017 9:32 pm

Re: Raw accelerometer data from Crazyflie_ROS

Post by DougC »

Thanks for the reply! I'll look into it.
DougC
Beginner
Posts: 3
Joined: Tue Jul 25, 2017 9:32 pm

Re: Raw accelerometer data from Crazyflie_ROS

Post by DougC »

A small update:

So I've been tinkering around with your suggestion, and I believe one of my problems is I've been using a different version of the ROS driver. I decided to use the version found at https://github.com/whoenig/crazyflie_ros. Now when I echo \crazyflie\imu I do get the raw values of the gyro and accelerometer. I then decided to play around with logging other data from the crazyflie. Below I've tried to replicate the example you offered but in an effort to read the orientation from the stabilizer log variables. My crazyflie_add.launch looks like this:

Code: Select all

<?xml version="1.0"?>

<launch>
  <arg name="uri" default="radio://0/40/2M" />
  <arg name="tf_prefix" default="" />
  <arg name="roll_trim" default="0" />
  <arg name="pitch_trim" default="0" />
  <arg name="enable_logging" default="True" />
  <arg name="use_ros_time" default="True" />
  <arg name="enable_logging_imu" default="True" />
  <arg name="enable_logging_temperature" default="True" />
  <arg name="enable_logging_magnetic_field" default="True" />
  <arg name="enable_logging_pressure" default="True" />
  <arg name="enable_logging_battery" default="True" />
  <arg name="enable_logging_packets" default="True" />





  <node pkg="crazyflie_driver" type="crazyflie_add" name="crazyflie_add" output="screen">
    <param name="uri" value="$(arg uri)" />
    <param name="tf_prefix" value="$(arg tf_prefix)" />
    <param name="roll_trim" value="$(arg roll_trim)" />
    <param name="pitch_trim" value="$(arg pitch_trim)" />
    <param name="enable_logging" value="$(arg enable_logging)" />
    <param name="use_ros_time" value="$(arg use_ros_time)" />
    <param name="enable_logging_imu" value="$(arg enable_logging_imu)" />
    <param name="enable_logging_temperature" value="$(arg enable_logging_temperature)" />
    <param name="enable_logging_magnetic_field" value="$(arg enable_logging_magnetic_field)" />
    <param name="enable_logging_pressure" value="$(arg enable_logging_pressure)" />
    <param name="enable_logging_battery" value="$(arg enable_logging_battery)" />
    <param name="enable_logging_packets" value="$(arg enable_logging_packets)"/>

    <rosparam>
      genericLogTopics: ["log_euler"]
      genericLogTopicFrequencies: [10]
      genericLogTopic_log_euler_Variables: ["stabilizer.roll", "stabilizer.pitch", "stabilizer.yaw"]
    </rosparam>



  </node>
</launch>
now when I run the driver, the "log_euler" topic appears, but when I try to echo it I receive the following error message:

Code: Select all

cdoug@L5816-06:~/catkin_ws/src/crazyflie_demo/launch$ rostopic echo /crazyflie/

/crazyflie/battery            /crazyflie/imu                /crazyflie/magnetic_field     /crazyflie/rssi               
/crazyflie/cmd_vel            /crazyflie/joy                /crazyflie/packets            /crazyflie/temperature      
/crazyflie/external_position  /crazyflie/log_euler          /crazyflie/pressure           

cdoug@L5816-06:~/catkin_ws/src/crazyflie_ros-master/crazyflie_demo/launch$ rostopic echo /crazyflie/log_euler 

ERROR: Cannot load message class for [crazyflie_driver/GenericLogData]. Are your messages built?
Have I missed a step or two? Forgive my novice level of competence, I've been bashing my head against this for a few hours and can't seem to work it out.
whoenig
Expert
Posts: 395
Joined: Mon Oct 27, 2014 2:55 am

Re: Raw accelerometer data from Crazyflie_ROS

Post by whoenig »

You need to load the custom message definitions. Try

Code: Select all

source ~/catkin_ws/devel/setup.bash
before your execute the rostopic echo command.
ElizabethMireles
Beginner
Posts: 1
Joined: Tue Nov 07, 2017 9:04 am
Location: USA
Contact:

Re: Raw accelerometer data from Crazyflie_ROS

Post by ElizabethMireles »

This is a good idea to develop and build such a device! Good luck with your creation!
Post Reply