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
// File: video_stream.cpp | |
// sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev | |
// g++ video_stream.cpp -o video_stream $(pkg-config --cflags --libs opencv4 gstreamer-1.0 gstreamer-app-1.0) | |
#include <iostream> | |
#include <gst/gst.h> | |
#include <gst/app/gstappsink.h> | |
#include <opencv2/opencv.hpp> | |
int main(int argc, char* argv[]) { |
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 | |
from pytensor.graph.op import Op | |
from pytensor.graph.basic import Apply | |
import casadi as cs | |
import pytensor.tensor as at | |
import pytensor.compile.function as pt_function | |
from pytensor import grad | |
class CasadiJacOp(Op): | |
""" |
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
thrust 16V | rpm 16V | power 16V | current 16V | voltage 16V | pwm 16V | thrust (kgf) 16V | efficiency (g/w) 16V | thrust 12V | rpm 12V | power 12V | current 12V | voltage 12V | pwm 12V | thrust (kgf) 12V | efficiency (g/w) 12V | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
-9 | 3200 | 344.48 | 21.53 | 14.98 | 1100 | -4.082336185 | 11.85072046 | -6.62 | 2960 | 182.2 | 15.4 | 11.83 | 1100 | -3.00278506 | 16.48070835 | |
-8.9 | 2767 | 341.92 | 21.37 | 15.25 | 1110 | -4.082336185 | 11.93944836 | -6.58 | 2870 | 181.03 | 15.19 | 11.92 | 1110 | -2.984641344 | 16.48699853 | |
-8.7 | 3245 | 328.96 | 20.56 | 15.33 | 1120 | -4.086872114 | 12.42361416 | -6.34 | 2837 | 169.05 | 14.25 | 11.86 | 1120 | -2.875779046 | 17.0114111 | |
-8.44 | 3269 | 305.12 | 19.07 | 15.35 | 1130 | -3.828324156 | 12.54694597 | -6.09 | 2784 | 160.31 | 13.48 | 11.89 | 1130 | -2.762380818 | 17.2314941 | |
-8.23 | 3269 | 289.12 | 18.07 | 15.35 | 1140 | -3.733069645 | 12.91183469 | -5.8 | 2750 | 146.97 | 12.38 | 11.87 | 1140 | -2.630838875 | 17.90051626 | |
-7.98 | 3186 | 272.16 | 17.01 | 15.35 | 1150 | -3.619671417 | 13.2997921 | -5.59 | 2693 | 138.13 | 11.66 | 11.85 | 1150 | -2.535584364 | 18.35650738 | |
-7.59 | 3141 | 254.56 | 15.91 | 15.35 | 1160 | -3.442770183 | 13.52439575 | -5.23 | 2655 | 129.74 | 10.95 | 11.85 | 1160 | -2.372290916 | 18.2849615 |
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 <iostream> | |
#include <string> | |
#include <boost/asio.hpp> | |
#include "json.hpp" // Changed from <nlohmann/json.hpp> to "json.hpp" | |
using boost::asio::ip::tcp; | |
using json = nlohmann::json; | |
// Function to handle received JSON data | |
void handle_json(const json& data) { |
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 casadi as ca | |
def qr_eigen(A, iterations=100): | |
pQ = ca.SX.eye(A.size1()) | |
X = ca.SX(A) # Make a copy in SX | |
for _ in range(iterations): | |
Q, R = ca.qr(X) # QR decomposition in CasADi | |
pQ = ca.mtimes(pQ, Q) | |
X = ca.mtimes(R, Q) | |
return ca.diag(X), pQ # (eigenvalues, eigenvectors) |
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 socket | |
import json | |
def receive_json_data(host='192.168.2.95', port=16171): | |
""" | |
Connects to a TCP server and receives JSON data. | |
Args: | |
host (str): The server's hostname or IP address. | |
port (int): The port number to connect to. |
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 asyncio | |
import aiohttp | |
import json | |
import sys | |
import signal | |
async def get_vision_position_delta(session, url): | |
try: | |
async with session.get(url) as response: | |
response.raise_for_status() # Raise exception for HTTP errors |
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 asyncio | |
import json | |
from urllib.parse import urlparse, parse_qs | |
import aiohttp | |
import websockets | |
import datetime | |
import csv | |
import os | |
import aiofiles |
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 | |
class BayesianParameterEstimator: | |
def __init__(self, param_min=0.0, param_max=5.0, num_points=500, known_variance=1.0): | |
""" | |
Initialize the Bayesian estimator. | |
:param param_min: Minimum value of the parameter space | |
:param param_max: Maximum value of the parameter space |
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
I, i_X_p = rig_dyn.model() | |
Ic_i = [] | |
for i in range(0, ss.n_joints): | |
Ic_i.append(I[i]) | |
for i in range(ss.n_joints-1, -1, -1): | |
if i != 0: | |
p_X_i_f = pluck.inverse_spatial_transform(i_X_p[i]).T | |
Ic_i[i-1] = Ic_i[i-1] + p_X_i_f@Ic_i[i]@i_X_p[i] |
NewerOlder