micro-ROS / micro-ROS_crazyflie_demo

Provides a demo of micro-ROS based on a Crazyflie.
Apache License 2.0
18 stars 6 forks source link

firmware update question #17

Closed chaos4ros2 closed 2 years ago

chaos4ros2 commented 3 years ago

Issue template

Steps to reproduce the issue

I'm trying to run the micro-ros demo with crazyflie2.1

  1. Run the docker compose and build with

    docker-compose run --rm cf_builder
    ros2 run micro_ros_setup configure_firmware.sh crazyflie_demo 
    ros2 run micro_ros_setup build_firmware.sh

    Screenshot from 2021-08-26 07-05-48

  2. Put Crazyflie in DFU mode and check with

    lsusb

    The terminal outside the container is in DFU mode but the terminal inside container is in BOOTLOADER mode like these

Screenshot from 2021-08-26 06-44-43

  1. I can only flash the firmware inside the container so flash the micro-ROS firmware with
    ros2 run micro_ros_setup flash_firmware.sh

Expected behavior

micro-ROS firmware is flashed successfully and Connect to Crazyflie successfully.

Actual behavior

Messages showed in terminal loos okay but when I connected to Crazyflie with cfclient (after docker-compose up -d), Crazyflie turned into 「Self test fail」(The right front LED (1) is repeatedly blinking five short red pulses with a longer pause between groups.) Screenshot from 2021-08-26 07-06-53

Additional information

Is there something wrong and how can I check everything is ok?

pablogs9 commented 3 years ago

Can you share the output of the micro-ROS Agent with -v6 flag enabled?

chaos4ros2 commented 3 years ago

I'm not confident that this way of doing is good. based on this issue I typed

sudo docker exec -it micro-ros_crazyflie_demo_cf_agent_1 /bin/bash
ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/pts/checked_number -v6

and in another terminal

sudo docker exec -it micro-ros_crazyflie_demo_cf_client_1 /bin/bash
cfclient

here is the output Screenshot from 2021-08-27 01-10-43

Everytime I pushed scan button, crazyflie rebooted and turned into「Self test fail」state.

chaos4ros2 commented 3 years ago

I feel like I understood a little.

I tried and confirmed the following:

  1. Can't put Crazyflie 2.1 in recovery bootloader mode like this video. => There seems to be a problem with bootloader.

  2. Bin bootloader recovery follow the tutorial. You can see the bootloader uses address 0x08000000. bootloader_github

  3. BIN file DFU flashing. The firmware uses address 0x08004000. firmware_github

  4. I flashed the micro-ROS fireware into address 0x08000000 that is prepared for bootloader. micro-ros

So overflash may be the problem and here is my question: How can I flash the micro-ROS firmware with DFU mode in a docker container or flash it to a specified address.

Acuadros95 commented 3 years ago

Hi @chaos4ros2,

I don't think thats the problem, as specified on this link: If the Crazyflie 2.X firmware was compiled with CLOAD=1 (default option) the binary should be flashed after the bootloader at address 0x08004000.

But we are building with CLOAD=0: link.

I think the problem may be related to the interaction between the demo and the agent. I am currently working on this, will come back with updates.

Anyway, you can change the address by modifying this line: https://github.com/micro-ROS/micro_ros_setup/blob/galactic/config/freertos/crazyflie21/flash.sh#L5

chaos4ros2 commented 3 years ago

Hi @Acuadros95,

I don't think thats the problem, as specified on this link: If the Crazyflie 2.X firmware was compiled with CLOAD=1 (default option) the binary should be flashed after the bootloader at address 0x08004000. But we are building with CLOAD=0: link.

I have learned a lot from you. Thank you very much.

I think the problem may be related to the interaction between the demo and the agent. I am currently working on this, will come back with updates.

This will be very helpful for me! I am waiting for you to come back.

Anyway, you can change the address by modifying this line: https://github.com/micro-ROS/micro_ros_setup/blob/galactic/config/freertos/crazyflie21/flash.sh#L5

I learn something new again, thanks for teaching me the way to modify address. Because I don't have any experience with embedded system, I am going to try it after testing your updates.

Acuadros95 commented 2 years ago

Hello @chaos4ros2,

We just made a big update on this demo, please update your repos/dockers and give it a try. Feel free to ask any questions and give feedback.

chaos4ros2 commented 2 years ago

Hello Acuadros95,

I am trying your update and getting stuck in How to prepare the Raspberry Pi applications?

I got a error like blow when I typed

sudo docker run -ti --rm microros/base:galactic

error:

chaos@chaos:~/ros2/drone_ws/micro-ROS_crazyflie_demo$ sudo docker run -ti --rm microros/base:galactic
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
standard_init_linux.go:228: exec user process caused: exec format error
chaos4ros2 commented 2 years ago

Sorry to bother you again. I have another question about how to control drone with only one Crazyradio PA.

I found that two channels are used in crazyflie's firmware. One for publishing sensor data and the other one for commanding crazyflie with a controller. The tutorial says it is just need one Crazyradio PA, but is it possible to use two channels with one Crazyradio PA?

Acuadros95 commented 2 years ago

I am trying your update and getting stuck in How to prepare the Raspberry Pi applications?

This tutorial is intended to cross-compile the applications from a regular computer, and I guess you are running the docker inside the raspberry.

I found that two channels are used in crazyflie's firmware.

Yes, the crazyflie demo is a very specific use case, where two different Crazyradios are used. If you want to test micro-ROS, I advise you to try the position publisher example instead.

You can use micro-ROS and command the crazyflie with a controller using only one crazyflie with that example. You can also just run the demo and just connect to the main task.

chaos4ros2 commented 2 years ago

I ran two demos and confirm the results.

Tf datas are correctly plotted in rviz2 in crazyflie_demo sample and /drone/attitude(odometry) are correctly sended by drone in crazyflie_position_publisher sample. And I can command the crazyflie with a controller at the same time !

crazyflie_demo's result :

crazyflie

crazyflie_position_publisher's result :

victory

Thanks for the amazing demo and answer. It motivates me to study ROS2 and use micro-ROS. I am going to master micro-ROS via these demos.

I also created a PR to fix the node.js vision problem during set up cf_visualizer container.