gsilano / CrazyS

CrazyS is an extension of the ROS package RotorS, aimed to modeling, developing and integrating the Crazyflie 2.0
Apache License 2.0
160 stars 84 forks source link

Question regarding publishing motor speed to Gazebo & some theoretical parameters #101

Closed wonggwan closed 1 year ago

wonggwan commented 1 year ago

Hi,

Thanks for the great repo! As I sent the email a few days ago that probably was not clear enough to state my question, I am sending all the related issues I have using this repo over here:)

My setup

I am using Ubuntu 20.04 with ROS Noetic and Gazebo 11 version and have already managed to setup & install all the things now

Issue 1: publishing motor speed to Gazebo via rostopic

After I managed to show the CrazyS robot in Gazebo, I was trying to control the drone via Python script by publishing the corresponding motor speed to the ROS topic.

My questions are as follows for the first issue:

float64[] angular_velocities # Angular velocities of the actuator in [rad/s].
                             # E.g. "rpm" of rotors, propellers, thrusters 

But I think the motor speed has a different unit rpm compared to the angular velocity of the actuator rad/s, how do we specify this when we publish our motor speed to Gazebo?

Issue 2: question regarding some coefficient & parameter setting to calculate the system dynamics of the CrazyS

My questions are as follows for the second issue:

image

Does the parameter match the physical configuration of the drone being used in Gazebo?

  <xacro:property name="mass" value="0.025" /> <!-- [kg] -->
  <xacro:property name="mass_rotor" value="0.0005" /> <!-- [kg] -->

which means the total mass will be 0.025 + 4*0.0005 = 0.027 kg.

Thank you so much!

welcome[bot] commented 1 year ago

Thanks for opening your first issue here! Make sure that no other issues on the same topic have already been opened!

dingthe4th commented 1 year ago

Hi! Think of my 'answers' with a grain of salt, I am no expert regarding this repo. I am just someone who used this repo recently as well.

For Issue 1, you publish the motor speed to /crazyflie/command/motor_speed. I used the Matlab version of this repo, so I am not entirely sure how to publish via script, but in Matlab, /crazyflie/command/motor_speed needs input from mav_msgs/Actuators and Propellers Angular Velocities (4) from Omegas (motor speed), see Fig. 11 (p.22) of the documentation that you refer to. As for the units, I already forgot but I think it's in the docu as well.

As for Issue 2, I think it's correct as maybe the ones showed in Gazebo is rounded-up to 0.XX significant digits? Not entirely sure.

If you wait for a bit, your issues maybe resolved by the author of this repo, good luck!

wonggwan commented 1 year ago

Update for Issue 1 regarding the motor speed:

I found that the /CrazyS/src/CrazyFlie/rotors_control/src/nodes/roll_pitch_yawrate_thrust_crazyflie_node.cpp is also publishing some sort of motor speed commands to gazebo apart from the /crazyflie2/command/motor_speed one, what should we do about this? E.g. does these two node interfere each other during simulation in gazebo?

wonggwan commented 1 year ago

Hi! Think of my 'answers' with a grain of salt, I am no expert regarding this repo. I am just someone who used this repo recently as well.

For Issue 1, you publish the motor speed to /crazyflie/command/motor_speed. I used the Matlab version of this repo, so I am not entirely sure how to publish via script, but in Matlab, /crazyflie/command/motor_speed needs input from mav_msgs/Actuators and Propellers Angular Velocities (4) from Omegas (motor speed), see Fig. 11 (p.22) of the documentation that you refer to. As for the units, I already forgot but I think it's in the docu as well.

As for Issue 2, I think it's correct as maybe the ones showed in Gazebo is rounded-up to 0.XX significant digits? Not entirely sure.

If you wait for a bit, your issues maybe resolved by the author of this repo, good luck!

Hi! Thanks for the help!

For Issue 1, now I also agree with you that we should publish the motor speed to the /crazyflie2/command/motor_speed, but as my comments above mentioned, there is one more node named as /CrazyS/src/CrazyFlie/rotors_control/src/nodes/roll_pitch_yawrate_thrust_crazyflie_node.cpp that is also publishing something towards the same topic, so I am not sure how is this affect my result.

As for Issue 2, since the drone is too light-weighted (roughly 30 grams), so any small change in the value will result in a very huge change in the calculation result. Since I am trying to use pure math calculation to 'simulate' how the drone fly, so I think the numbers will be crucial to the result.

gsilano commented 1 year ago

Hi wonggwan! Glad to hear from you that you found my work helpful. Here are my answers:

I hope this helps. If not, let me know.

wonggwan commented 1 year ago

Hi wonggwan! Glad to hear from you that you found my work helpful. Here are my answers:

  • Motor speeds are expressed in radians per second [rad/s]. If you want to control the drone, without using the provided controller, just run roslaunch rotors_gazebo crazyflie2_without_controller.launch. Then, your code should publish on the /crazyflie2/gazebo/command/motor_speed topic.
  • ROS Messages are defined in the mav_msgs repository. Specifically, here you can find the definition of Actuators. You can find the maximum angular velocity in the the crazyflie2_base.xacro and crazyflie2_forster.xacro files. Since I have never tested the simulator with the Crazyflie, comparing the behaviors, I suggest you find your own parameters or rely on those in Forster's thesis.

I hope this helps. If not, let me know.

Thank you so much for your help! I think that solves my current problem! Closing this issue now:)