GithubHelp home page GithubHelp logo

libcflie's People

Contributors

aholler avatar boaz001 avatar fairlight1337 avatar fredsa avatar kaiqin avatar lkdo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libcflie's Issues

A question about the log variable type

Hello:

First very appreciate that you created such an excellent lib and it indeed help me alot. Because I am not recieve my Crazyflies yet, so I cannot test your lib so far. I skim through your code and found you default the type of variable log is double wthen you get the log message from the Crazyflie.

double dValue;

But I looked back to the firmware of Crazyflies and found the variables in log may have different types.

https://github.com/bitcraze/crazyflie-firmware/blob/376a1de0dbadf300411c25a04c6f15341259ea43/src/modules/interface/log.h#L51

I am wondering if I want to recieve an another type variable's log (such as LOG_INT8 ), your code will work currently or not, and what I should do? After I got my Cf 2.0, I will test as well.

Jason

Implicit conversion: sleep(0.5) evaluates to sleep(0u)

In your replugging example, you call sleep(0.5) on line 68.
You pass a double literal, but sleep takes an unsigned int.

The implicit conversion taking place from double to unsigned int passed 0 to sleep.
This is probably not the intended behavior.

Compiling against using makefile

Hi,

I'm trying to link against the library but I'm having some trouble during compilation with a makefile. I believe the issue is that its not link the libusb-1.0 library since I get the following error:

//usr/local/lib/libcflie.a(CCrazyRadio.cpp.o): In function CCrazyRadio::CCrazyRadio(std::string)': CCrazyRadio.cpp:(.text+0x87): undefined reference tolibusb_init'

My makefile is as followed:

CC = g++
CFLAGS = -Wall -g

all: simple

simple: simple.o
${CC} ${CFLAGS} simple.o -lusb-1.0 -lcflie -o simple

simple.o: simple.cpp CCrazyflie.h
${CC} ${CFLAGS} -c simple.cpp

clean:
rm simple.o simple

To point something out I have moved libcflie.a file to /usr/local/lib. Can someone give a had solving this issue??

Receive Messages

I'm currently installing NuttX instead of FreeRTOS on the Crazyflie. Therefore, I fully erased the STM32 and flashed NuttX on it. At the moment I'm writing a communication app. I don't want to use the Crazyflie protocoll since I plan to integrate it with some external system (motion capture). Therefore I plan to just send and receive messages (without the logging stuff).
I managed to change your library, such that it sends the messages I want. However I didn't find out yet on how to look for messages that are sent by the Crazyflie. Do you have some function for that? Or is this just implemented over the logging system?

Thank you for the great work with this library

Namespace pollution: header hygiene

All your API headers pollute my namespace by

using namespace std;

Please fix this in the API headers at least.
I do not want nor need the std namespace pollution.

thrust command not working

Hi,

1st of all great job with the library!

I have been trying to use your library but I can't seem to get the ex-gui example to work properly. When I run ex-gui it connects fine to to the crazyflie and I can see the gui animation move according to the movement of the crazyflie. However, no thrust command are send to crazyflie.

I think its an issue with the new crazyflie firmware that needs to send a thrust = 0 command to unlock the motors. I tried this and it didn't seem to work. Wondering if you have the same issue

libusb-1.0 Ubuntu 16.04

Hi,
i followed "How to build the library from source" and everything was fine. No cmake warnings, no build errors. The examples in /bin worked. But in my IDE (CodeBlocks), "undefined reference" errors were thrown. I had to link "/usr/lib/x86_64-linux-gnu/libusb-1.0.so" manually in the IDE to make it work. Maybe something went wrong in cmake.
I hope this may help someone one day :)

Ubuntu 16.04.1
GCC 5.4
cmake 3.5.1

setThrust is work or not?

Hello
I am newbie in crazyflie2.
I built your code in windows and it works in mainly.
But I have a trouble with setting thrust from program. I do the next

int main(int argc, char **argv) {
    CCrazyRadio crRadio("radio://0/80/250K");
    if(crRadio.startRadio())
    {
        CCrazyflie cflieCopter(&crRadio);
        cflieCopter.setThrust(10001);
        cflieCopter.setSendSetpoints(true);
        for (int i=0;cflieCopter.cycle()&&i<100; ++i)
        {
            std::cout << cflieCopter.yaw() << " " << cflieCopter.pitch() << " " << cflieCopter.roll() << " " << cflieCopter.thrust() << " " << cflieCopter.batteryLevel()<< std::endl;
            std::this_thread::sleep_for(std::chrono::milliseconds(10));
            // Range: 10001 - (approx.) 60000
            cflieCopter.setThrust(10001+i*20);
        }
    } else {
        std::cerr << "Could not connect to dongle. Did you plug it in?" << std::endl;
    }
}

I get

Opening radio 0/80/250K
Got device version 0.83
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
Registered logging block `stabilizer'
Registered logging block `gyroscope'
Registered logging block `accelerometer'
Registered logging block `battery'
Registered logging block `magnetometer'
Registered logging block `altimeter'
0 0 0 0 0
-2.03507 0.462907 0.134263 0 3.73724
-2.03507 0.462907 0.134263 0 3.73724
-2.03507 0.462907 0.134263 0 3.73724
...
-1.9969 0.464878 0.142745 0 3.74252
libusb: warning [winusbx_submit_control_transfer] ControlTransfer failed: [87] The parameter is incorrect.
libusb: warning [winusbx_submit_control_transfer] ControlTransfer failed: [87] The parameter is incorrect.
libusb: warning [winusbx_submit_control_transfer] ControlTransfer failed: [87] The parameter is incorrect.
libusb: warning [winusbx_submit_control_transfer] ControlTransfer failed: [87] The parameter is incorrect.
libusb: warning [winusbx_submit_control_transfer] ControlTransfer failed: [87] The parameter is incorrect.
libusb: warning [winusbx_submit_control_transfer] ControlTransfer failed: [87] The parameter is incorrect.
libusb: warning [winusbx_submit_control_transfer] ControlTransfer failed: [87] The parameter is incorrect.
libusb: warning [winusbx_submit_control_transfer] ControlTransfer failed: [87] The parameter is incorrect.
libusb: warning [winusbx_submit_control_transfer] ControlTransfer failed: [87] The parameter is incorrect.

I am not able to set thrust and engines are not work.
Could you advice me, whatI do incorrectly?

currentTime() returns in seconds? or milliseconds?

Hi. First of all, thank you for your great work!

I have an issue with timing. CCrazyfile::currentTime() apparently returns the current time in milliseconds.

  double CCrazyflie::currentTime() {
         struct timeval tv;
         gettimeofday(&tv, NULL);  
        return (tv.tv_sec) * 1000 + (tv.tv_usec) / 1000;
  }

In CCrazyflie::cycle(), the current time is compared to a threshold:

  // Check if it's time to send the setpoint
  if(dTimeNow - m_dSetpointLastSent > m_dSendSetpointPeriod) {... 

But the threshold is apparently defined in seconds, so this comparison does make no sense.

  m_dSendSetpointPeriod = 0.01; // Seconds

currentTime() should return in seconds, right?

  double CCrazyflie::currentTime() {
      struct timeval tv;
      gettimeofday(&tv, NULL);  
      return (tv.tv_sec) + (tv.tv_usec) / 1000000.0;
    }

Yaw setter Radians vs. Degrees

Hi,

First, nice work with the library ;).

I think there may be a problem with the yaw setter. I have tested the code and it seems that setting yaw does nothing noticeable (the craziflie does not turn).

Based on the code:

 if(m_fYaw < 0) {
    m_fYaw += 2 * M_PI - m_fYaw;
  }

It seems radians are used instead of degrees. Also m_fMaxYaw is set to 2*M_PI in the constructor. I think, this should use degrees like the other setters (pitch, roll).
According to what I've seen on the bitcraze wiki, yaw is actually yaw_rate (angle/s) so it can also be negative (turn to the left). I think it would be better not to perform this operation m_fYaw += 2 * M_PI - m_fYaw; and instead use the same principle as for yaw and roll, i.e. :

if(fabs(m_fPitch) > m_fMaxAbsPitch) {
    m_fPitch = copysign(m_fMaxAbsPitch, m_fPitch);
  }

so my suggestion is:

void CCrazyflie::setYaw(float fYaw) {
  m_fYaw = fYaw;

  if(fabs(m_fYaw) > m_fMaxYaw){
      m_fYaw = copysign(m_fMaxYaw, m_fYaw);
  }

where
m_fMaxYaw = 180.0f;

I hope this helps. Thanks again for the great library.
Adrian

Receiving more IMU data per second

Hi there,

while using the library, I wondered that I get the IMU data at only 10 Hz. In contrast, the python library received data at 100 Hz. My inspections give that the m_lstLoggingPackets from CCrazyRadio.cpp filled with new data only at 60 Hz (10 Hz for one sensor e.g. accelerometer).
Is it possible that this deals with the use of synchronous functions of libusb? Or does someone have a solution to accelerate the receive of sensor data?

Thank you very much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.