Skip to the content.

ROS easyGo and ros docs

ROS Document for basic rospy system

ROS catkin_pkg init

ROS Turtlebot Offcial Docs

ROS Optional HOW TO CHANGE OpenCR Port

ROS Lecture Github wikim Great explanations

ROS, Using ROSPY & Make subscriber method

ROS, Example Code Get Image from Publisher

ROS, cmd_vel example

Korean, About cmd_vel

ROS Example code for subscriber

Publisher to a topic

How to catkin_make

you should make catking_ws folder right after make files in catkin_ws and its sub directories

But!! Before catkin_make you must give a mod (a+x) by chmod, it makes file executable

chmod a+x {your_file}

Once you did this .py file you don’t have to do it each times

and Catkin_make!

# make source file
cd ~/catkin_ws
catkin_make
source ./devel/setup.bash

Or if you want temporally run just for test you can just run this py file by normal way

python {your_file.py}

and run your py file via rosrun

# don't type {} into actual command
rosrun {your catkin_pkg name} {your_sourcefile.py}

Start ROS Environment

roscore #it make lattepanda work as hub
roslaunch turtlebot3_bringup turtlebot3_core.launch #it link a driver like openCR to lattepanda

Actual Test [Real robot needed]

To start easygo.py

  1. make sure openCR is on
  2. do Start ROS Environment section
  3. if you want run easygo or your py file, for test. just run it by python command
  4. Checkout catkin_pkg make tutorial from above docs

easyGo build badge

Source: ./easyGo.py

you can import this by

#if your py file and easygo file in same dir
from easyGo import easygo

Stop

easyGo.stop(pub, verbose=0)
#Stop All Vector (x,y,z)

Verbose ?

Verbose = 0 (default) Don;t print status | Verbose = 1 Print Everything

Rotate

easyGo.mvRotate(speed, angle, clockwise, verbose=0)
'''Rotate {0} degree with {1} degree/sec Clockwise = {2}'''

if angle=-1, turn CW/CCW continuously</br>

Forward/Backward

easyGo.mvStraight(speed, angle, verbose=0)
#Stop All Vector (x,y,z)

angle = -1 is for inf go, the example code is below

Curve with linear, angular Value

mvCurve

easyGo.mvCurve(speed, steer)
#speed for linear velocity {negatives for reverse, positives for forward (float)}
#steer for float value for angular speed

you can check the example of this func by easyVector section


### function example
```bash
if __name__ == '__main__':
    try:
        rospy.init_node('robot_goForward', anonymous=True)
        velocity_publisher = rospy.Publisher('cmd_vel', Twist, queue_size=10)

        speed = float(input("Input your speed (degrees/sec):"))
        angle = float(input("Type your distance (degrees):"))
        clockwise = input("Clockwise?: ") #True or false
        # Testing our function

        #rotate(speed, angle, clockwise)

        #Verbose = 0 (default) Don;t print status
        #Verbose = 1 Print Everything


        '''   Infinity go Example ..........break condition DIY
        t0 = rospy.Time.now().to_sec()
        while True:
            mvStraight(velocity_publisher, speed, angle, 1)
            t1 = rospy.Time.now().to_sec()
            if t1-t0 > 10:
                break
        stop()        
        '''


    except rospy.ROSInterruptException:
        pass

easyControl build badge

go to source ./easyControl.py

easyControl is for operating turtlebot by keyboard input

it should be working which keyCap.py

Basic keyset

w : go forward</br> a : turn counter clockwise</br> s : go backward</br> d : turn clockwise</br> q : stop & terminate program</br> x : set default speed</br> e : speed up by 0.1</br> c : speed down by 0.2</br>

Any keyevent which is not on the above is for e-stop

easyVector build badge

go to source ./easyVector.py easyVector is IMU Based Steer Assistant solution

drawing

it can be run by standalone or run by import

IMPORTANT!!
If you wanna run it by import you must Initialize ros node top of your code

import rospy
rospy.init_node('robot_mvs', anonymous=True)

After that just implement easyVector by import easyVector

Usage

easyVector.main(desired_angle)

and this command returns steer value for easyGo.mvCurve(speed, steer)

imu2angle build badge

imu Yaw value to ‘imu_raw’ topics on ROSPY