gsilano / CrazyS

CrazyS is an extension of the ROS package RotorS, aimed to modeling, developing and integrating the Crazyflie 2.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to develop on CrazyS such that the code is 1-to-1 with hardware code?

acxz opened this issue · comments

Thanks for making this amazing simulator!

Since I am developing code on the hardware crazyflie I would like to be able write the same controller code for this simulator and the hardware. What is the recommended approach to do this?

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

Hi @acxz!! I don't know if I understand your question correctly. However, if you aim to control the nano-quadrotor using a ROS node, such as crazyflie_ros, there is no need to change anything in your control architecture other than the unit measurements interface. I mean, if you see, in crazyflie_ros the thrust force is expressed as INT16 number, while in CrazyS the thrust is a force (Newton).

Therefore, I suggest that you start reading the reference publications, and then the crazyflie_ros documentation. This way, you can get a clearer idea of how the systems work, and where changes need to be applied (if there are changes to be made).

Thanks for pointing me to crazyflie_ros and the publications!

Is there anyway to add a control mode which replicates the unit measurement interface in this codebase? This would be nice, since I could use this simulator to verify my hardware code to a greater degree.

I did not understand what you mean. Anyway, reading the papers I have indicated, you will immediately understand how to build this interface for your purposes.

Sorry for getting back so late @gsilano
Okay after some reading and discussing with @mouhyemen, I think I figured what needs to be done.

For achieving 1-to-1 hardware code compatibility with CrazyS, CrazyS should subscribe to messages on the /cmd_vel topic See: https://github.com/whoenig/crazyflie_ros#cmd_vel
This will allow code that is written for crazyflie-ros (hardware code) to also be used with CrazyS (simulation code).

From what I understand right now, CrazyS only subscribes to /crazyflie2/command/motor_speed. Would it be possible to add the ability to subscribe to /cmd_vel with the topic information as linked above from crazyflie_ros from this repo as well?

GitHub
ROS Driver for Bitcraze Crazyflie. Contribute to whoenig/crazyflie_ros development by creating an account on GitHub.

HI @acxz!! The CrazyS interface is slightly different from the crazyflie_ros package provided by Whoening. I mean, the platform is designed to test, in a very high-level stage, algorithms performed in a MIL (Model-in-the-loop) scenario, e.g., MATLAB/Simulink. Hence, it aims to help students and researchers who would like to test their algorithms in an environment as close to the real world as possible.

I can perfectly understand that you would like to have a 1-to-1 simulator, using the same ROS package you will employ during the real-experiment, but so far CrazyS has not implemented such interface. It would be nice and also useful for the whole community if you could help in organizing such an environment. If you think it might be useful, we could organize a call to describe the details.

Unfortunately, this period is very stressful for me. I'm finishing my doctorate and preparing for the next stage. I hope you can understand.

I do have a couple of thoughts on how to create this interface. Basically create some logic, which I believe you have already done in your roll-pitch-yawrate-thrust-controller, that converts roll-pitch-yawrate-thrust commands from the same message type of /cmd_vel that crazyflie_ros uses into CrazyS's /motor_speeds. I can make a very naive implementation of this as a separate ROS package, but would be unsure how to merge this interface properly with CrazyS. For now, I'll just create this simple interface and then we can see how this feature can be part of CrazyS directly. I propose we keep this issue open until I create this naive interface implementation. Thx for your advice.

I'm finishing my doctorate and preparing for the next stage

Good luck!

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@acxz, any updates? are you working or are you going to work on this? Otherwise, I will close the issue. Of course, we can reopen it if necessary.

Sadly I don't have updates, lets keep it closed for now, until someone expresses interest again.