Skip to content

Instantly share code, notes, and snippets.

@jones2126
jones2126 / steer_motor_v2.cpp
Created May 7, 2021
ROS code to subscribe to cmd_vel and sends commands to motor controller that controls steering for lawn tractor. Currently using Teensy as microcontroller.
View steer_motor_v2.cpp
/*
steer_motor_v1.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 / generated_points.txt
Created Dec 4, 2020
This node will read the generated points file and publish a path to the topic /drive_path
View generated_points.txt
0.0 0.0 0.0
1.0 0.0 0.0
2.0 0.0 0.0
3.0 0.0 0.0
4.0 0.0 0.0
5.0 0.0 0.0
6.0 0.0 0.0
7.0 0.0 0.0
8.0 0.0 0.0
9.0 0.0 0.0
@jones2126
jones2126 / from_drive_path_2_move_base_flex.py
Created Dec 4, 2020
This node will read the Path that is published to /drive_path and send it to move_base_flex.
View from_drive_path_2_move_base_flex.py
#! /usr/bin/python
# credit Matt Droter
import rospy
import actionlib
from nav_msgs.msg import Path, Odometry
from geometry_msgs.msg import PoseStamped, Pose
from tf.transformations import quaternion_from_euler
from math import pow, atan2, sqrt
@jones2126
jones2126 / nmea_serial_driver.launch
Created Nov 17, 2020
ROS launch file used to support the ROS Ag lawn tractor project to read in the GPS data and parse that into the needed NMEA sentences
View nmea_serial_driver.launch
<launch>
<!-- A simple launch file for the nmea_serial_driver node. -->
<arg name="port" default="/dev/gps" />
<arg name="baud" default="115200" />
<arg name="frame_id" default="gps" />
<arg name="use_GNSS_time" default="False" />
<arg name="time_ref_source" default="gps" />
<arg name="useRMC" default="False" />
@jones2126
jones2126 / teensy_launch.launch
Created Nov 17, 2020
ROS Ag launch file to initiate the serial node programs to control the steering the steering motor and transmission plus read the steering angle sensor
View teensy_launch.launch
<launch>
<?ignore - used to comment out lines
# taking out the potentiometer because I will first use the joystick connected to the laptop as well as command line cmd_vel statements
<node ns="potentiometer_teensy" name="potentiometer_output" pkg="rosserial_python" type="serial_node.py" args="/dev/potentiometer_control" output="screen" />
Intial Steer Settings:
steer_left_max = 28900;
steer_right_max = 46300;
steer_straight = 36500;
max_steer_eff = 50;
@jones2126
jones2126 / gps_odom.py
Last active Nov 21, 2020
ROS Ag python program to convert from lat/lon to x/y and publish transform between odom and base_link
View gps_odom.py
#!/usr/bin/env python
# gps_odom.py credit Matt Droter
import rospy
import tf
import math
from nav_msgs.msg import Odometry
from tf.transformations import euler_from_quaternion, quaternion_from_euler, quaternion_multiply
from geometry_msgs.msg import Transform, Quaternion, QuaternionStamped, Pose, Point
from sensor_msgs.msg import NavSatFix, NavSatStatus, TimeReference
@jones2126
jones2126 / lawn_tractor.urdf.xacro
Created Nov 17, 2020
ROS Ag Lawn Tractor URDF file
View lawn_tractor.urdf.xacro
<?xml version="1.0"?>
<robot name="lawn_tractor" xmlns:xacro='http://www.ros.org/wiki/xacro'>
<!-- TODO: collision link element to be added -->
<!-- TODO: inertial link element to be added -->
<!-- define base link, center of rear axle for an ackermann vehicle -->
<link name="base_link">
<visual>
<origin xyz='0.55 0 0' rpy='0 0 ${pi}' />
@jones2126
jones2126 / lawn_tractor_sim_real_world.launch
Last active Nov 21, 2020
ROS Launch file for ROS_Ag lawn tractor project using GPS in the physical world
View lawn_tractor_sim_real_world.launch
<!-- file: robot_in_stage.launch -->
<launch>
<!-- ************** Global Parameters *************** -->
<param name="/use_sim_time" value="false"/>
<!-- ************** Stage Simulator *************** -->
<!-- ************** Robot Description *************** -->
<!-- robot_description is used by nodes that publish to joint_states. -->
<param name="robot_description"
@jones2126
jones2126 / ros_start_up.py
Last active Oct 3, 2020
Tkinter GUI to help start ROS launch files - WIP
View ros_start_up.py
#!/usr/bin/env python
# modelled after: https://raw.githubusercontent.com/ablarry91/quadcopter_IR_control/e782f49390d5527ed86678acda727f5d698c0c07/monocular_pose_estimator/src/Tkinter_GUI.py
# inspired by: https://raw.githubusercontent.com/mturktest123/rosGUI/master/ROS_GUI.py
import subprocess
import time
from Tkinter import *
import rospy
from std_msgs.msg import Int16
from sensor_msgs.msg import NavSatFix, NavSatStatus, TimeReference
@jones2126
jones2126 / parser.py
Created Sep 7, 2020
Parser for NMEA sentences which is part of ROS nmea_navsat_driver updated to output course in radians offset 90 degrees
View parser.py
# Software License Agreement (BSD License)
#
# Copyright (c) 2013, Eric Perko
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright