Skip to content

Instantly share code, notes, and snippets.

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
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 / 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 /
Created Dec 4, 2020
This node will read the Path that is published to /drive_path and send it to move_base_flex.
#! /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 / 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
<!-- 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 / 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
<?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="" 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 /
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
#!/usr/bin/env python
# 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 / 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=''>
<!-- 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">
<origin xyz='0.55 0 0' rpy='0 0 ${pi}' />
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 -->
<!-- ************** 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 /
Last active Oct 3, 2020
Tkinter GUI to help start ROS launch files - WIP
#!/usr/bin/env python
# modelled after:
# inspired by:
import subprocess
import time
from Tkinter import *
import rospy
from std_msgs.msg import Int16
from sensor_msgs.msg import NavSatFix, NavSatStatus, TimeReference
jones2126 /
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
# 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