Skip to content

Instantly share code, notes, and snippets.

@jones2126
jones2126 / ros_start_up.py
Last active May 16, 2021 16:35
Tkinter GUI to help start ROS launch files - WIP
#!/usr/bin/env python
#
#ROS_GUI_v5.py
# 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
@jones2126
jones2126 / lawn_tractor.launch
Last active May 16, 2021 17:15
ROS Launch file for ROS_Ag lawn tractor project using GPS in the physical world
<launch>
<!-- ************** Robot Description *************** -->
<!-- robot_description is used by nodes that publish to joint_states. -->
<param name="robot_description"
command="$(find xacro)/xacro --inorder $(find lawn_tractor_sim)/urdf/lawn_tractor.urdf.xacro"/>
<!-- Read joint positions from joint_states, then publish the vehicle's
state to tf. -->
<node name="vehicle_state_publisher" pkg="robot_state_publisher"
type="robot_state_publisher">
@jones2126
jones2126 / lawn_tractor.urdf.xacro
Last active May 16, 2021 16:55
ROS Ag Lawn Tractor URDF file
<?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 / gps_odom.py
Last active November 24, 2022 21:19
ROS Ag python program to convert from lat/lon to x/y and publish transform between odom and base_link
#!/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 / teensy_launch.launch
Created November 17, 2020 03:45
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
<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 / nmea_serial_driver.launch
Created November 17, 2020 03:51
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
<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 / from_drive_path_2_move_base_flex.py
Created December 4, 2020 03:10
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
jones2126 / generated_points.txt
Created December 4, 2020 03:15
This node will read the generated points file and publish a path to the topic /drive_path
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 / 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 / gist:3155dd13cf19ed10f8357a163b2a9333
Created May 16, 2021 16:48
teb_local_planner_params_carlike.yaml for lawn tractor
# file: teb_local_planner_params.yaml
TebLocalPlannerROS:
# Trajectory
teb_autosize: True
dt_ref: 0.3
dt_hysteresis: 0.1
global_plan_overwrite_orientation: True
allow_init_with_backwards_motion: False
max_global_plan_lookahead_dist: 3.0