0
$\begingroup$

We are working on Crazyflie 2.1 to implement our controller by utilizing ROS2. We used the following repository on GitHub to make it possible.

crazyflie experimental

We'd like to access /cmdVel topic to send the related control inputs (i.e., roll, pitch, yawrate, thrust) to Crazyflie. However, when we start Crazyflie, we could not see the /cmdVel topic (we assumed this is a default topic for Crazyflie). I added the topic list below. How could we fix it, let us now if you have any useful explanation for this situation, thanks.

ntukenmez3@ae-icps-407120:~/Documents/2023-crazy-flie-1/crazyflie_ros2_experimental/crazyflie_ros2_implementation$ ros2 topic list 
/cmd_vel
/odom
/parameter_events
/rosout
/scan
/tf
/zrange
$\endgroup$
2
  • 1
    $\begingroup$ Just to make it easier for people to follow your support question: 1- Post which package source you are using so it is readable for other people that are not the maintainer. 2- Add labels to your question like UAV or such. 3- And make it more generic such that people that don't know the crazyflie can still help out. You can add those improvements now already to your answer. $\endgroup$ Oct 31, 2023 at 8:37
  • $\begingroup$ I'll edit my question, thanks. $\endgroup$ Oct 31, 2023 at 16:54

1 Answer 1

1
$\begingroup$

So I'm the creator of this package crazyflie_ros2_experimental so I'll try to help out. It is an experimental github ROS package that is no longer maintained (), but I'll try to help out if you want to get it to work.

So the topic is called /cmd_vel . cmd_vel is a more commonly used topics for velocity reference commands in the form of twist commands. Here you can see the callback for that. This controls the crazyflie's velocity in x,y,z and control its heading by yaw. That is more or less the 'standard' use of cmd_vel with twist within the ROS community.

Just some background history about why /cmdVel has been used for attitude commands in some packages. So the notion that /cmdVel means: roll/pitch/yaw to the crazyflie, has its origins at the original Crazyflie ROS package (see the callback here). This eventually made its way to the Crazyswarm project but for crazyswarm2 this will be deprecated as it is not the norm anymore within ROS anymore.

So you want to send roll,pitch,yaw commands to the Crazyflie instead that will be difficult as that does not exist in this package. So you will need to make your own subscription, call it something else ('/ctr_att') or something else. Reuse the Twist message or use a different one. And make your own callback function that uses this crazyflie python api function:

crazyflie.commander.send_setpoint(roll, pitch, yawrate, thrust)

Again a disclaimer, the crazyflie-ros2-experimental package is not maintained and if you'd like to use this functionality, look at the Crazyswarm2 project which is more actively maintained and supported and ask for help there.

$\endgroup$
9
  • $\begingroup$ Well, thank you for your helpful and precious comments. $\endgroup$ Oct 31, 2023 at 17:00
  • $\begingroup$ Firstly, my question was about generic /cmd_vel as in self.cmdVelPublisher = rospy.Publisher(prefix + "/cmd_vel", geometry_msgs.msg.Twist, queue_size=1). You can check the related topic from this website (crazyswarm github). I had hoped that it could be available in your repository as a default topic. $\endgroup$ Oct 31, 2023 at 17:07
  • 1
    $\begingroup$ About cmdVel in crazyflie_ros/crazyswarm2, I was just explaining a bit of history of why this package used /cmdVel for pitchrollyaw even though that isn't the standard in the ROS community (which is cmd_vel for velocity commands) to give some context. This comment of mine is not really for support but more for context of the question :) $\endgroup$ Nov 1, 2023 at 7:03
  • 1
    $\begingroup$ about /cmd_vel being a default topic in the crazyflie-ros2-experimental repository, it is already implemented but it is currently only responding to velocity commands. This temporary project was unrelated to crazyswarm2 and fully separated, and there for the project I rather wanted to do it more the 'standard' ROS way. Unfortunately I do not have ambition too implement a special topic for rollpitchyaw since this project is over already and I no longer will maintain it. $\endgroup$ Nov 1, 2023 at 7:06
  • 1
    $\begingroup$ That said, you are completely free to fork the repository and change it to your own liking, like indeed, changing the cmd_vel callback function to send attitude setpoints instead of velocity setpoints to the crazyflie. That is all within your own power :) $\endgroup$ Nov 1, 2023 at 7:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.