HULKs / hulk

All your base are belong to us!
https://hulks.de/hulk
GNU General Public License v3.0
49 stars 49 forks source link

Failed to initialize cameras when starting the framework #692

Closed MarceloRother closed 8 months ago

MarceloRother commented 8 months ago

I am having problems whit the codebase execution. I use the command "./pepsi build --target nao" and "./pepsi upload " for compile and upload the codebase to NAO. I can compile correctly but i can't run the executable, neither press the button nor via ssh. The terminal returns the message: Error: 0: failed to open framework parameters 1: No such file or directory (os error 2)

Location: crates/hulk_nao/src/main.rs:57

I am using your Robocup 2023 codebase with all dependencies, and your OS (5.9.0). I work in a virtual machine with Ubuntu 23.10 and cargo 1.75.0.

h3ndrk commented 8 months ago

Thanks for your report!

Which version do you mean exactly with "Robocup 2023 codebase"? Could you post the output of git rev-parse HEAD? Is it a recent version on our main branch? If not, please try to use the latest commit on the main branch (this is known to work).

./pepsi upload ... should also run through without errors.

Our executable is usually started by SystemD as a service. We have a handy alias called hulk.

Could you post the output of hulk status?

In addition, could you look into /home/nao/hulk/logs/hulk.out and /home/nao/hulk/logs/hulk.err. Are there any additional errors?

Do you see files in /home/nao/hulk/etc/parameters that match the files in your repository on your Ubuntu machine in etc/parameters?

MarceloRother commented 8 months ago

Hi Hendrik. Thanks for the answer!

I used the lasted commit (e3a1070), the lasted OS (5.9.1), and using the commands by pepsi, but the error continues. The file /home/nao/hulk/logs/hulk.out is empty, but the /home/nao/hulk/logs/hulk.err has the message:

Error: 0: failed to create hardware interface 1: failed to initialize top camera 2: failed to reset 3: failed to reset camera device 4: timeout while waiting for camera connect

Location: crates/hulk_nao/src/camera.rs:107

In additional to this file, has more two ".err" with this same message I saw the files in the parameters folders and they are same.

schmidma commented 8 months ago

Can you check whether you see the camera devices /dev/video-top and /dev/video-bottom ? I never encountered this error before, but it seems the framework is unable to connect to the camera after resetting it.

When we initialize the hardware interface for the nao, we also initialize the cameras: https://github.com/HULKs/hulk/blob/e3a10709ccb852b6e03ec9674aba2aae38881f35/crates/hulk_nao/src/hardware_interface.rs#L91 During this initialization the camera is also reset (https://github.com/HULKs/hulk/blob/e3a10709ccb852b6e03ec9674aba2aae38881f35/crates/hulk_nao/src/camera.rs#L45 and https://github.com/HULKs/hulk/blob/e3a10709ccb852b6e03ec9674aba2aae38881f35/crates/hulk_nao/src/camera.rs#L104)

This reset is done via I2C and restarts the camera device. We do this kind of reset to ensure a working and clean state of the camera before accessing and configuring it. It seems the camera device is missing after this reset: https://github.com/HULKs/hulk/blob/e3a10709ccb852b6e03ec9674aba2aae38881f35/crates/nao_camera/src/reset.rs#L95

Please also check whether the devices are visible without ever starting the framework after booting the robot. Just to ensure, our reset is not messing with the devices in the first place.

MarceloRother commented 8 months ago

I can find /dev/video-bottom but i can't find /dev/video-top. Should I be able to do something with video-bottom?

I found all the code parts that you mentioned. It is all corrects.

schmidma commented 8 months ago

If the top camera device is not present, this may also hint a hardware defect. Is other software (not our framework/image) able to interface with the camera?

MarceloRother commented 8 months ago

As far as I know, no Is there anyway to verify this? The only thing present in the robot before flashing hulks-OS is the 2.8.5 robocupper image

schmidma commented 8 months ago

You can try flashing the robocupper image and check there. After flashing, SSH into the robot and check for the available camera devices. We also observed hardware disconnects of the camera on the front board in the NAOs head. You may also check for that.

MarceloRother commented 8 months ago

I tried flashing only the robocupper image and another aldebaran images for NAO. I did not find video-top device. I tried acess the camera through Choreographe and it returns: "Could not start video. Could not subscribe to the ALVideoDevice". So how likely is it to be a hardware error? Is there any other way to test?

schmidma commented 8 months ago

It seems your only option is to visually check for hardware defects by opening the head cover. As mentioned in my previous comment, disconnected top cameras is not a rare thing. Alternatively, you may send it to the manufacturer for repair.

I am closing this issue, as this is no longer a framework issue. Feel free to reopen or open a new issue, if you encounter any further issues or problems.