cmd_vel in crazyflie_controller_bridge.py

All discussions related to the Loco Positioning system
Post Reply
aramos
Beginner
Posts: 6
Joined: Tue Feb 12, 2019 10:27 am

cmd_vel in crazyflie_controller_bridge.py

Post by aramos » Tue Feb 12, 2019 1:16 pm

Hello,

My name is Agustín Ramos and I am a researcher at the University of Seville (Spain) in the group of Robotics, Vision and Control. Since a month ago we are testing the Loco Positioning System with 6 nodes in TWR mode and with one cf2. We are using ROS Kinetic, Ubuntu 16.04 and the drivers lps-ros and crazyflie_ros to do autonomous missions, following these instructions: https://wiki.bitcraze.io/doc:lps:ros.

Analyzing the code, specifically in lps-ros/scripts/crazyflie_controller_bridge.py, I do not understand why in (x, y) you subscribe in goal and publish in cmd_vel directly, without a coordenates transformation between the target world and the target drone: https://github.com/bitcraze/lps-ros/blo ... py#L79-L80. I think it has no sense. I have been looking for in the code but I can not find where changes the targets. I realized that whoenig in https://github.com/whoenig/crazyflie_ro ... pp#L75-L76 does something similar with a external PID controlller, but that has more sense because in this case there is a transform drone - world.

Another question related to the previous is about how and where the crazyflie-firmware receives this cmd_vel published in crazyflie_controller_bridge.py to do the internal PID controller in https://github.com/bitcraze/crazyflie-f ... ller_pid.c. I assume that, although crazyflie_controller_bridge.py publishes in cmd_vel, this script uses the PIDs in position_controller_pid.c to fly (viewtopic.php?f=16&t=2474&p=12516&hilit), but I can not find how the crazyflie_firmware takes the cmd_vel topic to do the PID control.

All these doubts are because our purpose is to do autonomous missions using ROS, commanding waypoints in velocity and using the internal PID controller of the firmware, but first of all we need to understand the code we are using to improve the flight tuning the PIDs.

Thank you in advanced.
Best regards,
Agustín.

whoenig
Expert
Posts: 307
Joined: Mon Oct 27, 2014 2:55 am

Re: cmd_vel in crazyflie_controller_bridge.py

Post by whoenig » Wed Feb 13, 2019 5:52 pm

For new setups I think it is best to use the TDoA 3 mode. Then, you shouldn't need lps-ros at all. Instead, all the sensor fusion/state estimation is done on-board the CFs EKF. You can use crazyflie_ros or the crazyswarm with the PID or mellinger controller for velocity control.

The controller in crazyflie_ros is essentially deprecated. I keep it around for people to see how to implement an external position controller, but the firmware now has two decent position controllers to choose from built-in, and the performance of the on-board controller is far superior to the simple controller in crazyflie_ros.

There are different control modes in the firmware, that map to different ROS topics. You can find them in https://github.com/bitcraze/crazyflie-f ... _generic.c. If you tell me what kind of setpoint you want to send, I can tell you the appropriate ros topic (if it does exist already).

Good luck!

aramos
Beginner
Posts: 6
Joined: Tue Feb 12, 2019 10:27 am

Re: cmd_vel in crazyflie_controller_bridge.py

Post by aramos » Wed Feb 20, 2019 3:12 pm

Thank you for your answer!!

We are already flying two cf2 in mode TDoA2 with 8 anchors (the guide recommends to use this mode for 8 anchors). Now, we're using the crazyflie_controller_bridge.py with more accuracy than ever. At the moment, we're sending position setpoints to the topic cmd_vel, but we would also like to command in velocity, instead of commanding position.

From the link you told me about, I understand I have to use velocityWorldType but I don't know how.

I would appreciate some guidances about this.

Thank you in advanced.

whoenig
Expert
Posts: 307
Joined: Mon Oct 27, 2014 2:55 am

Re: cmd_vel in crazyflie_controller_bridge.py

Post by whoenig » Wed Feb 20, 2019 5:42 pm

Unfortunately, this particular one is not in crazyflie_cpp, yet. I added an issue for it https://github.com/whoenig/crazyflie_cpp/issues/8. Once it is there, I can also add it to crazyflie_ros using a new ROS topic.

aramos
Beginner
Posts: 6
Joined: Tue Feb 12, 2019 10:27 am

Re: cmd_vel in crazyflie_controller_bridge.py

Post by aramos » Thu Feb 21, 2019 5:05 pm

Ok, thank you.

We remain attentive for new changes. It would be very beneficial for our research.

According to the crazyradio, we are trying to fly 3 cf2 using 1 cr. However, one of them never takes off. We have tried to add a second cr but do not get it to work properly.Although both cr are plugged in, when make a scan (with the python library or with the package crazyflie_tools) only one channel (//0/80/250k) is detected. I understand that a new channel should be assigned for a the new cr, but do not know the way to do it.

From the blog I have read that the first number of the channel should correspond with the n-th cr plugged. Hence, I expected to see a //1/... once connected the second cr. We have also tried to configure that parameter from cfclient - configure 2.0 once connected to the cf2 but does not seem to be configurable. It must be certainly a trivial issue I cannot get to figure it out.

Thank you so much in advance!

whoenig
Expert
Posts: 307
Joined: Mon Oct 27, 2014 2:55 am

Re: cmd_vel in crazyflie_controller_bridge.py

Post by whoenig » Thu Feb 21, 2019 9:07 pm

Are you assigning unique addresses to each of the CFs? To (re)configure it is best to connect the CF over USB, especially if you change radio related parameters. Section 5.1 in [1] might also help you. The scan tools only use a single radio for the scanning. You can assign a radio, just by changing the URI (i.e., if you use //0/80/250k the first radio will connect to the CF using channel 80, if you use //1/80/250k, the second radio will connect to the CF using channel 80). If you want to use different channels, you have to change the channel of the CF. It should be fine to have 3 CFs on a single radio, though.

[1] W. Hönig and N. Ayanian. "Flying Multiple UAVs Using ROS", Chapter in Robot Operating System (ROS): The Complete Reference (Volume 2), Springer, 2017.
Pre-print at http://act.usc.edu/publications/Hoenig_ ... OS2017.pdf

Post Reply