How to install ROS (Robotics Operating System) on Raspberry pi 3 - raspberry-pi

How i will able to install ROS (Robotics Operating System). I want to install ROS on my raspberry pi 3.

ROS (Robotics Operating System) install on raspberry pi
Hardware requirement
Raspberry pi 2/3
SD card 16 GB to 32 GB
Card reader
HDMI monitor (optional)
Keyboard (optional)
Mouse (optional)
Download
Download ROS Image (Ubuntu mate)
There are many of Image list item you need to choice one
https://downloads.ubiquityrobotics.com/pi.html
It take some minutes about 1 GB file. When download completed Unzip ROS image into a folder
Download Win32DiskImager
https://drive.google.com/file/d/1Bs2cClNa-LKqeoK8Kmcm-DWhFKsQw2dj/view?usp=sharing
when download complete then install Win32DiskImager
Open Win32DiskImager
Image write into SD Card
Inser SDCard into your pc
Open Win32DiskImager
Set image path using red circle button
Select SDcard using green circle
Everything is ok then click write
It will takes some minutes
Start ROS operating system
Insert SDcard into Raspberry pi
Power up
Psername: ubuntu
Password: ubuntu
Test ROS
Press Ctrl+Alt+T for open terminal
Open terminal
$ rostopic list
Output
/battery_state
/cmd_vel
/diagnostics
/joint_states
/joy
/left_error
/motor_node/parameter_descriptions
/motor_node/parameter_updates
/right_error
/rosout
/rosout_agg
/statistics
/tf
/tf2_web_republisher/cancel
/tf2_web_republisher/feedback
/tf2_web_republisher/goal
/tf2_web_republisher/result
/tf2_web_republisher/status
/tf_static
Thanks install Completed

Related

Running Raspberry PI buildroot image in qemu

I am trying to build a linux image for raspberrypi3 with buildroot and run it on qemu.
Once the make process is done i can copy the sdcard.img file into a SD card and correctly run the OS on a real raspberry pi device without any issue.
but when i try to use the same image file and try to run it on qemu the bootup fails.
qemu-system-aarch64 -M raspi3 -kernel zImage -dtb generated dtb -sd generated .img
=> qemu window opens but blank. nothing on the terminal as well.
qemu-system-arm -M raspi2 -kernel zImage -dtb generated dtb -sd generated .img
=> qemu window opens. raspberry image appears on top left corner. but in the teminal window there is a kernel panic. VFS mount failed
same as 1st step but with a freshly compiled qemu from source => same as 1st step. nothing on the qemu window or in the terminal.
am i doing something wrong?
After few days of googling around a lot i found the answer to my issue.
The Kernel image zImage I use in the terminal command which is built by the buildroot make process is not compatible with the QEMU.
To solve that I had to compile my own QEMU compatible raspberry pi kernel.
I followed this link to compile my own kernel. raspberry pi cross-compile kernel
then when I used QEMU to run a OS there was another kernel panic saying VFS mount failed. When I read the terminal outputs before that, it says not enough space on the media. So expanded the scared.img file to 1G and ran the same terminal command.
Now the QEMU is running perfectly
Using the same kernel image for both these command lines is definitely wrong. raspi3 needs a 64-bit kernel, and raspi2 needs a 32-bit one.
Your command line appears to be missing the argument to the '-dtb' option, and also may be missing an '-initrd' option passing the initial ramdisk, and an '-append' option passing the kernel suitable command line arguments including the correct device to use for the root filesystem.

Raspberry Pi Pico - How to install libraries using rshell and command line

I would like to use a DHT11 and I have downloaded the git repository for the library from Adafruit. I know how to add libraries using Thonny, but I am coding my Pico on a headless pi zero over ssh so I need a way to install libraries from the command line or rshell.
Do any of you know how to do this?
thanks!
The answer is to run rshel on the host rshell -p /dev/ttyACM0 --buffer-size 512 and then just copy the module to /pyboard/lib/. Then run repl and do a CTL + d to soft reboot the Pico.

How can you make a micropython program on a raspberry pi pico autorun?

I have used the software Thonny to send programs to my raspberry pi pico. I am trying to make a specific program auto run when my pico is plugged in. At the moment another program which is on the pico auto runs but I want another program to run instead.
Name the program you want to run main.py
Tested on Rpi Pico W, Ubuntu 22.04 host.
Command line approach
Install the MicroPython firmware.
Download the latest prebuilt firmware, it is a UF2 file:
non-W: https://micropython.org/download/rp2-pico/
W: https://micropython.org/download/rp2-pico-w/
Plug the Pi USB to computer while holding the BOOTSEL button.
A filesystem should appear on host.
Copy the file into the filesystem. On Ubuntu it automounts something like:
cp ~/Downloads/rp2-pico-w-20221014-unstable-v1.19.1-544-g89b320737.uf2 /media/$USER/RPI-RP2/
When flashing ends, the filesystem automatically unmounts, leaving you in non-boot mode. The firmware has been installed.
Install your program as main.py on the board.
Ensure the board is not in boot mode:
after installing firmware, this happens automatically
otherwise just unplug the USB and plug it back in without holding the BOOTSEL button
Install rshell on host:
python3 -m pip install --user rshell
Copy your program to the board as main.py. Supposing you have a blinker program at blink.py in the current working directory, run:
rshell -p /dev/ttyACM0 --buffer-size 512 cp blink.py /pyboard/main.py
/pyboard is a magic path to rshell, not actually present on the host. Terrible API!!!
This is what I tested with:
import machine
import time
led = machine.Pin('LED', machine.Pin.OUT)
# For Rpi Pico (non-W) it was like this instead apparently.
# led = Pin(25, Pin.OUT)
while (True):
led.on()
time.sleep(.5)
led.off()
time.sleep(.5)
The main.py thing is documented e.g. at: https://projects.raspberrypi.org/en/projects/getting-started-with-the-pico/9
Unplug and replug the USB without holding BOOTSEL. Every time you do this, the main.py program starts running automatically.
After installing, you can also use rshell to check the contents of main.py with:
rshell -p /dev/ttyACM0 --buffer-size 512 cat /pyboard/main.py
Bibliography:
https://forum.micropython.org/viewtopic.php?t=3610
https://forum.micropython.org/viewtopic.php?t=6005
https://forums.raspberrypi.com/viewtopic.php?t=301927
Thonny editor UI approach
This is the procedure described on the official docs at: https://projects.raspberrypi.org/en/projects/getting-started-with-the-pico/0
It does the same steps as the CLI approach, but as usual with UIs making it more obscure what is actually happening behind the scenes :-)
Install Thonny:
python3 -m pip install --user thonny
Install the MicroPython firmware
Plug the Pico while holding BOOTSEL
Open Thonny from the command line:
thonny
I tested with version 4.0.1.
Click Python version on bottom right of the screen (bad UI)
Install MicroPython
MicroPython variant: Raspberry Pi Pico (choose W vs non W)
Install
Unplug the Pico, close Thonny, replug the Pico without BOOTSEL, reopen Thonny
Install your program as main.py on the board
Paste our blink.py on the main Thonny editor window
File > Save (or Ctrl + S)
A popup opens, choose: "Raspberry Pi Pico" (instead of "This computer")
Save the file as main.py on the Pico
Unplug USB and replug. main.py starts running.

Raspberry Pi Pico - Flashing program using Macbook

I am trying to load a program on a Raspberry Pi Pico. Have loaded the standard blink program on it using USB connected to my Macbook and used Thonny to run and stop the program.
However if I disconnect the Raspberry Pi Pico, from the USB, the program disappears. I found this video (https://www.youtube.com/watch?v=IMZUZuytt7o) that shows how to make it work with a windows system, but if I try the same with Macbook does not work. It gets stuck at Trying to connect to REPL
Can someone suggest how we can flash the program on the Raspberry Pi Pico so that it stays whenever we connect it to power?
Here is the program I tried
import machine
import utime
led_onboard = machine.Pin(25, machine.Pin.OUT)
while True:
led_onboard.value(1)
utime.sleep(1)
led_onboard.value(0)
utime.sleep(.5)
I tried using the suggested RShell solution using pip install rshell. However it does not seem to work on macbook very well when it comes to copying the program to the pico. So I tried an alternate REPL writer called ampy
To install ampy follow the guide on https://github.com/scientifichackers/ampy
pip install adafruit-ampy
In your shell go to the folder where the program is stored. Keep the file name as main.py
Run ampy using the command
ampy -p /dev/cu.usbmodem0000000000001 put main.py
The format is
ampy –p [USB-Port] put [file to copy]
The file is now copied into the board.
Now if you unplug and re-plug the power source the program in main.py would execute.

Raspberry Pi Camera Module Producing Invalid Images

I am trying to use the Raspberry Pi Camera to take pictures and videos. It was all working fine for about 3 days, after which things started to go downhill. First, I noticed that the website where I was streaming the Raspberry Pi's video showed the unloaded image sign (https://www.thewindowsclub.com/wp-content/uploads/2018/06/Broken-image-icon-in-Chrome.gif). Therefore, I went back to my raspbian terminal and tried basic commands. First, I tried this:
raspistill -o /home/pi/Desktop/image.png
This worked perfectly the past few days, and I thought it worked again, until I opened the image. Image Viewer said that the image is not a PNG file at all. This was the popup:
Fatal error reading PNG image file: Not a PNG file
After looking up the error, I reinstalled the PNG library, and still no luck. So, I decided to use jpg instead. I next executed this:
raspistill -o /home/pi/Desktop/img.jpg
And... I got another error:
Error interpreting JPEG image file (Not a JPEG file: starts with 0xc5 0xdb)
After looking it up again, I used this command:
file /home/pi/Desktop/img.jpg
I got the following output:
/home/pi/Desktop/image.jpg: data
So... if the jpg file is actually a data file, what is the problem?
Also, it was working perfectly for the past few days in a Python script and with the terminal... What happened now?
Some additional information: I always use xrdp to Remote Desktop from my Windows Laptop to my Raspberry Pi (4 B+). Therefore, I cannot see if the preview works or not. I am using Raspberry Pi Camera Rev. 1.3 and Raspbian Full 32-bit.
Some more important information: This error started occurring after an incident that I can't explain. I had my Windows Laptop connected to my Raspberry Pi with Remote Desktop, and I accidentally pressed the Sleep button. When I woke the laptop again, it said Remote Desktop terminated unexpectedly. I kept trying to reconnect but it wouldn't work. So, I unplugged the Raspberry Pi and plugged it in again. After I used Remote Desktop to connect to it again, it started doing this. This made me think it was a software problem, so I enabled and disabled Camera from Raspberry Pi Configuration and raspi-config, but it was no use.
I am stuck and don't know what to do. Any help would be greatly appreciated. Thank You in advance.
EDIT: The preview shows up perfectly, it's just the saving of the image that somehow gets corrupted. Is there any way to re-install raspistill?
I had the same problem.
Installation steps:
-Raspberry pi 4 B 8 Gb
-RPi camera 8 MP v2.1
-Used official Raspberry pi imager app for MacOS to install the official Raspberry Pi 32 bit OS onto 32 GB card
-Set up the Rpi by following all setup prompts
-Ran, sudo apt update, sudo apt upgrade & sudo rpi-update in terminal and rebooted
-Ran sudo rasps-config in terminaI and went to “Interfacing options” and enabled interface option P1 Camera
-Shutdown and connected the raspberry pi camera to the camera interface on the board, made sure the ribbon was right way round and properly seated at the port and at the other end on the card containing the camera
-Ran sudo vcgencmd get_camera in terminal and it returned “supported=1 detected=1”
Here is what I did next:
-Ran raspistill -o Desktop/image.jpg in terminal, got a camera preview on screen
-Ran raspivid -o Desktop/vid.h264 in terminal, got camera preview
-Went to the desktop, the two files were there ,opened the jpg file with image viewer and it looks fine. Tried to open the h264 video file using VLC media player and all I got was a strip of pixelations across the top of the screen
-Installed Kodi player because I thought it might be better at opening h264 video files than VLC
-Installed omxplayer from terminal and tried to open the h264 video file from there - didn’t open
I then repeated installation steps above and installed the OS afresh. In the process I shutdown and I removed the camera from the port, reinserted the camera then rebooted and ran vcgencmd get_camera in terminal and it returned “supported=1 detected=1”.
Then I did the following image/video capture steps:
-Ran raspistill -o Desktop/image.jpg in terminal, got a camera preview on screen
-Ran raspivid -o Desktop/vid.h264 in terminal, got camera preview
-Went to the desktop, the two files were there
-Tried to open image.jpg and got some error message saying “Error interpreting JPEG image file (Not a JPEG file: starts with 0xc% 0xdb”
-So now I could not open either the captured image file or the video file
I kept using the raspberry pi over a day or so to do other things and in the process I probably rebooted/shutdown several times. I deleted Kodi because it didn’t help and was taking up space. I may have done installation steps another time but not sure if I did. I then ran the image/video capture steps mentioned immediately above and to my surprise not only did I get the previews but I was able to open the jpg file and the h264 video file using image viewer and VLC respectively. The camera seems to function correctly. Not sure what happened. Might have been the reinstall or the installation and subsequent deletion of Kodi that did it - I guess I will never know but it looks like reinstalling OS, update, upgrade and reseating both ends of the camera ribbon cable may have done the trick.