Skip to content

Instantly share code, notes, and snippets.

on pi:
raspivid --vflip --hflip -t 0 -cd MJPEG -w 640 -h 480 -fps 10 -b 2200000 -o - | gst-launch-1.0 fdsrc ! "image/jpeg,framerate=40/1" ! jpegparse ! rtpjpegpay ! udpsink host=$receivingIP port=5000
example:
raspivid --vflip --hflip -t 0 -cd MJPEG -w 640 -h 480 -fps 10 -b 2200000 -o - | gst-launch-1.0 fdsrc ! "image/jpeg,framerate=40/1" ! jpegparse ! rtpjpegpay ! udpsink host=192.168.1.185 port=5000
on PC (windows)
C:\gstreamer\1.0\msvc_x86_64\bin\gst-launch-1.0.exe udpsrc port=5000 ! "application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)JPEG,a-framerate=(string)40.000000,a-framesize=(string)1280-720,payload=(int)26" ! rtpjpegdepay ! decodebin ! autovideosink
sudo usermod -a -G dialout your_username_here
#install colcon, if not already present
sudo apt install python3-colcon-ros
mkdir ~/sipeed
cd ~/sipeed
#download the driver linked to in the wiki into ~/sipeed
#Unzip sipeed_tof_ms_a010.zip and cd into the resulting directory. From there:
cd ros2
source /opt/ros/*/setup.sh
# Configuration Settings for C94-M8P device
ublox_gps_node:
ros__parameters:
debug: 1 # Range 0-4 (0 means no debug statements will print)
device: /dev/ttyACM0
frame_id: gps
uart1:
baudrate: 38400
# TMODE3 Config
tmode3: 0 # Survey-In Mode
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
"""Launch the ublox gps node with c94-m8p configuration."""
import os
import ament_index_python.packages
import launch
import launch_ros.actions
/opt/ros/galactic/bin/ros2 launch ublox_gps ublox_gps_node-zed-f9p.py
/home/ubuntu/rtklib/25/app/consapp/str2str/gcc/str2str -in ntrip://myusername:mypassword@caster_ip:caster_port/ODOT_VRS_RTCM3 -b 1 -out serial://ttyUSB0:38400:8:n:1
str2str -in ntrip://username:password@caster_ip_address:port/ODOT_VRS_RTCM3 -n 1 -b 1 -out serial://ttyACM0:38400:8:n:1
# compute the overall motion of the robot since last update
vec_v = (r_vel + l_vel) / 2.0
ang_vel = (r_vel - l_vel) / wheel_base
# decompose into x, y components of velocity vector
vx = vec_v * math.cos(ang_vel)
# calculate angular velocity
vy = vec_v * math.sin(ang_vel)
@JasonRBowling
JasonRBowling / gist:c7162b93d58c10ff88ec1d414e76a434
Created September 24, 2022 16:26
Odometry position calculations
def l_tick_cb(msg):
global wheel_diameter
global l_distance
global l_vel
ticks = msg.data
l_distance = ((ticks / 32.0) / 56.0) * (math.pi * wheel_diameter)
l_vel = l_distance * 20.0
l_rpm_actual = (ticks / 32.0) * 20.0 * 60.0
#print("l_vel: " + str(l_vel))