RoCKIn2014PhaseI
Contents
Hardware Preparation
We need to make some initial tasks to fulfill the basic hardware setup, configuration, and customization of the robot.
- Task 1
The roomba vacuum has an especial hardware to connect and disconnect the supply from the brush motors and vacuum motor. This hardware is an electronic switch that works connecting and disconnecting the ground of the motor to control.
In order to powered the arm, we connect two wires to the place where is connected the vacuum motor and disconnected it.
Software:
We need to adapt part of romba_500_series package. We made a few changes in two files. WARNING: THIS IS A QUICK TEST, WE NEED TO RE-WRITE IT IN A NEW FUNCTION
Index: src/iRobot/OpenInterface.cpp
===================================================================
--- src/iRobot/OpenInterface.cpp (revisión: 530)
+++ src/iRobot/OpenInterface.cpp (copia de trabajo)
@@ -207,11 +207,28 @@
int irobot::OpenInterface::brushes(unsigned char side_brush, unsigned char vacuum, unsigned char main_brush, unsigned char side_brush_clockwise, unsigned char main_brush_dir)
{
unsigned char cmd_buffer[2];
+ unsigned char cmd_buffer1[2];
cmd_buffer[0] = OI_OPCODE_MOTORS;
- cmd_buffer[1] = side_brush | vacuum<<1 | main_brush<<2 | side_brush_clockwise<<3 | main_brush_dir<<4;
-
+ //cmd_buffer[1] = side_brush | vacuum<<1 | main_brush<<2 | side_brush_clockwise<<3 | main_brush_dir<<4;
+ cmd_buffer[1] = 0x7;
+ int j=0;
+ while(j<0)
+ {
+ j++;
+ cmd_buffer1[0] = 0x87;
+ //cmd_buffer1[0] = 0x8A;
+ cmd_buffer1[1] = 0x07;
+ try{ serial_port_->write((char*)cmd_buffer1, 1); }
+ catch(cereal::Exception& e){
+ printf("ERROR");
+ return(-1); }
+ }
try{ serial_port_->write((char*)cmd_buffer, 2); }
- catch(cereal::Exception& e){ return(-1); }
+ catch(cereal::Exception& e){
+ printf("ERROR");
+ return(-1); }
return(0);
}
Index: src/roomba500_lightweight.cpp
===================================================================
--- src/roomba500_lightweight.cpp (revisión: 530)
+++ src/roomba500_lightweight.cpp (copia de trabajo)
@@ -83,7 +83,13 @@
tf::TransformBroadcaster odom_broadcaster;
ros::Subscriber cmd_vel_sub = n.subscribe<geometry_msgs::Twist>("/cmd_vel", 1, cmdVelReceived);
- if( roomba->openSerialPort(true) == 0) ROS_INFO("Connected to Roomba.");
+ if( roomba->openSerialPort(true) == 0)
+ {
+ ROS_INFO("Connected to Roomba.");
+ ROS_INFO("Brush switched ON.");
+ roomba->brushes(1,1,1,1,1);
+ }
else
{
ROS_FATAL("Could not connect to Roomba.");
- Task 2
- Emergency Stop Button
In order to stop the robot in a emergency way, we connect a emergency switch trough two wires, between the positive pole of the battery (picture 4) and the connector of it (picture 8), to the roomba vacuum.
- Task 3
- Start Button
The start button must be start a program, for this way a push button is connected to a microcontroller, in this case is connected to a digital input of an Arduino. This digital input is powered to 5V (HIGH state) trough a pull-up resistor. When the start button is pushed, it connect the digital input to ground and set the input to LOW state for a little time, the microcontroller reads the LOW and send a signal to the computer, in order to run the program.
Software Preparation
Environment setup
We are going to define the basis of the system to be deployed.
- Operative System : Ubuntu 12.04 LTS
- Software Restriction : ROS Fuerte
- Core drivers for Roomba : How to install roomba package
Packages search
We use ROS so we can find at least a package for each ability ready to deploy in a robot. In this way, this task involves search and test each package to evaluate if we are able to deploy in our platform.
Navigation 2D navigation stack Turtlebot Navigation
Mapping SLAM
Object recognition Simple Qt interface to try OpenCV implementations of SIFT, SURF, FAST, BRIEF and other feature detectors and descriptors. find-object stack
Speech recognition Speech Recognition and Text-to-Speech (TTS) in π robot Packages pocketsphinx and Festival
Cognition Ongoing task
Person recognition
Person tracking
Object manipulation
Gesture recognition
Ros: Debugging Techniques
It is possible to make debugging in ROS in two ways
- Launch file
Following the Roslaunch techniques
launch-prefix="xterm -e gdb --args" : run your node in a gdb in a separate xterm window, manually type run to start it launch-prefix="gdb -ex run --args" : run your node in gdb in the same xterm as your launch without having to type run to start it launch-prefix="valgrind" : run your node in valgrind launch-prefix="xterm -e" : run your node in a separate xterm window launch-prefix="nice" : nice your process to lower its CPU usage launch-prefix="screen -d -m gdb --args" : useful if the node is being run on another machine; you can then ssh to that machine and do screen -D -R to see the gdb session launch-prefix="xterm -e python -m pdb" : run your python node a separate xterm window in pdb for debugging; manually type run to start it
then you only have to do
roslaunch <package> <launch>
- Running a single node
Following the Commandline techniques
rosrun <package> <node>
instead use
roscd <package>
valgrind bin/<node>or
gdb bin/<node>or
gdb GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Para las instrucciones de informe de errores, vea: <http://bugs.launchpad.net/gdb-linaro/>. (gdb) file <route to node> (gdb) run
Don't forget to add Debug in the CMakeLists.txt
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
set(ROS_BUILD_TYPE Debug)
#set(ROS_BUILD_TYPE Release)
rosbuild_init(node)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
rosbuild_gensrv()
rosbuild_add_boost_directories()
add_subdirectory(src)
- EXTRA - Core dumps
The easy way to get core dumps
Set the core size to unlimited (if it is not set) :
$ ulimit -a core file size (blocks, -c) 0 ...< more info here >... $ ulimit -c unlimited $ ulimit -a core file size (blocks, -c) unlimited ...< more info here >...
To allow core dumps to be created (Ubuntu way)
$ sudo -s # echo 1 > /proc/sys/kernel/core_uses_pid