Giter Site home page Giter Site logo

me134_explorer's Introduction

me134_explorer

This is a sample ROS node for students in CS/EE/ME 134 to clone and modify to explore the simulated space.

See lab3_prelab.pdf for instructions on running in stage. Instructions for running on the real robot are below.

In addition to what's described in the lab3_prelab.pdf I have added command line options to the me134_explorer.py. Included in those options (see below) is a --strategy option. This allows you to change the default strategy from FindClosestFrontier (which fails because it would crash the robot into a wall) to FindRandomEmptySpace (which just finds a random empty square of 2safety_radius_m meters by 2safety_radius_m meters. You are expected to write an algorithm that explores the map more efficiently than FindRandomEmptySpace.

Your algorithm is also expected to safely explore the space without running into obstacles or unknown space (which could contain obstacles). Find a safe place to view unknown space without touching it. Not all unknown space will be reachable or viewable. Ideally your algorithm would ignore non-reachable frontiers.

After June 5, 2018 global_cost_map_updates are subscribed to and processed. Note that the cost map only gives you the cost from known obstacles. You will have to figure out how to avoid unknown spaces your self. You can also make the costmap your self from the map and add your own cost for unknown areas. (In fact for teaching purposes, consider not using the global_cost_map at all and make your own.)

$ rosrun me134_explorer me134_explorer.py --help
usage: me134_explorer.py [-h]
                         [--strategy {FindClosestFrontier,FindRandomEmptySpace}]
                         [--safety_radius_m SAFETY_RADIUS_M]
                         [--initial_movement_m INITIAL_MOVEMENT_M]
                         [--plot_global_costmap PLOT_GLOBAL_COSTMAP]
                         [--plot_global_costmap_update PLOT_GLOBAL_COSTMAP_UPDATE]
                         [--plot_map PLOT_MAP]

optional arguments:
  -h, --help            show this help message and exit
  --strategy {FindClosestFrontier,FindRandomEmptySpace}
  --safety_radius_m SAFETY_RADIUS_M
                        default: 0.3
  --initial_movement_m INITIAL_MOVEMENT_M
                        default: -0.25
  --plot_global_costmap PLOT_GLOBAL_COSTMAP
                        default: 0
  --plot_global_costmap_update PLOT_GLOBAL_COSTMAP_UPDATE
                        default: 0
  --plot_map PLOT_MAP   default: 1

Pull requests welcome. Especially if you figure out how to get AMCL to work with this setup in stage and/or a real turtlebot.

Running me134_explorer.py on the real turtlebot

Ensure time synchronization between the computers.

On the turtlebot's netbook and the controlling computer, connect to the internet and run:

BOTH> sudo ntpdate pool.ntp.org

Switch the network back to the local wireless/wired connection on both machines. (NOTE to future TAs, we recommend running an ntp server on the laptop (and/or the optitrack server) and having the netbook automatically sync with that server (probably using chrony).)

Ensure that ROS_* environment variables are correct

You might look in the .bashrc files on both machines to ensure that ROS_MASTER_URI and ROS_HOSTNAME are set correctly.

#For the normal wireless config on the controlling laptop it should be:
export ROS_MASTER_URI=http://192.168.1.57:11311
export ROS_HOSTNAME=192.168.1.3

#and on the turtlebot netbot:
export ROS_MASTER_URI=http://localhost:11311
export ROS_HOSTNAME=192.168.1.57

Note that each computer echos the current values of these variables when you run bash, so if they are correct you don't need to change them.

Bring up the turtlebot and hokuyo_node on the netbook.

On the controlling laptop, ssh into the turtlebot and run:

turtlebot> roslaunch turtlebot_bringup minimal.launch

In another terminal window or using tmux, terminator, etc run again on the turtlebot:

turtlebot> sudo chmod a+rw /dev/ttyACM0

Note to future TAs: Use udev to set these permissions automatically.

Then run:

    turtlebot> rosrun hokuyo_node hokuyo_node

You're done running things on the robot now.

Optitrack

If you have optitrack available, on the controlling laptop, run

laptop> roslaunch vrpn_client_ros sample.launch server:=192.168.1.2

launch explore_on_earth.launch

On the controlling laptop run:

laptop> roslaunch me134_explorer explore_on_earth.launch

This will start tf_setup, move_base, gmapping, and rviz with the proper config. (However displaying odom seems to crash rviz.)

rosbag record

Now would be a good time to start recording a bag file using:

laptop> rosbag record -a -o lab3_yourname

The -o option sets a prefix for time stamped bag file. This means you can use this command more than once without worrying about overwriting files.

me134_explorer.py

Now you should try running your algorithm. For testing purposes you could use the built in FindRandomEmptySpaces strategy:

laptop> rosrun me134_explorer me134_explorer.py --strategy=FindRandomEmptySpace

Alternatively if you need to modify some of the parameters you could try:

laptop> rosrun me134_explorer me134_explorer.py --initial_movement_m=-0.2 --strategy=FindRandomEmptySpace --safety_radius_m 0.3

If you want to run the algorithm without stopping to plot, you could try using the option --plot 0 to skip plotting.

When you're done kill the rosbag process with CTRL-c and shutdown the other processes in the reverse order that you started them. If you have plots open you may need to close them before CTRL-c will kill me134_explorer.py.

me134_explorer's People

Contributors

jaedlund avatar tannermm avatar veniversum avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

veniversum

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.