This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void SetRealTimePriority() { | |
int ret; | |
pthread_t this_thread = pthread_self(); | |
// used to store the scheduling priority | |
struct sched_param params; | |
// set the priority to the maximum. | |
params.sched_priority = sched_get_priority_max(SCHED_FIFO); | |
LOG(INFO) << "Trying to set thread realtime prio = " << params.sched_priority << std::endl; | |
// Attempt to set thread real-time priority to the SCHED_FIFO policy | |
ret = pthread_setschedparam(this_thread, SCHED_FIFO, ¶ms); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import os | |
import time | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from tensorflow import keras | |
from tensorflow.keras.preprocessing import image | |
from tensorflow.keras.applications.resnet50 import preprocess_input, decode_predictions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <assert.h> | |
inline cudaError_t checkCuda(cudaError_t result) | |
{ | |
if (result != cudaSuccess) { | |
fprintf(stderr, "CUDA Runtime Error: %s\n", cudaGetErrorString(result)); | |
assert(result == cudaSuccess); | |
} | |
return result; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image_height,image_width,_ =cv2.imread(os.listdir()[0]).shape | |
output_path = os.path.join(os.getcwd(), "result.avi") | |
video_size = image_width, image_height | |
video_fps = 5 | |
video_size = image_width, image_height | |
video_FourCC = cv2.VideoWriter_fourcc(*'MJPG') | |
out = cv2.VideoWriter(output_path, video_FourCC, video_fps, video_size) | |
for i in sorted(os.listdir()): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in this example the position mode will be selected and started, after the input 1 is triggered, the motor moves to a set position (flagposition mode) | |
//1. Step: mapping the frequently used SDO´s | |
map U16 ControlWord as output 0x6040:00 | |
map U32 ProfileVelocity as output 0x6081:00 | |
map S32 TargetPosition as output 0x607A:00 | |
map U32 Inputs as input 0x60FD:00 | |
map S32 ActualPosition as input 0x6064:00 | |
map S32 AnalogInput as input 0x3320:01 | |
map S08 HomingMethod as output 0x6098:00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.image as mpimg | |
def do_something(img): | |
return np.dot(img[...,:3], [0.299, 0.587, 0.114]) | |
img = mpimg.imread('image.png') | |
result = do_something(img) | |
plt.imshow(result, cmap = plt.get_cmap('gray')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msg_locked_until = dateutil.parser.parse(msg.broker_properties['LockedUntilUtc']) | |
if (datetime.now(utc) + timedelta(0, lock_buff_seconds)) > msg_locked_until: | |
logger.info("Renewing message lock") | |
try: | |
msg.renew_lock() | |
logger.info("Done.") | |
except Exception as e: | |
logger.error("Failed renewing the message lock.") | |
logger.error(e.message) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install qt-sdk | |
then follow | |
#http://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html | |
sudo apt-get install build-essential | |
#install python header and includes | |
# | |
sudo apt-get install python2.7-dev | |
sudo apt-get install python3.4-dev | |
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install xvfb | |
nohup Xvfb :1 > /dev/null 2>&1 & | |
#testing with | |
python | |
import matplotlib | |
import matplotlib.pyplot as plt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install xvfb | |
nohup Xvfb :1 > /dev/null 2>&1 & | |
#testing with | |
python | |
import matplotlib | |
import matplotlib.pyplot as plt |
NewerOlder