Git Product home page Git Product logo

bobble_controllers's Introduction

Bobble-Bot Simulator

Follow the Bobble-Bot project on Hackaday

Bobble-Bot is a modern take on a classical problem in control theory. The robot represents a unique solution to the well understood problem of control of a two wheeled inverted pendulum. The source code found in this repository constitutes the robot's balance control logic. The controller comes with a handy Gazebo simulation which was used extensively during the development of the robot. The source code is being provided as open-source software in order to help others learn about feedback control and the Robot Operating System (ROS).

Impulse Response

To get started, follow the installation instructions, or if you're more of the DIY type, build the simulation from source and learn how to build your own Bobble-Bot.

Debian Install

Beware this section is still in development.

For now, please follow the instructions to build the simulation from source.

Bobble-Bot on Windows

Bobble-Bot now works on Windows thanks to the Windows Subsystem for Linux (WSL)! If you'd like to work with Bobble-Bot on Windows, follow these instructions first. Once you've completed the basic WSL setup, you can proceed to the instructions in the build the simulation from source section.

Build from source

The BobbleBot simulator requires ROS and Gazebo. Follow the instructions here and install ROS Melodic Desktop Full. Other versions of ROS should also work, but they are not officially supported at this time. The simulator also makes use of the Hector Gazebo plugins. Those can be installed using the command below.

sudo apt-get install ros-melodic-hector-gazebo-plugins
pip install seaborn rosbag_pandas

Before starting the build process, make sure your ROS environment is active.

source /opt/ros/melodic/setup.bash

Get the code and build it using catkin.

mkdir -p ~/bobble_workspace/src
cd ~/bobble_workspace/src
catkin_init_workspace
git clone https://github.com/super-owesome/bobble_controllers.git
git clone https://github.com/super-owesome/bobble_description.git
cd .. ; catkin_make
source devel/setup.bash

The BobbleBot controller package comes with a set of automated tests. If you're doing development on the BobbleBot simulator you are expected to ensure that these tests continue to pass. To run these tests, use the command below.

catkin_make run_tests_bobble_controllers -j1

The simulation should now be ready to run. Decide if you want to run using Keyboard Control or Joystick Control. Please create an issue if you encountered any problems performing the steps above.

Keyboard Control

Launch the simulation.

roslaunch bobble_controllers run_sim.launch gui:=true

In a separate terminal (with the ROS environment sourced) launch the keyboard control node.

source devel/setup.bash
rosrun bobble_controllers KeyboardControl

The controls are summarized below. The terminal used to launch the keyboard control node must have the active focus. Hit space-bar to activate the balance controller.

BobbleBot Keyboard Controller
---------------------------
Activate/Deactivate command:
    Activate/Shutdown: space bar
Moving around:
    Forward : w
    Backward : s
    Left : a
    Right : d
Speed Up/Down: 
    15% Increase: q
    15% Decrease: e
CTRL-C to quit

Joystick Control

The bobble_controllers package comes with a Joystick control node that is defaulted with a mapping that is suitable for an Xbox 1 controller. To use joystick control, follow these instructions to setup your Xbox 1 controller. Next, make sure you have the ROS joy package installed. With those two steps out of the way, you can then launch the simulator using the command below.

source devel/setup.bash
roslaunch bobble_controllers run_sim_with_joystick.launch gui:=true

The default controls are depicted below:

Joystick Controls

Analyzing Simulation Data

This repository also comes with some sample Python scripts and Jupyter notebooks that show how to use Pandas to analyze output data from the simulation. Using the gazebo-ros packages, one can log data as the simulator runs and store it in a ROS bag format. The steps below provide an example of how this is done.

First, we need to generate some data to analyze. The "apply_impulse_force" launch file is a good one to start with. Let's apply an impulse to Bobble-Bot in the -X direction and see how the balance controller holds up.

source devel/setup.bash
roslaunch bobble_controllers apply_impulse_force.launch gui:=true impulse:=-1000 out_file:=~/bobble_workspace/src/bobble_controllers/analysis/impulse_test

If all goes well, the Gazebo simulation should launch and you should see Bobble-Bot hold its balance in spite of the applied impulse. After the test completes, you should see a newly created impulse_test.bag file in the bobble_controllers/analysis directory. Let's analyze the data in this bag file.

cd src/bobble_controllers/analysis
python make_plots.py --run impulse_test.bag

The script above uses the analysis_tools Python module defined in this repository to load the data and make the plots. After running the make_plots.py script above, you should see that two images were created: 'TiltControl.png' & 'VelocityControl.png'. They should look something like the following:

Tilt Control Velocity Control

Try changing the gains in config/bobble_sim_balance_control.yaml and then repeating the steps above to generate and analyze new data. Testing and analyzing your changes against an applied impulse force is a good practice. The apply impulse launch file and analysis_tools module are part of the automated tests that are run against the bobble_controllers ROS package. This is how we ensure the controller remains in a working state.

Docker Setup

A Bobble-Bot simulation Docker image is available over on Docker Hub. If you do not know what Docker is, we highly suggest checking it out. Docker can be used to quickly experiment with the simulation without polluting your system with additional packages. See this page to get started. This particular image relies on nvidia-docker2. For now, an NVidia GPU is required if you want to run the graphics from within the container. If you only care about running the simulation headless (no graphics), then Docker is the only requirement.

Run the simulation with graphics from within a container (master branch version of sim).

docker pull superowesome/bobble-sim:stable
cd ~/bobble_workspace/src
git clone https://github.com/super-owesome/bobble_docker.git
cd bobble_docker
./run_bobble_sim.bash

Enable keyboard control (in a separate terminal).

./run_keyboard_control.bash

Run the simulation headless from within a container (master branch version of sim).

./run_apply_impulse.bash

Note that the run_apply_impulse.bash script mounts the bobble_docker folder into the container and then directs the apply_impulse launch file to write the output data to that folder. This is a useful script for generating some sample data for analysis.

Use the bash script below to launch a container intended for building the simulation from source. This is a useful container for development.

./run_dev_container.bash

This container mounts the bobble_workspace folder in your host machine's home directory to /bobble_src in the container and then gives the user an interactive bash shell. This shell can then be used to build and run the simulation from within a container. We recommended that you use your favorite desktop editor to make code modifications, and then just use the container to build and launch the simulation. Execute commands like the following inside the container to rebuild the sim from source and run it.

cd /bobble_src
catkin config --install
catkin init
catkin build
source install/setup.bash
roslaunch bobble_controllers apply_impulse_force.launch gui:=true

You can now freely edit the files on your host machine and simply re-run catkin build and roslaunch commands at will.

Build Your Own

Vote Bobble-Bot for the Hackaday Prize 2019

Even more details for hobbyists and DIY types can be found on our hackaday project page. Check it out!

bobble_controllers's People

Contributors

mike-moore avatar jjholleysoe avatar thegoatman7 avatar mikepantz avatar dennis-moore avatar

Stargazers

 avatar xuanyuChen avatar Diogo Martins avatar Serhan Argun avatar  avatar lukas_kai avatar Jack_Lee avatar Chandan Sinha avatar Pranav Prabha avatar zhengyun avatar  avatar SouthRiver avatar Yin Yi avatar Sébastien Randoux avatar Lantern Master  avatar Chris Csikszentmihalyi avatar Abhijeet Tripathy avatar Andrii Vasyliev avatar Dohyeong Kim avatar Bayram Kızılkaya avatar Anirudh Swaminathan avatar  avatar Roberto Zegers R. avatar John Ericksen avatar  avatar Sreejith Sasidharan avatar Vaibhav Nandkumar Kadam avatar sheng avatar  avatar Michael C avatar  avatar Mike Chung avatar Ewen BRUN avatar Shiqi Lin avatar Unbinilium avatar Salah Missri avatar  avatar  avatar Chris Lidyard avatar  avatar Photon avatar  avatar Emanuel avatar 飞 avatar Jeremy avatar Jianwei Liu avatar Karthik Ram avatar Abid Ramay avatar Michael avatar David Hogan avatar Cade Parkison avatar Behzad Samadi avatar Nikita Ermolenko avatar Benoni Jiang avatar dsl avatar  avatar Ramses Garate avatar Richard Osterloh avatar Ramon Wijnands avatar Axel Mousset avatar Matt Murray avatar Steffen P avatar

Watchers

James Cloos avatar zhang peng avatar  avatar  avatar  avatar

bobble_controllers's Issues

Install script

This issue will track the work done to create a handy simulation install script for Ubuntu users.

Bobble-Bot Basic Navigation

Help Bobble-Bot Navigate

Let's help Bobble-Bot better understand where he's at and where he's going! This issue will track development effort required to get Bobble-Bot publishing the ROS standard odometry message. This is an important first step towards integrating with ROS libraries that can assist with SLAM.

pf-ros_gazebo03

Detailed Description

We'd like to update Bobble-Bot to support publishing the ROS standard navigation message responsible for reporting the robot's odometry. The standard message is defined here. We believe the BalanceBaseController is the appropriate class to add this capability to.

Additional References

Got Questions?

Ask below via comment, or join our Discord server to chat with fellow contributors!

Real-Sense Integration

Demonstrate Intel Real-Sense for Bobble-Bot

Let's give Bobble-Bot vision! This issue will track development effort to integrate the Intel RealSense ROS driver and provide a user's guide to running with the module in the simulation.

ezgif com-gif-maker

Detailed Description

Our product road map includes integration with the Intel RealSense. Intel provides a ROS driver that we believe is most appropriate for our application.

image

We'd like to integrate this driver with Bobble-Bot's simulation software stack and demonstrate how it all works together via a user's guide. Follow-on issues will involve writing computer vision algorithms to use the sensed data to help localize Bobble-Bot within a simulated environment.

Dependencies

We suggest these libraries to get going quickly.

Launch Steps

The steps to launch should be something like the following:

roslaunch bobble_controllers run_sim_with_joystick.launch
roslaunch bobble_tf_broadcaster bobble_transform_broadcaster.launch
roslaunch realsense_gazebo_plugin depth_proc.launch
rviz

Once we have a good working demonstration, we'll want to condense the commands below into a single convenient launch file that runs the demonstration.

Update README and/or docs

We'll require a short markdown tutorial/write-up to document the effort and close the issue.

Got Questions?

Ask below via comment, or join our Discord server to chat with fellow contributors!

Updating ModelState: model [bobblebot] does not exist

I followed the installation instructions but ran into the following problem:

Base path: /home/user/bobble_workspace
Source space: /home/user/bobble_workspace/src
Build space: /home/user/bobble_workspace/build
Devel space: /home/user/bobble_workspace/devel
Install space: /home/user/bobble_workspace/install

Running command: "make cmake_check_build_system" in "/home/user/bobble_workspace/build"

Running command: "make run_tests_bobble_controllers -j1" in "/home/user/bobble_workspace/build"

[ 33%] Built target gtest
[ 66%] Built target balance_controller_test
-- run_tests.py: execute commands
/opt/ros/melodic/share/rostest/cmake/../../../bin/rostest --pkgdir=/home/user/bobble_workspace/src/bobble_controllers --package=bobble_controllers --results-filename test_balance_controller.xml --results-base-dir "/home/user/bobble_workspace/build/test_results" /home/user/bobble_workspace/src/bobble_controllers/test/balance_controller.test
... logging to /home/user/.ros/log/rostest-user-Lenovo-Y50-70-28126.log
[ROSUNIT] Outputting test results to /home/user/bobble_workspace/build/test_results/bobble_controllers/rostest-test_balance_controller.xml
[ INFO] [1565709476.487973763]: Subscribing to /bobble/bobble_balance_controller/bb_controller_status
[INFO] [1565709476.788842, 0.000000]: Controller Spawner: Waiting for service controller_manager/load_controller
[ INFO] [1565709477.102629199]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1565709477.103599782]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[INFO] [1565709477.174717, 0.000000]: Loading model XML from ros parameter robot_description
[INFO] [1565709477.178597, 0.000000]: Waiting for service /gazebo/spawn_urdf_model
[ERROR] [1565709477.871837595, 0.006000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.873605406, 0.008000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.875262115, 0.009000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.877838012, 0.012000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.880885843, 0.014000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.884248511, 0.018000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.886070658, 0.019000000]: Updating ModelState: model [bobblebot] does not exist
[ INFO] [1565709477.888727992, 0.022000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ERROR] [1565709477.890309416, 0.023000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.894004270, 0.027000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.897295487, 0.030000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.900844066, 0.033000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.903154240, 0.036000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.905888533, 0.038000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.908063637, 0.040000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.910344974, 0.043000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.912870441, 0.045000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.916279688, 0.048000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.919585573, 0.051000000]: Updating ModelState: model [bobblebot] does not exist
[ INFO] [1565709477.922360189, 0.054000000]: Physics dynamic reconfigure ready.
[ERROR] [1565709477.922894625, 0.055000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.924439998, 0.056000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.926108772, 0.058000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.927796207, 0.059000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.930276928, 0.062000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.932191335, 0.064000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.933630357, 0.065000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.934932892, 0.066000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.938926326, 0.070000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.940398535, 0.072000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.943083050, 0.074000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.946175220, 0.077000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.949048362, 0.080000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.951234362, 0.082000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.954391467, 0.085000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.956282847, 0.087000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.959081009, 0.090000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.961161063, 0.092000000]: Updating ModelState: model [bobblebot] does not exist
[ERROR] [1565709477.964517452, 0.094000000]: Updating ModelState: model [bobblebot] does not exist

I don't have time to debug it now, but I thought I'd let you know.

Debian package install

This issue will track the work to package the Bobble sim as a debian package. Goal is to get to a point where Bobble-Bot sim can be apt-get installed.

RT-Linux distribution

Will you please tell me what RT-Linux distribution you are using for the pi with a link if possible.
Thank you

ImportError: No module named 'analysis_tools'

Traceback (most recent call last):
File "make_plots.py", line 54, in
main()
File "make_plots.py", line 49, in main
df, pc = load_data(args.run, run_name)
File "make_plots.py", line 12, in load_data
from analysis_tools.parsing import parse_single_run
ImportError: No module named 'analysis_tools'

Gazebo simulation

The bot isn't spawned in the gazebo virtual environment. Help if the project is still maintained.
System environments:
OS: Ubuntu 20.04 LTS
ROS version: noetic
Gazebo version: 11.11.0

Gazebo Simulation

Hello, I'm trying to run simulation in gazebo, but something went wrong and I don't know how to fix it.
Here are some pictures:
this is the result of command
roslaunch bobble_controllers run_sim.launch gui:=true
sendpix0
Here we can find that the model had been loaded in gazebo
sendpix1
This is the result of command
rosrun bobble_controllers KeyboardControl
sendpix2
And I found the message had been send correctly by using command
rostopic echo /bobble/bobble_balance_controller/cmd_vel
sendpix3
So, in my opinion, I think the problem might be in the
run_sim.launch
But unfortunately I'm a fresh man to use gazebo, I don't know how to fix it:(

Bobble-Bot Cloud

Bobble On, Bobble-Bot... in the Cloud!

Let's get the Bobble sim running in the cloud. There are many potential applications, but this issue is for tracking work done to demonstrate the basic functionality. We'll use this issue to generate some documentation that shows how to get the Bobble sim running in a user's cloud environment of choice. Follow-on issues could include distributed simulation and machine learning!

BobbleKeyboard

Potential Cloud Environments

We're open to ideas here! Here's some possible options that we've considered so far.

Got Questions?

Ask below via comment, or join our Discord server to chat with fellow contributors!

PidControl::getOutput() calls mismatch definition

Hi,

I have just noticed a minor bug into your PID controller. The first argument of you PID processing function double PidControl::getOutput(double actual, double setpoint) , represents the monitored value and the second one represents the target value.

However, when this function is called by BobbleBalanceController.cpp , it is used like this:
DesiredTilt = VelocityControlPID.getOutput(DesiredVelocity, ForwardVelocity);
TiltEffort = TiltControlPID.getOutput(DesiredTilt, Tilt);
HeadingEffort = TurningControlPID.getOutput(DesiredTurnRate, TurnRate);

From what I understand DesiredVelocity is your target and ForwardVelocity your estimated value, which are inverted regarding your function definition. You might have also a sign reversal somewhere else.

Nice project btw.

Matt

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.