Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPC GPS #81

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open

MPC GPS #81

wants to merge 52 commits into from

Conversation

thobotics
Copy link

This PR implement MPC Guided Policy Search, which described in [1].

Main contribution:

  1. gps_main.py is modified to make the agent able to run the MPC trajectory optimizer during sampling.
  2. mpc_traj_opt.py: implement the MPC algorithm to minimize the surrogate cost as in [1].
    Note that the policy cost term in surrogate cost will be replaced by the offline trajectory cost if you are using AlgorithmTrajOpt.
  3. Create mobile robot agent for experiment in src/gps_agent_pkg.

Experiment [1]:

  1. Launch file: mobilerobot_gps.launch with 3 worlds file (set by parameter): hallway.world, hallway_bend.world, one_obstacle.world.
  2. Experiment files:
    turtlebot_hallway_badmm_example: Trying to move the robot in hallway.
    turtlebot_badmm_example: Trying to move the robot at desired velocity while avoiding obstacle.

Note:

  1. Must using this version of stage_ros package (Check here).

[1] Tianhao Zhang, Gregory Kahn, Sergey Levine, Pieter Abbeel. Learning Deep Control Policies
for Autonomous Aerial Vehicles with MPC-Guided Policy Search. ICRA 2016.

Conflicts:
	python/tests/test_box2d/test_box2d.py
1. This MPC mission is follow offline trajectory.
2. Regularize Quu by small eta to make it PD.
3. When using raw cost, must adjust around sample, that the important
thing to make the gradient of cost work.
3. Still not sure about this MPC, because original MPC is running
online, meaning that x0=current_x (feedback state), and then minimize
the same cost function as offline trajectory with shorter horizon.
   On the other hand, when using this MPC on test phase, it seem we
just need to find current_x belong to which MPC (at time t), and
then call MPC[m].act(...), NO OPTIMIZATION OCCUR AT RUNTIME ????
When compute gradient of cost using feedback state x0 for all
t in short horizon.
TODO: Anwser why the policy too far from trajectory at iteration > 10?
It happened to all point mass world (arm world a little bit).
This inhedrit and modified to adapt with robotplugin.cpp in gps_agent_pkg.
Use min_distance_to_obstacle from turtlebot_mpepc to measure nearest obstacle.
RESULT: It already can move robot in desired velocity and orientation, but can
not avoid obstacle.
TODO: move updateObstacleTree to another node like costmap_server in Matt Derry
original package.
      Check about thresh in min_distance_to_obstacle and the dsafe in hyperparams.
…admm

QUESTION: Why pol_wt (nu) need to scaled using median like tgt_mu in policy_opt_caffe?
RESULT: Still working on it ... (Tried MPC_GPS weighted, then PLATO)
@cbfinn
Copy link
Owner

cbfinn commented Apr 7, 2017

Thanks for the PR thobotics! @TZ2016 will take the first pass at reviewing.

Glancing over the PR, please make sure that you remove commented out code and remove unneeded changes to parts of the code that MPCGPS does not use.

@cbfinn cbfinn assigned cbfinn and unassigned cbfinn Apr 7, 2017
@tcjcxy30
Copy link

tcjcxy30 commented Oct 4, 2018

Hi:
@thobotics , your mpc-gps can not compile with the error:
/usr/bin/ld: /usr/lib/libvtkWrappingTools-6.2.a(vtkParse.tab.c.o): relocation R_X86_64_32S against '.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/libvtkWrappingTools-6.2.a(vtkParse.tab.c.o): error adding symbols: Bad value collect2: error: ld returned 1 exit status
CMakeFiles/gps_agent_lib.dir/build.make:2527: recipe for target 'lib/libgps_agent_lib.so' failed
make[2]: *** [lib/libgps_agent_lib.so] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/gps_agent_lib.dir/all' failed
make[1]: *** [CMakeFiles/gps_agent_lib.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

I think the reason is that the libvtkWrappingTools-6.2.a is a static link library so I try to add some code in CMakeLists.txt to fix the -fPIC problem like:

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")

but I still get the same error above. I can compile the master branch of gps normally, so how can I fix this compiled error?
My vtk 6.2.0 is installed from source and set the build_share_lib to ON but the libvtkWrappingTools-6.2.a is a static link library.
Thankyou very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants