{"id":20083436,"url":"https://github.com/xfangfang/picar","last_synced_at":"2025-08-13T19:44:39.524Z","repository":{"id":109774732,"uuid":"258270406","full_name":"xfangfang/PiCar","owner":"xfangfang","description":"remote car with livestream camera (raspberry pi)","archived":false,"fork":false,"pushed_at":"2021-04-04T09:57:26.000Z","size":299,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-06T01:37:31.204Z","etag":null,"topics":["car","h264","livestream","picamera","raspberry-pi","websocket"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xfangfang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-23T16:50:05.000Z","updated_at":"2023-07-20T12:15:31.000Z","dependencies_parsed_at":"2023-03-08T14:30:43.670Z","dependency_job_id":null,"html_url":"https://github.com/xfangfang/PiCar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xfangfang/PiCar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfangfang%2FPiCar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfangfang%2FPiCar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfangfang%2FPiCar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfangfang%2FPiCar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xfangfang","download_url":"https://codeload.github.com/xfangfang/PiCar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfangfang%2FPiCar/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270303521,"owners_count":24562070,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["car","h264","livestream","picamera","raspberry-pi","websocket"],"created_at":"2024-11-13T15:47:12.513Z","updated_at":"2025-08-13T19:44:39.470Z","avatar_url":"https://github.com/xfangfang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Abstract\n\n以超低延迟控制和监控的树莓派视频小车。经测试，树莓派3b+：在局域网中可以达到平均20ms操作延迟；640*480、30 FPS 下180ms视频延迟。\n\n\n\n# Hardware\n\n### 清单\n\n树莓派3b（or other pi with camera and 40pin gpio）、两个舵机、两个电机、一个L298n电机驱动版\n\n### GPIO接线\n\n左轮电机：L1 = 12，L2 = 16\n右轮电机：R1 = 20，R2 = 21\n水平舵机：PIN_SERVO_H = 14\n垂直舵机：PIN_SERVO_V = 15\n\n# How to run the server\n\nsudo apt-get install pigpio python3-pigpio\n\npip3 install cherrypy ws4py\n\n\npigpiod\n\n\ncd /home/pi\n\nclone https://github.com/xfangfang/PiCar.git\n\ncd /home/pi/PiCar/server\n\npython3 server.py\n\n\n\n# Run on boot\n\nsudo nano /etc/rc.local\n\nadd line `sudo pigpiod` before `exit 0`\n\n\ncd /home/pi/PiCar/server\n\nsudo ln -s `pwd`/car.service /etc/systemd/system/car.service\n\nsudo systemctl enable car.service\n\nsudo systemctl start car.service\n\n# How to use\n\n访问 http://your-raspberry-pi-ip:6082 可以查看实时视频画面。\n\n使用client构建的客户端代码即可在ios或android设备上使用\n\n\n# Server code organization\n\n| file                              | introduction                                                 |\n| --------------------------------- | ------------------------------------------------------------ |\n| var.py                            | 可以调整gpio引脚、视频的样式和帧数等内容                     |\n| server.py                         | cherrypy（python的一个http服务端）的启动代码                 |\n| plugins.py                        | 将自定义的服务（舵机、电机和摄像头）发布在cherrypy上，这样就可以优雅地通过websocket与硬件交互（发布订阅模式） |\n| servo.py    motor.py    camera.py | 分别代表：舵机、电机和摄像头（与底层硬件交互，通过修改这三个文件可以将本程序移植到其他非树莓派设备上） |\n\n\n\n# Best practices\n\nUsing frp for internet connection.\n\n\n# Bugs\n\n- There is something wrong when a websocket client unexpectedly going down.(It truns other websocket clients to be unavailable for 10 seconds)\n\n\n\n# Reference\n这两个使用了相同的实现思路，不过均为nodejs项目：\n\nhttps://github.com/pimterry/raspivid-stream\n\nhttps://github.com/131/h264-live-player\n\n关于 PiCamera 如何传输视频流：\n\nhttps://picamera.readthedocs.io/en/release-1.13/api_camera.html#picamera.PiCamera.start_recording\n\n关于cherrypy 与 ws4py：\n\nhttps://docs.cherrypy.org/en/latest/advanced.html#websocket-support\n\nhttps://github.com/Lawouach/WebSocket-for-Python/blob/961c07ce16ce4eedc34ca1fdacd29442870feccc/ws4py/server/cherrypyserver.py#L286\n\nhttps://github.com/Lawouach/WebSocket-for-Python/blob/961c07ce16ce4eedc34ca1fdacd29442870feccc/ws4py/manager.py#L196\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxfangfang%2Fpicar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxfangfang%2Fpicar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxfangfang%2Fpicar/lists"}