Skip to content

Instantly share code, notes, and snippets.

@jones2126
jones2126 / ttgo_adafruit_server.ino
Created July 7, 2022 16:07
Testing code for master/tractor/server to interact with slave/remote control/client using a TTGO board and LoRa communication. This code runs on the server which is meant to be the laptop on the tractor.
/*
* Program: ttgo_adafruit_server.ino
* a simple messaging server(sender)with the RH_RF95 class.
*/
#include <SPI.h>
#include <RH_RF95.h>
//#define RFM95_CS 2 // "E"
@jones2126
jones2126 / ttgo_RH95_init.ino
Last active June 24, 2022 01:41
TTGO Semtech SX1276 ESP32 LoRa board using Radio Head RH_RF95. This program is used to test getting the LoRa service to initialize.
/*
ttgo_RH_RF95_init This program is used to test getting the LoRa service to initialize on a TTGO ESP32 LoRa board
ref: https://microcontrollerslab.com/ttgo-lora32-sx1276-oled-board-pinout-getting-started-with-arduino-ide/
*/
#include <SPI.h>
#include <RH_RF95.h>
#include <RHReliableDatagram.h>
// LoRa pins for TTGO Semtech SX1276
#define LORA_MISO 19
@jones2126
jones2126 / steer_motor_v3.cpp
Last active March 3, 2022 18:19
ROS code to subscribe to cmd_vel and sends commands to motor controller that controls steering for lawn tractor. Currently using Teensy as microcontroller.
/*
steer_motor_v3.cpp
Subscribes to cmd_vel
Sends commands to motor controller connected to Teensy using commands digitalWrite(DIRPin, HIGH);
*/
#include "ros.h"
#include "std_msgs/UInt16.h"
@jones2126
jones2126 / steer_base_test.ino
Created March 3, 2022 17:07
Test program for a MAP function aimed at testing code for a steering module that will be used to turn a steering servo from hard left to hard right based on the steering angle provided which will generally be between .82 and -.76 which has to be mapped to a range of -14,000 and 13,500 which are the values from the steering angle sensor.
/*
Test program for a MAP function aimed at testing code for a steering module that will be used to turn a steering servo from hard left to hard right
based on the steering angle provided which will generally be between .82 and -.76 which has to be mapped to a range of -14,000 and 13,500 which are
the values from the steering angle sensor.
I initially tested this on an Arduino Nano Every board
if(angular_vel_z > 0)
{
steering_angle_target = angular_vel_z*(steer_left_max - steer_straight) / 1+steer_straight;
@jones2126
jones2126 / map_function_test.ino
Last active December 4, 2021 17:50
Test code for MAP function to be integrated into steering control module
/*
Test program for a MAP function aimed at testing code for a steering module that will be used to turn a steering servo from hard left to hard right
based on the steering angle provided which will generally be between .82 and -.76 which has to be mapped to a range of -14,000 and 13,500 which are
the values from the steering angle sensor.
*/
#include <Arduino.h>
// steering value constants
const int steer_straight = 1;
@jones2126
jones2126 / transmission_v3.cpp
Last active November 14, 2021 20:01
Super Servo ROS enabled and control the transmission of a lawn tractor
/*
This program is designed to run on a Teensy that is connected to a SuperServo to make the Super Servo ROS enabled and control
the transmission of a lawn tractor. It is started in a launch file as one of multiple nodes with the command:
<node ns="transmission_teensy" name="transmission_cntrl" pkg="rosserial_python" type="serial_node.py" args="/dev/transmission_control" output="screen" />
Overview:
subscribe to a target speed in cmd_vel format (i.e. cmd_vel.linear.x)
subscribe to actual speed from the rear wheels
adjust servo position to match actual speed to target speed
@jones2126
jones2126 / notes.txt
Created October 25, 2021 00:12
Soontech RX 580 ellesmere 8gb not mining with ethminer using ethos; Receiving the error "Creating DAG buffer failed: clCreateBuffer: CL_INVALID_BUFFER_SIZE (-61)"
Similar posts https://github.com/ethereum-mining/ethminer/issues/1966
What is not clear is the fix. There is a mention, "You can continue using ethminer if you can build the binary on your own
See instructions here https://github.com/ethereum-mining/ethminer#build"
Download ethminer-0.18.0-cuda-8-linux-x86_64.tar.gz
Are these correct? (from: https://github.com/ethereum-mining/ethminer/blob/master/docs/BUILD.md)
$ sudo apt install libdbus-1-dev
$ sudo apt-get install mesa-common-dev
@jones2126
jones2126 / ROS_GUI_v7.py
Created August 21, 2021 23:09
Python Tkinter script to help start launch files from my laptop and to start windows that show the values of ros topics.
#!/usr/bin/env python
#
import tkinter as tk
from tkinter import ttk
import subprocess
import time
'''
issues:
- speed up the login process by looking for the $ which shows the login has completed
@jones2126
jones2126 / sensor_display.py
Last active August 15, 2021 16:41
ROS subscriber to read sensor and display using tkinter and a Class
import tkinter as tk
from tkinter import ttk
import rospy
from std_msgs.msg import Int16
"""
Simple Python subscriber to a ROS topic (/front_angle_low_res) which in my case is outputing an integer result
and displays the result in a tkinter window
credit: https://www.pythontutorial.net/tkinter/tkinter-after/
@jones2126
jones2126 / gist:f20d25b08bfcd38c1eb117367cf4d6c6
Created July 17, 2021 17:04
Sparkfun Example for reading BNO080 IMU
/*
Using the BNO080 IMU
Example : Euler Angles
By: Paul Clark
Date: April 28th, 2020
Based on: Example1-RotationVector
By: Nathan Seidle
SparkFun Electronics