Skip to content

Instantly share code, notes, and snippets.

View HemaZ's full-sized avatar
🇵🇸
Free Palestine

Ibrahim Essam HemaZ

🇵🇸
Free Palestine
View GitHub Profile
from prius_msgs.msg import Control
class CarDemoControl:
def on_start(self):
self.throttle = 0.5
self.brake = 0
self.steer = 0
self.shift_gears = Control.FORWARD
def on_button_clicked(self,key):
if key == 'stop':
Header header
# Range 0 to 1, 1 is max throttle
float64 throttle
# Range 0 to 1, 1 is max brake
float64 brake
# Range -1 to +1, +1 is maximum left turn
float64 steer
uint8 NO_COMMAND=0
class Example:
def on_start(self):
''' [Optional] Called at the beginning when the block starts. '''
pass
def on_new_messages(self, messages):
''' [Optional] Called according to the execution mode of the block.
Parameters
%% setup
hold all
a=arduino;
mpu=i2cdev(a,'0x68'); %mpu adress is normally 0x68
writeRegister(mpu, hex2dec('B6'), hex2dec('00'), 'int16'); %reset
data=zeros(10000,14,'int8'); %prelocating for the speed
j=1;
a1 = animatedline('Color',[1 0 0]);
a2 = animatedline('Color',[0 1 0]);
a3 = animatedline('Color',[0 0 1]);
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#!/usr/bin/env python
import sys
import os
import logging
from types import *
import time
from pycarmaker import CarMaker, Quantity
import rospy
from std_msgs.msg import Float32
FORMAT = '[%(levelname)6s] %(module)10s: %(message)s'
nViews 1
# First camera
0 {
Width 640
Height 480
Export {rgb}
VPtOffset_x 3.1
VPtOffset_y 0
VPtOffset_z 1.1
FrameRate 25
import cv2
from pycarmaker import VDS
# initalize VDS
vds = VDS()
# Connect
vds.connect()
# Read Images
while(True):
# Capture frame-by-frame
#!/bin/bash
(while sleep 2; do /opt/TurboVNC/bin/vncserver -geometry 1366x768 -securitytypes TLSNone,X509None,None :1; done & DISPLAY=":1" sh ~/.vnc/xstartup.turbovnc & cd /noVNC && ./utils/launch.sh --vnc localhost:5901) & (export DISPLAY=:1 ; ./opt/ipg/carmaker/linux64-8.1.1/bin/CM -cmdport 16660
) & sleep infinity
def on_new_messages(self, messages):
if 'brake' in messages:
print("Braking signal received...")
print(messages['brake'].data)
brake_action = messages['brake'].data
if brake_action:
self.cm.DVA_write(self.brake_quant, 1)
else:
self.cm.DVA_write(self.brake_quant, 0)
if 'steer_sign' in messages: