eFiniLan / xnxpilot

Openpilot on Jetson Xavier NX
MIT License
131 stars 64 forks source link

how to run this in my Jetson Xavier NX? #4

Closed colinzhaoxp closed 2 years ago

colinzhaoxp commented 2 years ago

hello, thanks for you great work!

now, followed your readme.md, I have dragonpilot installed on your jetson.

but I don't know how to run it like your video that don't need a real car.

could you help me?

thanks a lot.

RyanC1681 commented 2 years ago

I tried to run *.sh, but it got errors as below: How to fix it? Thanks, root@tici:~/openpilot# bash ./launch_env.sh root@tici:~/openpilot# bash ./launch_openpilot.sh ./launch_openpilot.sh: /root/openpilot/launch_chffrplus.sh: /usr/bin/bash: bad interpreter: No such file or directory ./launch_openpilot.sh: line 10: /root/openpilot/launch_chffrplus.sh: Successroot@tici:~/openpilot# bash ./launch_env.sh root@tici:~/openpilot# bash ./launch_openpilot.sh ./launch_openpilot.sh: /root/openpilot/launch_chffrplus.sh: /usr/bin/bash: bad interpreter: No such file or directory ./launch_openpilot.sh: line 10: /root/openpilot/launch_chffrplus.sh: Success ./spinner: line 12: /root/openpilot/selfdrive/ui/qt/spinner: Permission denied ./spinner: line 12: exec: /root/openpilot/selfdrive/ui/qt/spinner: cannot execute: Permission denied ./launch_chffrplus.sh: line 7: /data/openpilot/launch_env.sh: No such file or directory Traceback (most recent call last): File "/root/openpilot/selfdrive/boardd/set_time.py", line 5, in import usb1 ModuleNotFoundError: No module named 'usb1' NVPM WARN: patching tpc_pg_mask: (0x1:0x4) NVPM WARN: patched tpc_pg_mask: 0x4 no server running on /tmp/tmux-0/default unclutter: someone created a sub-window to my sub-window! giving up Traceback (most recent call last): File "./build.py", line 11, in from common.basedir import BASEDIR File "/root/openpilot/common/basedir.py", line 4, in from selfdrive.hardware import PC File "/root/openpilot/selfdrive/hardware/init.py", line 6, in from selfdrive.hardware.tici.hardware import Tici File "/root/openpilot/selfdrive/hardware/tici/hardware.py", line 2, in from functools import cached_property ImportError: cannot import name 'cached_property'

1 error generated. scons: *** [selfdrive/camerad/cameras/camera_mipi.o] Error 1 scons: building terminated because of errors. scons build failed selfdrive/camerad/cameras/camera_mipi.cc:9:10: fatal error: 'opencv2/core.hpp' file not found ./text: line 12: /root/openpilot/selfdrive/ui/qt/text: Permission denied ./text: line 12: exec: /root/openpilot/selfdrive/ui/qt/text: cannot execute: Permission denied xnxpilot

eFiniLan commented 2 years ago

looks like your environment is not set up correctly, it's easier if you use the env_installer script.

RyanC1681 commented 2 years ago

Hi, Do you have docker or sd card image with xnxpilot? Thanks,

RyanC1681 commented 2 years ago

Thanks for the info. It works after re-install. White or red panda which one works better than black panda? Will off-shelf ODB2 scanner also works for less cost? How to connect CAN from NX to car or panda will convert CAN to USB? Thanks,

RyanC1681 commented 2 years ago

Sorry for one more question. I tried to test camera preview with IMX219. It popped up GUS messages with frame rate, but it didn't shown any camera preview on the screen. Do I have to use CSI to HDMI Extension Module to get camera output? Thanks,

eFiniLan commented 2 years ago

Hi @RyanC1681 ,

  1. Unfortunately I don't know how to create SD image or docker, I read the doc and it seems too much trouble.
  2. red panda is best if your car uses CAN-FD (can't tell if it will work with this project), I'd suggest you start with black panda + car harness.
  3. Off-Shelf OBD2 scanner won't work because it needs to be able to intercept / forward certain CAN messages, if cost is your concern, I'd highly suggest you buy panda clones from aliexpress.
  4. comma.ai releases a couple of hardware for different car brand so you can intercept CAN messages in between the ADAS camera and the CAN gateway, they no longer sell the one (named giraffe) that work with white panda, so unless you know how to connect it, I'd suggest you get the black panda + car harness. https://github.com/commaai/neo/ repo has some of their old hardware design/PCB schematics.
  5. I tried IMX219 before and it should be fine, perhaps you can share some screenshots about the "GUS messages"?

cheers,

colinzhaoxp commented 2 years ago

@RyanC1681 Hello, Do you have sd card image with xnxpilot?

It doesn't works after re-install,but I don't know how to solve it.

65155c5bb6837e5c828bc87637fc045

Thanks!

colinzhaoxp commented 2 years ago

Hello, everyone, after reinstalling the software many times. Now I finally successfully launched the program, but I still encountered a problem (shown in the picture), I guess the possible reason is because I did not use IMX477, but used a USB camera. 1a9170ff9a88dd6fdecc21ff3a37e07

colinzhaoxp commented 2 years ago

In other words, I did not perform the operations in the picture。 image

eFiniLan commented 2 years ago

Hello, everyone, after reinstalling the software many times. Now I finally successfully launched the program, but I still encountered a problem (shown in the picture), I guess the possible reason is because I did not use IMX477, but used a USB camera. 1a9170ff9a88dd6fdecc21ff3a37e07

  • may I use a USB camera to achieve Is the feature in your first video?
  • If it can be achieved, do you have any suggestions? thank you very much!

Hi @colinzhaoxp,

it's either:

  1. your opencv is not installed
  2. opencv is installed but in the wrong directory.

you can do a: find / -name opencv2 to the correct directory then modify /data/openpilot/selfdrive/camerad/SConscript/ around line 22 and add your own path.

I've tried IMX219 and the problem is that the lens has a small FoV (I think) and causes lots of calibration issues.

cheers,

RyanC1681 commented 2 years ago

I got different error as attach image. Any idea? Thanks E350285F-6197-4DB1-997D-61B7C24FAC4C

eFiniLan commented 2 years ago

I got different error as attach image. Any idea? Thanks E350285F-6197-4DB1-997D-61B7C24FAC4C

Hi @RyanC1681 ,

It could be one of the file is corrupted when compile, try to do a clean compile again with these commands:

git clean -xdf
scons --clean 

cheers,

colinzhaoxp commented 2 years ago

@eFiniLan Thank you very much for your suggestion, I will try it right away.

Thank you for your selfless sharing and precious suggestions.

cheers,

RyanC1681 commented 2 years ago

@eFiniLan Thanks for the info. I tried git clean -x -d -f scones or clang --clean // is not correct option But I still got same error on 64G U1 sd card I also installed on 32G class 10 sd card, it work but show errors in panda or camera preview with dual imx219. Should I install openpilot under /root or /data seems most of missing files point to /data/openpilot.
Thanks for helps ![Uploading 93A3A4CA-C155-4D0D-B162-1B87190C7722.jpeg…] F12010AA-8F38-4326-AA48-195B3E03A7BD 8A357711-88F0-4FBC-8A77-9D2BA29FD24A 2FD9428E-BA71-42D5-A342-2EB884239554

eFiniLan commented 2 years ago

@eFiniLan Thanks for the info. I tried git clean -x -d -f scones or clang --clean // is not correct option But I still got same error on 64G U1 sd card I also installed on 32G class 10 sd card, it work but show errors in panda or camera preview with dual imx219. Should I install openpilot under /root or /data seems most of missing files point to /data/openpilot. Thanks for helps ![Uploading 93A3A4CA-C155-4D0D-B162-1B87190C7722.jpeg…] F12010AA-8F38-4326-AA48-195B3E03A7BD 8A357711-88F0-4FBC-8A77-9D2BA29FD24A 2FD9428E-BA71-42D5-A342-2EB884239554

Hi @RyanC1681,

a few places in the code checks if you are on a PC (anything not comma two or comma three) or not, I tried to minimize changes so jetson will be identified as "NOT PC" in those places.

so I highly recommended you to move your $HOME/openpilot/ to /data/, you can take a look at the env_installer.sh as it should do this for you too. :)

RyanC1681 commented 2 years ago

@eFiniLan I copy files to home/data/openpilot then it can launch openpilot after power on. How to test drive or camera? When I clicked camera preview then it shown camera start then app exit. I put dual imx219 on NX. Thanks

eFiniLan commented 2 years ago

@RyanC1681 that camera preview is for the front camera (Driver-view) so I don't think it will work. xnxpilot has disabled every driver-view related code (same as stock op but more).

if you have everything wired properly you should have it running when your car started.

colinzhaoxp commented 2 years ago

@eFiniLan hi, I think I ignore a important thing: if can I use only one IMX477 camera to realize the functions in the video? Because I find that you seem use two IMX477 cameras in you demo video.

Thanks!

dragonpilot commented 2 years ago

@eFiniLan hi, I think I ignore a important thing: if can I use only one IMX477 camera to realize the functions in the video? Because I find that you seem use two IMX477 cameras in you demo video.

Thanks!

Hi @colinzhaoxp sorry for the late reply, the demo was showing 2 imx477 but in fact, only 1 camera is used. The reason why I bought that stereo camera device is that it came with an IMU sensor, but I didn't manage to get it working.

so yeah... with the xnxpilot code, it only needs 1 camera. (you can check camera_mipi.cc, only 1 camera is used.)

eFiniLan commented 2 years ago

Hi Peter,

try: echo -n 0 > /data/params/d/dp_last_modified

cheers,

Rick

On Tue, 18 Jan 2022, 18:17 peter50107, @.***> wrote:

@eFiniLan https://github.com/eFiniLan I try to open xnxpilot on jeson nx ,but aways show crash info and error log like this [image: image] https://user-images.githubusercontent.com/16420408/149896783-5630604a-0760-4a5d-bd23-5ecfe4e34f3e.png I only change the manager/manager.py [image: image] https://user-images.githubusercontent.com/16420408/149897138-de584135-98df-45fb-90c2-2b232d9c0e38.png I don't have ant idea for this case ...... Could you give some tips?

Thanks!

— Reply to this email directly, view it on GitHub https://github.com/eFiniLan/xnxpilot/issues/4#issuecomment-1015168020, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD6VPGKFMHGXRT7R2YVH2NTUWUOZRANCNFSM5JGJMWQA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

peter50107 commented 2 years ago

@eFiniLan Thank a lot.It can work But I have different error msg . such like this image In my env ,I don't connet to the car . Just for test nx + black_panda. I think that error is system not get reader msg,right ?
And the other thing. I want to use this 'Logi Webcam C920e' webcam . What I need setup? I guess I need setup /data/openpilot/selfdrive/camerad/cameras/camera_frame_stream.cc image but click on ui-> device-> driver camera-> preview , It always stay "canera starting ", Is missed to set up something? image

Thanks again

eFiniLan commented 2 years ago

Hey @peter50107,

Weird that you are getting those messages 😄 , it should have a default value set to those config files, anyway, lets try this:

chmod -R 777 /data/params/*
echo -n "en-US" > /data/params/d/dp_locale
  1. is to make sure /data/params/d/ has write/read permission to every user.
  2. is the actual fix, put "en-US" into dp_locale config file.

as for your camera issue, you should use camera_webcam (I dont think it's included in xnxpilot). You can download it from the openpilot repo: https://github.com/commaai/openpilot/tree/master/selfdrive/camerad/cameras make sure you download both camera_webcam.cc and camera_webcam.h

cheers,

Rick

peter50107 commented 2 years ago

@eFiniLan

Follow your step that error message is disappeared Thank~

In the camera , xnxpilot is not have camera_webcam.cc and camera_webcam.h . So i download and change the device ID, image usb_webcamera device: image But the xnxpilot crashe,error msg show not camere avaulable image I use this to open xnxpilot PASSIVE=0 NOSENSOR=1 USE_WEBCAM=2 ./manager.py I missed something? Thanks

peter50107 commented 2 years ago

I solved this camere avaulable problem~ Thank @eFiniLan for help

openbsod commented 2 years ago

Hi @eFiniLan !

Same here with imx219 camera question. My cameraes are

[Mon Jan 24 15:42:28 2022] imx219 9-0010: tegracam sensor driver:imx219_v2.0.6
[Mon Jan 24 15:42:28 2022] imx219 10-0010: tegracam sensor driver:imx219_v2.0.6
[Mon Jan 24 15:42:30 2022] tegra194-vi5 15c10000.vi: subdev imx219 9-0010 bound
[Mon Jan 24 15:42:30 2022] tegra194-vi5 15c10000.vi: subdev imx219 10-0010 bound

Jetson start usually finishes like that

starting process camerad
camerad ui pandad thermald systemd
platform[0] CL_PLATFORM_NAME: Portable Computing Language
vendor: The pocl project
platform version: OpenCL 2.0 pocl 1.8  Linux, Release, RELOC, LLVM 12.0.1, SLEEF, FP16, CUDA, POCL_DEBUG
profile: FULL_PROFILE
extensions: cl_khr_icd cl_pocl_content_size
name :Xavier
device version :OpenCL 1.2 pocl HSTR: CUDA-sm_72
max work group size :1024
type = 4 = CL_DEVICE_TYPE_GPU
Starting listener for: camerad
got request for invalid buffer type: 1
_ui: cereal/visionipc/visionipc_client.cc:58: bool VisionIpcClient::connect(bool): Assertion `num_buffers > 0' failed.
=== camerad[8224]: Connection established (7FAFBA51B0)OFParserListModules: module list: /proc/device-tree/tegra-camera-platform/modules/module0
OFParserListModules: module list: /proc/device-tree/tegra-camera-platform/modules/module1
OFParserGetVirtualDevice: NVIDIA Camera virtual enumerator not found in proc device-tree
---- imager: No override file found. ----
LSC: LSC surface is not based on full res!
---- imager: No override file found. ----
LSC: LSC surface is not based on full res!
=== camerad[8224]: CameraProvider initialized (0x7fa947e5f0)LSC: LSC surface is not based on full res!
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3264 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3264 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1640 x 1232 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 1 
   Output Stream W = 3264 H = 1848 
   seconds to Run    = 0 
   Frame Rate = 28.000001 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
camerad ui pandad thermald systemd
[ WARN:0] global /data/workspace/opencv-4.5.0/modules/videoio/src/cap_gstreamer.cpp (935) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
camerad ui pandad thermald systemd
camerad ui pandad thermald systemd
camerad ui pandad thermald systemd
camerad ui pandad thermald systemd
camerad ui pandad thermald systemd
camerad ui pandad thermald systemd
camerad ui pandad thermald systemd
camerad ui pandad thermald systemd
^Ckilling camerad

I`ve got no errors while installation and I passed jetson-io.py with dual imx219. Also I replaced camera to imx219 here in camera_frame_stream.cc before the installation ( same result if I leave cam unchanged tho )

Both cams behave just well with v4l2-ctl -d /dev/video0 ( and 1 ) and gst-launch-1.0 nvarguscamerasrc sensor-id=0 ( and 1 ) Also I have no any Panda and I don't know may it be the problem root or not.

peter50107 commented 2 years ago

Hi @openbsod

this problem is "clicked camera preview then it shown camera start then app exit."? I think has this problem is the xnxpilot use mipi camera only has the roadcamera ,and the camera preview is show drivercamera .so has this problem

Peter