Git Product home page Git Product logo

crazyswarm2's Introduction

ROS 2

Crazyswarm2

A ROS 2-based stack for Bitcraze Crazyflie multirotor robots.

The documentation is available here: https://imrclab.github.io/crazyswarm2/.

Troubleshooting

Please start a Discussion for...

  • Getting Crazyswarm2 to work with your hardware setup.
  • Advice on how to use it to achieve your goals.
  • Rough ideas for a new feature.

Please open an Issue if you believe that fixing your problem will involve a change in the Crazyswarm2 source code, rather than your own configuration files. For example...

  • Bug reports.
  • New feature proposals with details.

crazyswarm2's People

Contributors

acxz avatar akmaralaw avatar allegorywrite avatar ataffanel avatar ben-jarvis avatar hanzheteng avatar hurisa avatar jpreiss avatar julienthevenoz avatar khaledwahba1994 avatar knmcguire avatar llanesc avatar matthewoots avatar mauropfister avatar mjdebord avatar nanncai avatar p10010 avatar penghuanggp avatar phanfeld avatar schlagenhauf avatar sprtkd avatar stefandz avatar the-ss avatar whoenig avatar zeroos avatar zhenghao-dai avatar zjwilliams20 avatar zmk5 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  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  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

crazyswarm2's Issues

add documentation infrastructure

We want to generate docs automatically from the docs folder. Similar to Crazyswarm1, but hosted on github (rather than readthedocs).

teleop: cmd_vel_world: lower velocity when close to boundary

When hitting the limit of the workspace ({x,y,z}_limit in the config file), we clip/clamp the position part, but still have a large velocity part. High-gain controllers therefore exceed the limits easily, which can cause crashes.

Instead of using the joystick values for the velocity (

fullstate_.twist.linear.x = twist_.linear.x;
fullstate_.twist.linear.y = twist_.linear.y;
fullstate_.twist.linear.z = twist_.linear.z;
), we should use the adjusted velocity. The adjusted velocity is (previous_position - clipped_position)/dt. Note that this adjusted velocity can be zero if we are already at the boundary and at most the value requested by the joystick (due to the computation of the clipped position using a forward single integrator computation).

To test, one should a) not be able to exceed the boundary, b) when moving with full speed towards the boundary, the UAV should slow down automatically when getting close to the boundary.

Installation documentation

I'm new to crazyswarm2 and went through the crazyswarm installation documentation.
On the fourth step in first installation, py_crazyswarm2 can't be found. I suspect it's crazyflie_py.

Hybrid Motion Capture Tracking

Currently we only support that all CFs use a single marker, or all of them use multiple markers.

Desired:

  • Short term: add an error if the user configures a hybrid tracking mode that is currently not supported
  • Implement support for this hybrid tracking mode (this needs changes in librigidbodytracker).

battery check in chooser.py sometimes hangs

Since there is currently no timeout, chooser.py simply hangs. This can happen if a drone is turned off, but also when everything else (e.g., reboot) works as expected. Need to investigate the cause of this intermediate failure.

Naming for topics/services that affect all Crazyflies

Currently, we use "/takeoff" to takeoff a single specific crazyflie and "/takeoff" to takeoff all robots. The naming is a bit confusing. Ideas:

  1. Use "/all/takeoff". Pros: short, easy to understand. Cons: Seems to not integrate well with other packages (pollutes the global namespace)
  2. Use "/all_cfs/takeoff". Pros: still short and easy to understand. Cons: Still some pollution.
  3. Move everything to be part of "crazyflie_server", e.g., "/crazyflie_server//takeoff" and "/crazyflie_server/all/takeoff". Pros: No name pollution. Clear indication which package offers this service. Cons: Very verbose. For many users the existence of the "server" might not even be relevant.

Any thoughts @knmcguire ?

Improve the parameter handling in the python server

In #59 I found out that it is possible to access parameters without declaring it with node._parameters. Now this has been implemented to setup the logging, but PR #52 I didn't use this feature.

So I should have another look at _init_parameters and initialize the parameters from node._parameters and not get_parameter_or function I used in there

server (cflib): error default topics dynamic adding

There is an bug in the adding of a default logging in the CFLIB backend of the crazyflie server.

How to recreate:

  1. No default topic initialized in crazyflies.yaml
  2. Use the add_logging service: ros2 service call /cf2/remove_logging crazyflie_interfaces/srv/RemoveLogging "{topic_name: 'pose'}"
  3. observe the following error in the server:
"/home/knmcguire/development/collaborations/crazyswarm2/ros2_ws/install/crazyflie/lib/crazyflie/crazyflie_server.py", line 831, in _add_logging
[crazyflie_server.py-4]     self.swarm._cfs[uri].logging[topic_name + "_log_config"].start()
[crazyflie_server.py-4]   File "/home/knmcguire/development/bitcraze/python/crazyflie-lib-python/cflib/crazyflie/log.py", line 294, in start
[crazyflie_server.py-4]     if (self.cf.link is not None):
[crazyflie_server.py-4] AttributeError: 'NoneType' object has no attribute 'link'

This does not happen if that default logging was enabled from the start, and if you remove and add the logging again. Also the custom logging does not have this problem, so something is going wrong with the initialization of the default topics/logging if it is only preparing for possible future enablement.

Easily switchable crazyflie server back end

The idea is to merge the crazyflie_server_py with the crazyflie package and make the backend of the server selectable by the launch file. Like this:

Default (cpp)

ros2 launch crazyflie launch.py
ros2 run crazyflie_examples hello_world

cflib backend(python)

ros2 launch crazyflie launch.py backend:='cflib'
ros2 run crazyflie_examples hello_world

We should also make a motioncapture argument as well

Teleop: add higher-level manual flight

Currently, teleoperation only supports low-level flight, where a user controls roll, pitch, yawrate, and thrust. It would be nice to have a mode where a user controls the position (+velocity) setpoint instead. Ideally, one can also specify a "safe bounding box", so that it is impossible to crash the quadrotor.

implement simple mapper node

In the experimental github repo, I made a simple mapper node for the crazyflie as an replacement of the slam toolbox, https://github.com/knmcguire/crazyflie_ros2_experimental. That worked actually much better for the multiranger.

Eventhough we have a slamtoolbox tutorial, maybe we can consider adding the simple mapper to this repo anyway?

Some improvements need to be added to it though:

  • Make sure that it is able to handle the same inputs as the slam toolbox (as it didn't before), so it is easy to switch
  • Perhaps look at this work how to make the map even better. This blogpost of 2 years ago made some improvements to the original point cloud code Marcus made so perhaps we can use that as well (with proper citing ofcourse)

crazyswarm build on windows

Honored to present the first issue to this repo :)

surprise surprise... the windows build of crazyswarm doesn't work right from the start.

This is the error I'm getting:

Starting >>> crazyswarm2_interfaces
--- stderr: crazyswarm2
CMake Error at C:/Program Files/CMake/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: Boost_INCLUDE_DIR program_options)

This seems to be an limitation of Cmake in windows, so currently investigating what the right approach is here.

dots or slashes for parameters

In PR #52 we had a discussion about dots or slashes for parameters so here a ticket for that. The question was what the convention is in ROS2 for parameters as we get mixed messages from these docs and prs

  • dots like in namespace.param.subparam
  • slashes like in namespace/param/subparam

I've asked a question on https://answers.ros.org/question/404895/parameters-ros2-convention-dots-or-slashes/. The first person seems to think those are dots too but the links he is providing are not super clear either:

Anyway, let's hope somebody from the ROS design team answers soon.

Webots simulation node

Now that the Crazyflie is in the latest version of Webots, it will be easier to start creating a ros2 node for the model and the python bindings.

There are some things to be solved:

  • Update the crazyflie-firmware to latest release and fix the cffirmware build
  • Figure out what to do with the parameters/logging (since that is not binded)
  • Implement to go, land, takeoff first (maybe first as setpoint commander and then with highlevel commander?)
  • Implement trajectory following.

Colcon Build on Linux Failing due to PCL configuration file not existent

Hello Hoenig,
i am trying to build the crazyswarm 2 and it gives the following output:

[1.021s] WARNING:colcon.colcon_core.verb:Some selected packages are already built in one or more underlay workspaces:
'crazyswarm2_interfaces' is in: /home/sebastian/ros2_ws/install/crazyswarm2_interfaces
'motion_capture_tracking_interfaces' is in: /home/sebastian/ros2_ws/install/motion_capture_tracking_interfaces
'motion_capture_tracking' is in: /home/sebastian/ros2_ws/install/motion_capture_tracking
If a package in a merged underlay workspace is overridden and it installs headers, then all packages in the overlay must sort their include directories by workspace order. Failure to do so may result in build failures or undefined behavior at run time.
If the overridden package is used by another package in any underlay, then the overriding package in the overlay must be API and ABI compatible or undefined behavior at run time may occur.

If you understand the risks and want to override a package anyways, add the following to the command line:
--allow-overriding crazyswarm2_interfaces motion_capture_tracking motion_capture_tracking_interfaces

This may be promoted to an error in a future release of colcon-core.
Starting >>> crazyswarm2_interfaces
Starting >>> motion_capture_tracking_interfaces
Finished <<< motion_capture_tracking_interfaces [0.70s]
Starting >>> motion_capture_tracking
Finished <<< crazyswarm2_interfaces [1.19s]
Starting >>> py_crazyswarm2
Starting >>> crazyswarm2
--- stderr: motion_capture_tracking
CMake Error at CMakeLists.txt:16 (find_package):
By not providing "FindPCL.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "PCL", but
CMake did not find one.

Could not find a package configuration file provided by "PCL" with any of
the following names:

PCLConfig.cmake
pcl-config.cmake

Add the installation prefix of "PCL" to CMAKE_PREFIX_PATH or set "PCL_DIR"
to a directory containing one of the above files. If "PCL" provides a
separate development package or SDK, be sure it has been installed.


Failed <<< motion_capture_tracking [2.60s, exited with code 1]
Aborted <<< py_crazyswarm2 [2.59s]
Aborted <<< crazyswarm2 [24.5s]

Summary: 2 packages finished [26.7s]
1 package failed: motion_capture_tracking
2 packages aborted: crazyswarm2 py_crazyswarm2
3 packages had stderr output: crazyswarm2 motion_capture_tracking py_crazyswarm2
1 package not processed

Any idea, what could fix that ?

Fix symlink issue in crazyflie_examples

Currently, if anybody changes anything in crazyflie_examples's launch file, config files or data files, they will need to reinstall with colcon build which is annoying.

Currently I've added a warning to the text in #86, but there are other things we can do:

  • Convert the entire package to cmake. I tried to do this with python files only but was unsuccessful
  • Hope that colcon/colcon-core#407 gets resolved at one point

Anyway, this issue will also warn crazyswarm2 users that this is still a problem.

Running console on windows

Hi! lets start a new thread about the console now that the build is solved.

I tried to run the following in ROS2 in windows 10.

ros2 run crazyswarm2 console --uri radio://0/70/2M/E7E7E7E703

but the program immediately closes, and /rosout is not detecting any activity. I've tried this on both libusb-win and winUSB libraries on zadig for the crazyradio.

crazyflie_server python cflib edition

So I want to contribute a cflib backend crazyflie server node, not to replace the ccp version but to give the users more flexibility to choose which one.

Crazyflie server for 1 CF

  • For simple teleoperation (take off, land, react on hover/twist messages)
  • Implement logging from yaml file
  • Implement parameters from yaml file

Crazyflie group server for more

  • For simple teleoperation (take off, land, react on hover/twist messages)
  • Implement logging from yaml file
  • Implement parameters from yaml file

I'll update this list soon, as I want do some read-up first and look through the current server and crazyswarm1 in more detail. But at just for reference that it is in the pipeline and that I connect the PRs to this grander issue/ticket

integrate chooser.py to communicate with crazyswarm_server

Currently, chooser.py is independent and writes the crazyflies.yaml config file. This can result in very unintuitive behavior and error messages. Ideally, chooser.py (or any GUI) would simply connect to the crazyswarm_server instead. This also means that the server needs to be able to reconnect after reboot.

/cmd_vel for hover

Hi!

Just something that I would like to ask. I noticed that the twist messages in the topic /cmd_vel are actually used for roll pitch yaw thrust control, while in other platforms this is used for body fixed velocity control.

Wouldn't it be more logical to use this topic for the send hover commands instead? Than it will be consistent with other ROS packages

Maximum of 5 crazyflies taking-off

Hello, I try to fly a swarm of 10 crazyflies but there is an issue while flying more than 5 of them.
If I want to fly 6, the first one won't take off. For 7 of them, the first two won't take off.
You can see that in this video :
https://user-images.githubusercontent.com/71951031/199629172-635c6006-e618-41fb-90ff-cb7fe7ef3197.mp4

Where do you think the problem comes from?
I tried on 1 or 2 crazyradios and the same thing happened, Moreover, I had to reduce the Vicon rate to 50Hz because, at 100Hz, all the crazyflies were crashing at takeoff, but this will be an issue for later.

I am using Crazyswarm2 on ROS2 galactic on Ubuntu 20.04 with a Vicon system, and single marker configuration.
Thank you

Implement trajectory upload and start on the cflib backend

So, there are still some matters that needs to be implemented first in the cflib in order to make it work properly for handling trajectory uploads similar to what the crazyswarm2 format supports: bitcraze/crazyflie-lib-python#361. It will be a bit messy otherwise...

I'm currently making this issue as this looks like it will need a bit more time, unlike what I claimed in PR #70 and there are other features that I'd like to implement first.

Additional installation instructions or updates

This is just a list for now of things that are still missing upon a clean install:

I'll update this list once I come across more so you can keep it open for now.

Parameter handling for the py server

hi!

I've been trying to figure out how to overwrite the parameters in rclpy based on the yaml file created in this launch file

It seems that this is being handled in cpp by this line in the crazyflie cpp server:

// load crazyflies from params
auto node_parameters_iface = this->get_node_parameters_interface();
const std::map<std::string, rclcpp::ParameterValue> &parameter_overrides =
node_parameters_iface->get_parameter_overrides();

Unfortunately, the same functions seemed not to be opened up for rclpy, at least to my knowledge.

What would be a good thing to handle this?
1- Make an cpp node that makes this parameter file into global variables
2- Read out the yaml files directly in the python node and retrieve the names and set the parameters in there.
3- Someway to get this to properly work in python (perhaps I haven't looked carefully or used the wrong search terms for it)

Current install instructions give error

Hi!

I was blessed by having reinstalling my Ubuntu 20.04 WSL today due to my own python screwup😣and to make the most of this blessing I've started to reinstall crazyswarm2 on a completely clean system. I noticed that the installation instructions don't work as expected as I get this:

Starting >>> crazyflie_interfaces
Starting >>> motion_capture_tracking_interfaces
Starting >>> crazyflie_server_py
Finished <<< motion_capture_tracking_interfaces [0.95s]
Starting >>> motion_capture_tracking
Finished <<< crazyflie_server_py [2.48s]
Finished <<< crazyflie_interfaces [2.83s]
Starting >>> crazyflie_py
Starting >>> crazyflie
Finished <<< crazyflie_py [2.61s]
Starting >>> crazyflie_examples
Finished <<< crazyflie_examples [2.53s]
--- stderr: crazyflie
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find libusb (missing: LIBUSB_LIBRARY LIBUSB_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  deps/crazyflie_tools/crazyflie_cpp/crazyflie-link-cpp/tools/build/Findlibusb.cmake:153 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  deps/crazyflie_tools/crazyflie_cpp/crazyflie-link-cpp/CMakeLists.txt:49 (find_package)


---
Failed   <<< crazyflie [5.89s, exited with code 1]
Aborted  <<< motion_capture_tracking [32.0s]

Summary: 5 packages finished [34.0s]
  1 package failed: crazyflie
  1 package aborted: motion_capture_tracking

Simple solution was to install the libraries given in the crazyflie_tools readme, but probably best to point to that in the doc instructions as well as it might not be as apparent to those who first start out.

Send out transform with pose topic in server_py

If a user enables the pose logging in the yaml file, the python crazyflie server node should send out an transform of that pose. This is handy for:

  • rivz visualization
  • linking to other packages

Handling of Integer/Double Values in the param subsystem

There are several issues:

1.) When specifying a firmware parameter in the yaml file as an int, the parameter is not updated and no error is reported. Desired behavior: a) Proper error reporting; b) usage of the known param type (i.e., even a float param can be updated using an int).

2.) When running ros2 param set crazyswarm2_server cf3/params/ctrlMel/kp_xy 2 an error is thrown, since 2 is not a floating point value. Expected behavior: still be able to set the (float) param from an integer value.

Example SLAM toolbox and NAV2

I want to provide an SLAM toolbox and NAV2 example for Crazyswarm, to fully convert what I've done here (https://github.com/knmcguire/crazyflie_ros2_experimental) to this repo.

3 major things that needs to be done for this:

  • There are some additional default topics that need to be added to the cflib backend of crazyswarm, like odometry and scan values from the flowdeck and multiranger.
  • We need to provide a way to give hover commands. /cmd_vel is out for now perhaps but maybe like /cmd_hover
  • Write a tutorial on how to setup such an setup

Consolidate configuration in a single configuration file

From a user perspective, it would be easier to have the configuration in a single config-file, rather than in 5+ files. One downside is that the logic in the launch file likely needs to split up the config file for the various nodes.

Rename packages to crazyflie to reflect that we do not only support swarms

Rationale: Make the packages easier to find and indicate in the name that we support any number of Crazyflies, not only swarms. The name of the repository/stack will remain "crazyswarm2".

Options: "crazyflie_ros2" or "ros2_crazyflie"? There seems to be no real consensus on naming for ROS packages. Then we would have:

"ros2_crazyflie" <- launch files etc.
"ros2_crazyflie_interfaces" <- interfaces
"ros2_crazyflie_py" <- Python bindings to run the high-level scripts

"ros2_crazyflie_server_cpp" <- current server
"ros2_crazyflie_server_py" <- your cflib server
"ros2_crazyflie_sim_py" <- simulation translation module (same interface as server, but uses a visualizer/simulator as backend such as WeBots).

Add support for cmd_vel teleoperation

In Crazyswarm(1), no teleoperation (control using a joystick) was ever implemented. Now that Crazyflie_ros is deprecated, this feature should be part of Crazyswarm2.

Steps:

  1. Update the teleop node to publish cmd_vel (feature to be enabled using a parameter). Examples are https://github.com/whoenig/crazyflie_ros/blob/master/crazyflie_demo/src/quadrotor_teleop.cpp and https://github.com/ethz-asl/rotors_simulator/blob/master/rotors_joy_interface/src/joy.cpp
  2. Update the crazyswarm_server to subscribe to cmd_vel and to send the appropriate command to the Crazyflie, see https://github.com/whoenig/crazyflie_ros/blob/df3ce76f700953cfa2794b8fd4628ea6b93c92c4/crazyflie_driver/src/crazyflie_server.cpp#L310-L322

decouple motion capture tracking package

Currently when crazyswarm2 has to be installed from scratch, the motion capture tracking package is mandatory due to this:


CMake Error at CMakeLists.txt:17 (find_package):
...
  Could not find a package configuration file provided by
  "motion_capture_tracking_interfaces" with any of the following names:

    motion_capture_tracking_interfacesConfig.cmake
    motion_capture_tracking_interfaces-config.cmake

Shouldn't this be an option based on what people are using as a positioning system? Perhaps also in the combination of what I mentioned in #67 ?

Not an urgency now but a point of discussion in the future :)

Enabling building in 22.04 with ROS2 humble

Currently we advise Ubuntu 20.04 with ROS2 galactic. The problem is that Galactic will be unsupported from November 2022, so only in a months time.

I've tried on my 22.04 dual boot to install humble and to colcon build crazyswarm and the motion capture library. Not successfull yet:

  • pybind 11 (both motion_capture_tracking and crazyswarm2) python3_add_library does not seem to exist anymore for the latest version of cmake
  • crazyflie_server.cpp: declare_parameter() fails if no initial parameter is given in cpp (even with override set to on)
  • libmotioncapture gave a lot of build issues that probably has something to do with the version of gcc used for the build.

Long story short, no time to fix this this month due to travel, but it would be good to make Crazyswarm2 suitable for Humble and ubuntu 22.04 sooner rather than later...

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.