Skip to content

Commit dc265a2

Browse files
authored
0.2.5 (#57)
0.2.5, final release before moving to 16.04 and Kinetic
1 parent c62a7bb commit dc265a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+4803
-680
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,16 @@ Please submit pull requests to the [devel branch](https://github.com/AutoRally/a
4545
* synaptic
4646
* arduino
4747
* python-termcolor
48+
49+
3. __Install MPPI Dependencies (only if you have a GPU and will run MPPI)__
50+
51+
The core idea behind MPPI is to sample thousands of trajectories really fast. This is accomplished by implementing the sampling step on a GPU, for which you will need CUDA. We also use an external library to load python's numpy zip archives (.npz files) into C++.
52+
53+
* [Install CUDA](https://developer.nvidia.com/cuda-downloads)
54+
* [Install CNPY](https://github.com/rogersce/cnpy)
4855

49-
3. __[Install](http://www.ros.org/install/) ros-indigo-desktop-full__
50-
4. __Install gtsam__
56+
4. __[Install](http://www.ros.org/install/) ros-indigo-desktop-full__
57+
5. __Install gtsam__
5158

5259
Follow the gtsam [Quick Start](https://bitbucket.org/gtborg/gtsam/) guide to clone and install the _develop_ branch of gtsam.
5360

@@ -146,6 +153,7 @@ More detailed explanations of the controllers and state estimator can be found o
146153
* [State estimator](https://github.com/AutoRally/autorally/wiki/State%20Estimator)
147154
* [Waypoint follower](https://github.com/AutoRally/autorally/wiki/Waypoint%20Following)
148155
* [Constant speed controller](https://github.com/AutoRally/autorally/wiki/Constant%20Speed)
156+
* [MPPI Controller](https://github.com/AutoRally/autorally/wiki/Model-Predictive-Path-Integral-Controller-(MPPI))
149157

150158
[Controlling the AutoRally platform](https://github.com/AutoRally/autorally/wiki/Controlling%20the%20AutoRally%20Platform) is a tutorial for how your own controller can control the AutoRally platform (in simulation or on hardware).
151159

autorally/CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Changelog for package autorally
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
0.2.5 (2017-07-03)
6+
------------------
7+
58
0.2.4 (2017-02-14)
69
------------------
710

autorally/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
-->
1717
<package>
1818
<name>autorally</name>
19-
<version>0.2.4</version>
19+
<version>0.2.5</version>
2020
<description>Autorally metapackage</description>
2121

2222
<author>Brian Goldfain</author>

autorally_control/CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Changelog for package autorally_control
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
0.2.5 (2017-07-03)
6+
------------------
7+
* Initial public MPPI release, tutorial is available on wiki
8+
* A few minor bug fixes and updates for c++11
9+
510
0.2.4 (2017-02-14)
611
------------------
712

autorally_control/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,28 @@ find_package(catkin REQUIRED COMPONENTS
1616
)
1717

1818
find_package(Boost 1.49.0 REQUIRED)
19-
find_package(Eigen3 REQUIRED)
19+
find_package(Eigen REQUIRED)
2020

2121
set(BUILD_FLAGS "-std=c++11 -Wuninitialized")
2222
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${BUILD_FLAGS}")
2323

24-
generate_dynamic_reconfigure_options(cfg/gpsWaypoint_params.cfg)
24+
generate_dynamic_reconfigure_options(cfg/gpsWaypoint_params.cfg
25+
cfg/PathIntegralParams.cfg)
2526

2627
catkin_package(
2728
DEPENDS Boost
2829
CATKIN-DEPENDS roscpp std_msgs geometry_msgs nav_msgs nodelet dynamic_reconfigure autorally_core autorally_msgs
2930
INCLUDE_DIRS include
31+
LIBRARIES autorally_plant param_getter
32+
3033
)
3134

3235
include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIR} ${Eigen3_INCLUDE_DIRS})
3336

3437
add_subdirectory(src/ConstantSpeedController)
3538
add_subdirectory(src/joystick)
3639
add_subdirectory(src/gpsWaypoint)
40+
add_subdirectory(src/path_integral)
3741

3842
install(DIRECTORY launch/
3943
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#! /usr/bin/env python
2+
3+
PACKAGE='autorally_control'
4+
import roslib
5+
roslib.load_manifest(PACKAGE)
6+
7+
from dynamic_reconfigure.parameter_generator_catkin import *
8+
9+
gen = ParameterGenerator()
10+
11+
# Name Type Level Description Default Min Max
12+
13+
gen.add("max_throttle", double_t, 0, "Maximum applied throttle", 0.5, 0.0, 1.0)
14+
gen.add("desired_speed", double_t, 0, "Speed Target for the MPPI controller", 6.0, 0.0, 25.0)
15+
gen.add("speed_coefficient", double_t, 0, "Weight for acheiving target velocity", 4.25, 0.0, 20.0)
16+
gen.add("track_coefficient", double_t, 0, "Weight for staying on the track", 100.0, 0, 500.0)
17+
gen.add("max_slip_angle", double_t, 0, "Maximum slip angle allowed", .75, 0.0, 3.14)
18+
gen.add("slip_penalty", double_t, 0, "Penalty for violating slip angle threshold", 500.0, 0, 1000.0)
19+
gen.add("crash_coefficient", double_t, 0, "Penalty for crashing", 10000, 0, 20000)
20+
gen.add("track_slop", double_t, 0, "Value for clipping track cost to zero.", 0, 0, .75)
21+
gen.add("steering_coeff", double_t, 0, "Steering Cost Coefficient", .1, 0, 1.0)
22+
gen.add("throttle_coeff", double_t, 0, "Throttle Cost Coefficient", .1, 0, 1.0)
23+
24+
exit(gen.generate(PACKAGE, "PathIntegral", "PathIntegralParams"))
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
/*
2+
* Software License Agreement (BSD License)
3+
* Copyright (c) 2013, Georgia Institute of Technology
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice, this
10+
* list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
*
15+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
19+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
*/
26+
/**********************************************
27+
* @file autorally_plant.h
28+
* @author Grady Williams <gradyrw@gmail.com>
29+
* @date May 24, 2017
30+
* @copyright 2017 Georgia Institute of Technology
31+
* @brief Class definition for AutorallyPlant class.
32+
***********************************************/
33+
34+
#ifndef AUTORALLY_PLANT_H_
35+
#define AUTORALLY_PLANT_H_
36+
37+
#include <ros/ros.h>
38+
39+
#include <nav_msgs/Odometry.h>
40+
#include <nav_msgs/Path.h>
41+
42+
#include <geometry_msgs/Quaternion.h>
43+
#include <geometry_msgs/PoseStamped.h>
44+
#include <geometry_msgs/Point.h>
45+
46+
#include <autorally_msgs/chassisCommand.h>
47+
#include <autorally_msgs/chassisState.h>
48+
#include <autorally_msgs/runstop.h>
49+
#include <autorally_msgs/pathIntegralStatus.h>
50+
51+
#include <eigen3/Eigen/Dense>
52+
53+
namespace autorally_control {
54+
55+
/**
56+
* @class AutorallyPlant autorally_plant.h
57+
* @brief Publishers and subscribers for the autorally control system.
58+
*
59+
* This class is treated as the plant for the MPPI controller. When the MPPI
60+
* controller has a control it sends to a function in this class to get
61+
* send to the actuators. Likewise it calls functions in this class to receive
62+
* state feedback. This class also publishes trajectory and spray information
63+
* and status information for both the controller and the OCS.
64+
*/
65+
66+
class AutorallyPlant //: public Diagnostics
67+
{
68+
public:
69+
static const int AUTORALLY_STATE_DIM = 7;
70+
//Struct for holding the autorally pose.
71+
typedef struct
72+
{
73+
//X-Y-Z position
74+
float x_pos;
75+
float y_pos;
76+
float z_pos;
77+
//1-2-3 Euler angles
78+
float roll;
79+
float pitch;
80+
float yaw;
81+
//Quaternions
82+
float q0;
83+
float q1;
84+
float q2;
85+
float q3;
86+
//X-Y-Z velocity.
87+
float x_vel;
88+
float y_vel;
89+
float z_vel;
90+
//Body frame velocity
91+
float u_x;
92+
float u_y;
93+
//Euler angle derivatives
94+
float yaw_mder;
95+
//Current servo commands
96+
float steering;
97+
float throttle;
98+
} FullState;
99+
100+
bool new_model_available_;
101+
102+
/**
103+
* @brief Constructor for AutorallyPlant, takes the a ros node handle and initalizes
104+
* publishers and subscribers.
105+
* @param mppi_node A ros node handle.
106+
*/
107+
AutorallyPlant(ros::NodeHandle mppi_node, bool debug_mode, int hz);
108+
109+
/**
110+
* @brief Destructor for AutorallyPlant.
111+
*/
112+
~AutorallyPlant();
113+
114+
/**
115+
* @brief Callback for /pose_estimate subscriber.
116+
*/
117+
void poseCall(nav_msgs::Odometry pose_msg);
118+
119+
/**
120+
* @brief Callback for recording the current servo input.
121+
*/
122+
void servoCall(autorally_msgs::chassisState servo_msg);
123+
124+
/**
125+
* @brief Callback for safe speed subscriber.
126+
*/
127+
void runstopCall(autorally_msgs::runstop safe_msg);
128+
129+
/**
130+
* @brief Publishes the controller's nominal path.
131+
*/
132+
void pubPath(float* nominal_traj, int num_timesteps, int hz);
133+
134+
/**
135+
* @brief Publishes a control input.
136+
* @param steering The steering command to publish.
137+
* @param throttle The throttle command to publish.
138+
*/
139+
void pubControl(float steering, float throttle);
140+
141+
void pubStatus();
142+
143+
/**
144+
* @brief Returns the current state of the system.
145+
*/
146+
FullState getState();
147+
148+
/**
149+
* @brief Returns whether or not the state updater has gone stale or not.
150+
*/
151+
bool getStale();
152+
153+
/**
154+
* @brief Returns the current value of safe speed.
155+
*/
156+
bool getRunstop();
157+
158+
/**
159+
* @brief Returns the timestamp of the last pose callback.
160+
*/
161+
ros::Time getLastPoseTime();
162+
163+
/**
164+
* @brief Checks the system status.
165+
* @return An integer specifying the status. 0 means the system is operating
166+
* nominally, 1 means something is wrong but no action needs to be taken,
167+
* 2 means that the vehicle should stop immediately.
168+
*/
169+
int checkStatus();
170+
171+
172+
std::vector<float> getModelParams();
173+
174+
private:
175+
const double TIMEOUT = 0.5; ///< Time before declaring pose/controls stale.
176+
177+
FullState full_state_; ///< Full state of the autorally vehicle.
178+
179+
int hz_; ///< The frequency of the control publisher.
180+
181+
int status_; ///< System status
182+
std::string ocs_msg_; ///< Message to send to the ocs.
183+
184+
bool safe_speed_zero_; ///< Current value of safe speed.
185+
bool debug_mode_; ///< Whether or not the system is in debug/simulation mode.
186+
bool activated_; ///< Whether or not we've received an initial pose message.
187+
188+
ros::Time last_check_; //Timestamp of the last published control.
189+
ros::Time last_pose_call_; ///< Timestamp of the last pose callback.
190+
191+
ros::Publisher control_pub_; ///< Publisher of autorally_msgs::chassisCommand type on topic servoCommand.
192+
ros::Publisher path_pub_; ///< Publisher of nav_mags::Path on topic nominalPath.
193+
ros::Publisher status_pub_; ///< Publishes the status (0 good, 1 neutral, 2 bad) of the controller
194+
ros::Publisher delay_pub_; ///< Publisher of geometry::msgs::Point on topic mppiTimeDelay.
195+
ros::Subscriber pose_sub_; ///< Subscriber to /pose_estimate.
196+
ros::Subscriber servo_sub_;
197+
198+
autorally_msgs::chassisCommand control_msg_; ///< Autorally control message initialization.
199+
nav_msgs::Path path_msg_; ///< Path message for publishing the planned path.
200+
geometry_msgs::Point time_delay_msg_; ///< Point message for publishing the observed delay.
201+
autorally_msgs::pathIntegralStatus status_msg_; ///<pathIntegralStatus message for publishing mppi status
202+
std::vector<float> model_params_; ///< Array for holding the updated model parameters
203+
204+
};
205+
206+
}
207+
208+
#endif /* AUTORALLY_PLANT_H_ */

0 commit comments

Comments
 (0)