EduMIP_ROS

ROS on the EduMIP Mobile Robot

 

Introduction

This web page was substantially updated in February,  2018. Please notify me of any errors, omissions, or things I should add.  Thanks!  Louis Whitcomb (llw@jhu.edu)

This page has notes on installing and running the The Robot Operating System (ROS) on the EduMIP mobile robot. The EduMiP is a self-balancing robot built around the BeagleBone Black embedded microprocessor board and the Beaglebone Black Robotics Cape developed by James Strawson and Professor Thomas Bewley of the Coordinated Robotics Laboratory at UCSD and their collaborators.  The BeagleBone Blue, newly released in mid 2017, combines the features of the BeagleBone Black and the Robotics Cape into a single board computer.  Professor Bewley uses this robot in his course ​ MAE144 – Embedded Control & Robotics at the UCSD Department of Mechanical and Aerospace Engineering.

The EduMIP robot is available from Renaissance Robotics : https://www.renaissancerobotics.com

 List of Ingredients

Here are the ingredients.   Note that you need EITHER one Baglebone Blue OR one each of the Beaglebone Black and the Robotics Cape.

  • Beaglebone Blue (BBBL): The BeagleBone Blue, newly released in mid 2017, combines the features of the BeagleBone Black and the Robotics Cape into a single board computer – woot, woot!
  • Beaglebone Black (BBB): The Beaglebone Black is a low-cost, community-supported development platform for developers and hobbyists with an 1GHz AM335x 1GHz ARM® Cortex CPU, 512MB DDR3 RAM, and 4GB 8-bit eMMC on-board flash storage.
  • Robotics Cape (BBB-RC): The Beaglebone Black Robotics Cape (also see the Strawson Design web page) is an I/O board for the Beaglebone Black that provides several sensors and rich hardware support including the following:
    • Sensors:
      • 9-Axis IMU
      • Barometer
    • I/O
      • 4 Quadrature encoder counting channels
      • 4 H-bridge motor controllers
      • 8 Servo/ESC outputs
      • Standard DSM RC radio interface
      • I2C UART SPI ADC PWM GPIO
      • Charge controller for a lithium-polymer battery
  • EduMIP Kit: Kit comprises of the DC motors, gearboxes, encoders, wheels, plastic injection-molded plastic parts, wiring, and fasteners to turn the BBB and BBB-RC into a mobile robot.
  • Micro-SD Card: A micro-SD card at least 8GB in size.
  • Ubuntu 16.04 LTS image for BeagleBone Black and Blue:  A pre-built image courtesy of Robert Nelson, Jeff O’Brian, and louis whitcomb is available here: https://jh.box.com/v/530-707-Dropbox.  This image comes with ROS Kinetic pre-installed as well as a ros catkin workspace with the basic ROS EduMIP packages pre-installed.  There are Ubuntu two images posted, be sure you use the correct image:
    • Use this image for the BragleBonbne Blue: 2018_02_03_beaglebone_blue_16p04_Ubuntu_LTS_EduMIP_ROS.img.zip
    • Use this image for the BeagleBone Black Wireless + Robotics Cape: 2018_02_03_beaglebone_black_wireless_16p04_Ubuntu_LTS_EduMIP_ROS.img.zip
    • The 8GB image is compressed to a 2.5 GB zip file.  YOU DO NOT NEED TO UNCOMPRESS THE ZIP FILE.  The image burner (Etcher) can uncompress it on-the-fly.
  • USB-Joystick: Useful for the tutorials in my Robot Systems Programming course.  A good inexpensive model is the Logitech Gamepad F310

Assembling and Testing the EduMIP Kit (part of Robot Systems Programming Course Assignment #3)

Assemble and Test Your EduMIP as follows. Use care. Be gentle.

  1. Assemble EduMIP: Follow the step-by-step illustrated  EduMIP assembly instructions available here: https://jh.box.com/v/530-707-DropboxAlso see Mark Yoder’s video on how to assemble the BeagleBone Blue EduMIP Robot here: https://www.youtube.com/watch?v=BIMb8D5RdGA

    Mark Yoder’s video on how to assemble the BeagleBone Blue EduMIP Robot

  2. Some Additional Notes:
    • Additional documentation is available here https://github.com/StrawsonDesign/EduMiP
    • IF YOU ARE USING A BEAGLEBONE BLACK + ROBOTIC CAPE, DON’T CROSS THE +5V and +9V STREAMS: The BBB has a barrel power connector for +5V. The robotics cape has an identical ballel power connector for +9V. Yikes!
      • Do not plug a +9V power supply directly into the +5V power connector on the BBB – the results will be a dead BBB.
      • The EduMIP kit contains plugs to block off the +5V power connector on the BBB – install one of them in the +5V BBB power connector to discourage you from over-volting the BBB.
    • UNPLUG when not in use: When you are not using the EduMIP or charging the battery:
      1. Unplug the 12V charge cable from the EduMIP
      2. Unplug the battery from the Robotics Cape before transporting the robot.
      3. Store the EduMIP in its robot house.
    • Avoid FOD (Foreign Object Damage):
      • Robots Like Their House:When transporting your EduMIP, put it in its EduMIP house (a.k.a. ziplock food container) to prevent damage to your MIP.
      • Do not put any loose items that conduct electricity into your EduMIP house. Items such as screwdrivers, loose screws, and loose wires can cause short circuits that will damage your EduMIP.
    • DON’T DAMAGE THE MOTOR and ENCODER CONNECTORS:The connectors on the robotics cape for the encoders and the motors are very tiny and fragile. You must use great care in mating the encoder and motor cables to these connectors. The encoder and motor wires in a recent kit were just barely long enough to connect the M1/E2 motor/encoder. See your TA for guidance in connecting the motor and encoder cables.
    • Loose Switches Sink Ships: Carefully check the physical integrity of the robotics cape power, reset, pause, and mode switches. If they are not soldered onto the board securely, see your TA for help in resoldering them.
    • Missing Screws: A recent kit was missing the two#4×38″ self-tappingad screws for mounting wheels to motors – see your TA for extras if your are missing any parts.

Setting Up Your Beaglebone Black/Blue and your EduMIP (part of ROS Course Assignment #3)

Set up your BeagleBone Blue Board for use in your EduMIP as follows.

  1. Test your BeagleBone Blue/Black Board: Before assembling the edumip, test your beaglebone blue – it comes with Debian Jessie installed on its on-board 4GB flash disk.
    1. Follow the instructions here: https://beagleboard.org/getting-started   to install udev rules on your linux pc.  ONLY USE THIS PAGE TO LEARN HOW TO INSALL UDEV RULES ON YOUR LINUX PC, ignore everything else.
    2. Once you install the appropriate  udev rules on your linux PC, it will establish an Ethernet connection to the BBB via the USB connection via virtual Ethernet adapter usb0. Your host PC will be at ip address 192.167.7.1, and the BBB will be at 192.168.7.2. SSH to from the host PC to the BBB with “ssh debian@192.168.7.2”. The default password for “debian” is “temppwd”.
    3. Whenever you are done working with the BBBL and ready to power it off, don’t just unplug it – run the command “sudo poweroff” to shut down Linux and power off the board. Once all the LEDs on the board are dark, then it is OK to unplug the USB cable.
  2. Install and Test a 8GB Ubuntu 16.04 LTS Linux Image with ROS and BBBL/EduMIP support on your BBBL:  We have created a 8GB  Ubuntu image that has ROS kinetic and support for the BBBL. Your EduMIP kit has a blank 32GB or 64GBMicro-SD card.
    1. Doanload the Image: A pre-built image of Ubuntu 16.04 for ARM wiht support for BBBL and ROS, see the instructions above entitled “Ubuntu 16.04 LTS image for BeagleBone Black and Blue”.
    2. You DO NOT need to uncompress the zipped image.
    3. Download Etcher: Download and install Etcher on your computer from https://etcher.io — Etcher is a program for burning disk images onto SD cards. 
    4. Burn the disk image onto the provided micro-SD card.
    5. Burn, Baby, Burn!! Burn the Linux image onto the Micro-SD card with your PC or with a PC in the Wyman 170 Lab.
      • Many notebook computers have native SD and/or Micro-SD card slots. The micro-SD cards provided with your EduMIP comes with a Micro-SD-to-SD card adapter.
      • We have 10 USB-to-Micro-SD card burners available for you to use in Wyman 170. You can burn with your PC or with a lab PC.
      • If you are unsure of how to burn the micro-SD image, come to TA office hours.
    6. GENTLY Install the Micro-SD Card:Install the Micro-SD card in the Micro-SD card slot of the BeagleBone. DO NOT FORCE IT, IT TAKES JUST A GENTLE TOUCH TO INSTALL.
    7. Boot it! Boot your BBBL from the Micro-SD card image by plugging it into your PC with a USB cable.
      1. If the Micro-SD card contains a bootable image, then the BBBL will boot from it instead of from its on-board Flash disk.
      2. SSH into the BBBL (“ssh ubuntu@192.168.7.2” with password “temppwd”) and verify that you are in fact running the 32GB image. The command “df -h” should show at least 2 GB of free space, and the command “htop” should show a 1GB swap file active.
  3. Test EduMIP: Test your EduMIP by logging in as user “ubuntu” with password “temppwd”  as follows:
    1. NOTE ON ERROR MESSAGES: The latest version of the roboticscape library that is loaded on the Ubuntu image that we are using has some bugs with the PRU support that throw the error message “ERROR: pru-rproc driver missing” when you make calls to the roboticscape libraries to access the BBBL hardware.  We can ignore this warning, it will be fixed in a later release.  Expect to see one of these warnings when you run programs such as “rc_balance”, “rc_test_encoders”, “edumip_balance_ros”, etc.  Here is an example of this error message:ubuntu@arm:~$ rc_test_imu
      ERROR: pru-rproc driver missing
      try ‘test_imu -h’ to see other options
      Accel XYZ(m/s^2) | Gyro XYZ (rad/s) | Mag Field XYZ(uT) | Temp (C)
      0.23 -3.06 9.72 | 0.0 -0.0 -0.0 | 22.9 -4.1 -54.9 | 37.9
    2. Test Encoders: Run the command “rc_test_encoders” and rotate the wheels a bit – you should see encoders E2 and E3 displaying changing encoder counts.
    3. Test Motors: Run the command “rc_test_motors -d 0.1” to — when you pick up the EduMIP the two wheels should rotate in opposite directions.
    4. Calibrate Gyros: Place your EduMIP on the table, motionless, and run the command”rc_calibrate_gyro” and follow the instructions. This calibration program writes the gyro calibration file /var/lib/roboticscape/gyro.cal
    5. Test Gyros: Run the command “rc_test_imu” and verify that the “Gyro XYZ (rad/s)” data is zero (or nearly zero).
    6. Calibrate Magnetometer: Run the command “rc_calibrate_mag” and follow the instructions – you will be asked to pick up the EduMIP in your hand and rotate (“spin”) it into all orientations. This calibration program writes the magnetometer calibration file /var/lib/roboticscape/mag.cal
    7. Test Magnetometers: Run the command “rc_test_imu” and verify that the “Mag Field XYZ(uT)” data is non-zero. The Earth’s magnetic field vector magnitude in Baltimore and Woods Hole is about 52uT, but for now don’t worry if your magnetometer seems a bit off.
    8. You can find out the latitude, longitude, and magnetic field strength for Baltimore by entering your zip code in this web page: https://www.ngdc.noaa.gov/geomag-web/#igrfwmm
    9. Test Balancing the EduMIP: Run the command “rc_balance”, and standing the robot up. Your robot should balance in place.
  4. Test ROS on the BBBL
    1. Check your .bashrc file. At the end if the file it should have the following commands in the following order:
      1. First, the command “source /opt/ros/kinetic/setup.bash” to setup ROS environment variables.
      2. Second, the command “source ~/catkin_ws/devel/setup.bash” to add your local catkin workspace to the ROS environment (this is called “worspace overlay).
    2. run the command “source .bashrc” to set up your ROS environment variables. Check them with the command “printenv | grep ROS”.
    3. Verify that you can run “roscore” and other ROS utilities.
    4. Verify that you can run “catkin_make” in the BBBL ROS workspace.
    5. The image is provided
  5. Update and Test ROS EduMIP Balance Program:
    1. First you must assemble and test the EduMIP as described in the Section entitled Assembling_and_Testing_the_EduMIP_Kit
    2. If you have not done so already, calibrate the EduMIP’s gyro with the command “rc_calibrate_gyro” while the robot is sitting motionless on a table.
    3. Log in to your EduMIP with user name “ubuntu” and password “temppwd”
    4. Configure WiFi on your EduMIP: Configure your WiFi so that you can clone ROS packages from our git repository.
    5. If you installed the pre-built Ubuntu 16.04 image as instructed above then you will already have the packages “edumip_msgs” and “edumip_ros_balance” in the source directory of your catkin worskace, i.e. ~/catkin_ws/src/edumip_msgs, and ~/catkin_ws/src/edumip_balance_ros.   Update the edumip_balance_ros package  with “cd  ~/catkin_ws/src/edumip_balance_ros” and “git pull” to pull down the latest source for this package.  If you get the error message “error: Your local changes to the following files would be overwritten by merge:
      src/edumip_balance_ros.cpp Please, commit your changes or stash them before you can merge.“, then delete the offending file src/edumip_balance_ros.cpp, and “git pull” again.
    6. If you edumip_msgs and edumip_balance_ros are not already in the src directory of your EduMIP’s catkin workspace (should be ~/catkin_ws/src),  then clone these two ROS packages into  ~/catkin_ws/src):
      1. The edumip_msg package defines the custom message type edumip_msf/EduMipState for the EduMIP. This package contains no source code, just a message definition and associated CMakeLists.txt and package.xml. If your computer is to access this message type, you should clone the project to your PC as well. This package is architecture-independent. This package can be git cloned from this public URL: https://git.lcsr.jhu.edu/lwhitco1/edumip_msgs.git 
      2. The edumip_balance_ros package contains a C++ ROS node edumip_ros_node.cpp which is a ROS-ified version of the rc_balance program. The linux image we provided for you already has the Robotics Cape drivers and ROS installed. This package can be git cloned from this public URL: https://git.lcsr.jhu.edu/lwhitco1/edumip_balance_ros.git
    7. Build these two packages with the command catkin_make” in the top directory of your catkin workspace.
    8. Test to verify that ROS is now aware of the custom messages defines in the edumip_msgs package with the command: rosmsg show edumip_msgs/EduMipState.
    9. Open two remote ssh sessions on the EduMIP:
      1. First, in the first shell run “roslaunch edumip_balance_ros edumip_balance_ros”
      2. Second, in the second shell look at the ros topics and echo the topic /edumip/state.
      3. Stand up your robot, it should balance.
  6. POWERING OFF THE BBBL SAFELY: When you are done and ready to power down the BBBL, don’t just unplug it – run the command “sudo poweroff” to shut down Linux and power off the board. Once all the LEDs on the board are dark, then it is OK to unplug the USB cable.

Some Useful Linux Notes for the BBB and BBBL

  1. The editors emacs and nano are already installed on the BBB linux image provided for this class.
  2. The linux “locate” utility is not installed by default, but you can install it with “sudo apt-get install locate”, and initializing the locate database with the command “sudo updatedb” (takes a few minutes).
  3. The NTP time server is installed on the BBB linux image provided for this class, but it will only sync if the BBB has a route to the internet, for example when your WIFi link is on. The USB network connection to your PC does not route to the internet by default. You can check ntp status with the command “ntpq -p”.

Notes on Setting up the BeagleBone Black (BBB) and Beaglebone Blue (BBBL) with Ununtu 16.04 and ROS

(These are here for reference only, and should not be required steps to completing assignment 3).

Connect from your host PC to the BBB via USB

  • Follow the instructions here: https://beagleboard.org/getting-started
  • Once you install the appropriate drivers or udev rules on your host PC, it will establish an Ethernet connection to the BBB via the USB connection via virtual Ethernet adapter usb0. Your host PC will be at ip address 192.167.7.1, and the BBB will be at 192.168.7.2. SSH to from the host PC to the BBB with “ssh ubuntu@192.168.7.2”. The default password for “ubuntu” is “temppwd”.

Establish an Ethernet connection with DNS and a route to the outside world

WiFi (BBBL, BBB Wireless, BBB Classic + USB WiFi Adapter):

  • WiFi in a Jiffy: Follow the instructions for connmanctl listed in the comments of the file /etc/network/interfaces. Use the command cat /etc/network/interfaces to read the comments.
  • NOTE: The utility connmanctl does not support enterprise networks such as “hopkins”, but it does support WPA/WPA2 networks such as the “turtlebot” WiFi network in the Wyman 170 lab, whose WiFi password will be given in class.
  • NOTE: Upon boot the BBBL WiFi adapter does not always come up properly. If you do not see “wlan0” in the ifconfig output, try manually enabling the BBBL wlan0 interfce with the command “ifconfig wlan0 up”. Then you should be able to see wlab0 in the output of the “ifconfig” command.
  • ifconfig: Use the command “ifconfig” to see all configured network interfaces (Ethernet, WiFi, USB, etc) on your machine.
  • iwconfig: Use the command “iwconfig” to see all configured WiFi network interfaces on your machine.
  • Who am I? The easiest way to determine the IP address (or addresses) of a Linux machine is to log into it and use the command “ifconfig”.
  • WiFi Groundhog Day! Unfortunately, at present the BBBL does not remember WiFi settings

The preferred WiFi connection is to have both the BBBL and your PC connected to the same WiFi access point, so that you can ssh into your BBBL from your PC, AND your BBBL has internet access to git repos, etc.

It is also possible, to connect directly to the BBBL using it as a WiFi access point by connecting your PC to the WiFi network “BeagleBone-XXXX, where XXXX is unique to your BBBL.  The WiFi password is “BeagleBone”.  This is an easy connection, but  in this configuration neither your BBBL nor your PC will have internet access to git repos, etc.  After you connect, your PC will have an IP address of 192.168.XXX.YYY.  The BBBL IP address will be 192.168.XXX.1

Update your BBBL Ubuntu Distribution

On the BBB run the Linux commands “sudo apt update” and “sudo apt dist-upgrade”

Installing the Robotics Cape Software on the BBBL

  • Robotics Cape / BBBL support is already loaded onto the pre-built Ubuntu image for the BBBL noted above, you do not need to reinstall it.
  • Binary installation under Ubuntu 16.04 on ARM: “sudo apt-get install roboticscape”
  • Installation from Source

You will want to install a copy of the robotics cape source and example code on your BBB. It is available here: https://github.com/StrawsonDesign/Robotics_Cape_Installer. To install a copy in your home directory:

Now you can browse the robotics cape source code and follow the instructions to compile and install the robotics cape library and example programs.

Installing basic ROS packages for the EduMIP

Clone these two git repos into your ~/catkin_ws/src directory:

  • https://git.lcsr.jhu.edu/lwhitco1/edumip_msgs.git
  • https://git.lcsr.jhu.edu/lwhitco1/edumip_balance_ros.git

cd to~/catkin_ws and build the packages with “catkin_make”.

To run the edumip_balance_ros node the program needs to have root privileges.  Perhaps the easiest way to accomplish this is to change permissions and ownership of the compiled binary file with these two commands (in this order) after you have compiled it:

  • sudo chown root:root  ~/catkin_ws/devel/lib/edumip_balance_ros
  • sudo chmod u+s  ~/catkin_ws/devel/lib/edumip_balance_ros

Run the edumip_balance_ros ROS node with “roslaunch edumip_balance_ros  edumip_balance_ros.launch“.   It balances the robot, receives twist velocity command messages on the topic /edumip/cmd and publishes its state on the ROS topic /edumip/state

If you can’t find the launch file edumip_balance_ros.launch in the directory ~/catkin_ws/src/edumip_balance_ros/launch then you need to “git pull” the latest version of this package as noted above, and recompile the source with “catkin_make”.

See the week 3 assignment on this course web page for more details on using these ROS backages:  Robot Systems Programming Week 3 Assignment

 

Notes on Running EduMIP with ROS

Why do I get permission Errors when running edumip_balance_ros and how do I fix it?

Read this if you are getting errors like “can’t open: /sys/devices/platform/ocp/ocp:H18_pinmux/state
Pinmux: Permission denied” when you run edumip_balance_ros.

When you compile the project edumip_balance_ros on the edumip with catkin_make, the compiled executable is this file:

~/catkin_ws/devel/lib/edumip_balance_ros/edumip_balance_ros

ubuntu@arm:~/catkin_ws$ ls -l devel/lib/edumip_balance_ros/
total 272
-rwxrwxr-x 1 ubuntu ubuntu 278292 Feb 18 18:48 edumip_balance_ros

Note that the file’s owner and group are ubuntu:ubuntu, and that it is executable (“-rwxrwxr-x”).

When you attempt to run this newly compiled file, however, you will get permission errors like the following:

ubuntu@arm:~/catkin_ws$ roslaunch edumip_balance_ros edumip_balance_ros.launch 
... logging to /home/ubuntu/.ros/log/a271dd92-14dc-11e8-b293-dc5360d671c6/roslaunch-arm-2845.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://192.168.10.102:37365/

SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.12

NODES
 /
 edumip_balance_ros_node (edumip_balance_ros/edumip_balance_ros)

ROS_MASTER_URI=http://192.168.10.101:11311

process[edumip_balance_ros_node-1]: started with pid [2874]
[ INFO] [1518979862.674565427]: File /home/ubuntu/catkin_ws/src/edumip_balance_ros/src/edumip_balance_ros.cpp compiled on Feb 3 2018 19:38:02.
can't open: /sys/devices/platform/ocp/ocp:H18_pinmux/state
Pinmux: Permission denied
can't open: /sys/devices/platform/ocp/ocp:C18_pinmux/state
Pinmux: Permission denied
can't open: /sys/devices/platform/ocp/ocp:U16_pinmux/state
Pinmux: Permission denied
can't open: /sys/devices/platform/ocp/ocp:D13_pinmux/state
Pinmux: Permission denied
can't open: /sys/devices/platform/ocp/ocp:J15_pinmux/state
Pinmux: Permission denied
can't open: /sys/devices/platform/ocp/ocp:H17_pinmux/state
Pinmux: Permission denied
WARNING: missing PINMUX driver
You probbaly just need a newer kernel
Unable to open /dev/mem
mmap_gpio_adc.c failed to initialize gpio
[ INFO] [1518979862.806645002]: ERROR: failed to initialize cape.
[edumip_balance_ros_node-1] process has died [pid 2874, exit code 255, cmd /home/ubuntu/catkin_ws/devel/lib/edumip_balance_ros/edumip_balance_ros __name:=edumip_balance_ros_node __log:=/home/ubuntu/.ros/log/a271dd92-14dc-11e8-b293-dc5360d671c6/edumip_balance_ros_node-1.log].
log file: /home/ubuntu/.ros/log/a271dd92-14dc-11e8-b293-dc5360d671c6/edumip_balance_ros_node-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done

The problem here is that your executable needs to run as “root”, not as a regular user, in order to access the BeagleBone hardware registers.

After you compile edumip_ros_balance, you can change the permissions of the executable to be owned by root (sudo chown root:root<filename>) and to have its sticky bit set (sudo chmod u+s <filename>) by running the following script:

~/catkin_ws/src/edumip_balance_ros/scripts/edumip_change_perms.sh

If you look at this shell script you will see that it runs these two commands:

sudo chown root:root ~/catkin_ws/devel/lib/edumip_balance_ros/edumip_balance_ros
sudo chmod u+s ~/catkin_ws/devel/lib/edumip_balance_ros/edumip_balance_ros

After you run this script (it will prompt you for your sudo password) the executable file’s ownership and group will be changed from ubuntu:ubuntu to  root:root, and its sticky bit will be set (permissions previously were “-rwxrwxr-x” and are now “-rwsrwxr-x”):

ubuntu@arm:~/catkin_ws$ ls -l devel/lib/edumip_balance_ros/
total 272
-rwsrwxr-x 1 root root 278292 Feb 18 18:48 edumip_balance_ros

Now when you run edumip_balance_ros, it should run normally, like the following:

ubuntu@arm:~$ roslaunch edumip_balance_ros edumip_balance_ros.launch 
... logging to /home/ubuntu/.ros/log/a271dd92-14dc-11e8-b293-dc5360d671c6/roslaunch-arm-2099.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://192.168.10.102:34253/

SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.12

NODES
 /
 edumip_balance_ros_node (edumip_balance_ros/edumip_balance_ros)

ROS_MASTER_URI=http://192.168.10.101:11311

process[edumip_balance_ros_node-1]: started with pid [2108]
[ INFO] [1518981653.978399507]: File /home/ubuntu/catkin_ws/src/edumip_balance_ros/src/edumip_balance_ros.cpp compiled on Feb 3 2018 19:38:02.
ERROR: pru-rproc driver missing
[ INFO] [1518981654.104574860]: Inner Loop controller D1:

order: 2
timestep dt: 0.0100
-4.9450z² + 8.8620z + -3.9670
--------------------------------
 1.0000z² + -1.4810z + 0.4812
[ INFO] [1518981654.107474727]: 
Outer Loop controller D2:

order: 2
timestep dt: 0.0100
 0.1886z² + -0.3721z + 0.1835
--------------------------------
 1.0000z² + -1.8605z + 0.8605
[ INFO] [1518981654.573431369]: 
Hold your MIP upright to begin balancing

 

 

ROS Can’t Find my ROS Package

If your ROS environment does not seem to recognize that you have new packages in your catkin_ws/src, try updating your rospack profile with the command “rospack profile”, and update your rosdep cache with the command “rosdep update”.

Compiling and Linking to the Robotics Cape “C” Libraries

The Robotics Cape library comes pre-installed on the Ubuntu 16.04 image available at the link provided earlier in this web page.    It was installed with the command “sudo apt-get install roboticscape”.

The robotics cape library and associated header files are already installed on your EduMIP. The link library is /usr/lib/libroboticscape.so, and the two top-level header files are rc_usefulincludes.h and roboticscape.h.

You can refer to the edumip_balance_ros project (https://git.lcsr.jhu.edu/lwhitco1/edumip_balance_ros) to see how to use the robotics cape C header files and C link library with your C++ ROS Node.

See edumip_balance_ros/src/edumip_balance_ros.cpp to see how to include the C header files in a C++ program with the extern “C” directive.

See edumip_balance_ros/CMakeLists.txt to see how to link your program to the roboticscape C library.

Edumip_balance_ros Package

EduMIP Horizontal Configuration

Several student teams have employed the EduMIP in a horizontal configuration with a caster wheel. To do this you will need to replace the “edumip_balance_ros” project with your own new code to command the wheel servos and to read and publish the wheel encoders. As I reviewed in class yesterday, one possible package you could use is the ROS differential_drive package (http://wiki.ros.org/differential_drive). To use the differential_drive package you will need to write a new C++ node for the edumip that (a) Reads the wheel encoders and publishes them on topics and (b) Subscribes to motor command topics and commands effort to the wheel motors.

Interfacing to Serial Port Devices

To interface your C++ code to a serial device such as the USB ultrasonic sensor demonstrated in class, you will need to be able to open, read, and write to the serial ports. A good package for this is the ROS serial package (http://wiki.ros.org/serial).

You can install it with “sudo apt-get install ros-kinetic-serial”.

A simple example is available here: https://github.com/garyservin/serial-example

You can clone a copy of the src into your ROS workspace with the command “git clone https://github.com/wjwwood/serial.git” and compile it with “catkin_make”. The “examples” directory has more complex examples of serial port usage with the “serial” package.

Note that this ros package named “serial” is NOT the package “rosserial”.  The “serial” package is a lightweight general purpose library for reading and writing to serial ports. The “rosserial” is a package for interfacing to small devices like the Arduino as ROS nodes.