提交 dd223b94 编写于 作者: C Calvin Miao

Merge branch 'master' of github.com:jinghaomiao/apollo into apollo_1.5

......@@ -209,7 +209,7 @@ function release() {
cp bazel-bin/modules/monitor/hwmonitor/hw/tools/esdcan_test_app $MODULES_DIR/monitor/hwmonitor/hw/tools/
fi
cp -r bazel-genfiles/* $LIB_DIR
# doc
cp -r docs $ROOT_DIR
cp LICENSE $ROOT_DIR
......@@ -272,7 +272,7 @@ function run_cpp_lint() {
}
function run_bash_lint() {
FILES=$(find "${DIR}" -type f -name "*.sh" | grep -v ros | grep -v kernel)
FILES=$(find "${APOLLO_ROOT_DIR}" -type f -name "*.sh" | grep -v ros | grep -v kernel)
echo "${FILES}" | xargs shellcheck
}
......@@ -313,6 +313,7 @@ function print_usage() {
buildify: fix style of BUILD files
check: run build/lint/test, please make sure it passes before checking in new code
clean: runs Bazel clean
config: run configurator tool
coverage: generate test coverage report
doc: generate doxygen document
lint: run code style check
......@@ -376,6 +377,10 @@ function build_gnss() {
rm -rf modules/devel_isolated/
}
function config() {
${APOLLO_ROOT_DIR}/scripts/configurator.sh
}
function main() {
source_apollo_base
apollo_check_system_config
......@@ -395,6 +400,9 @@ function main() {
buildgnss)
build_gnss
;;
config)
config
;;
doc)
gen_doc
;;
......
......@@ -14,10 +14,10 @@
* limitations under the License.
*****************************************************************************/
#include <stdio.h>
#include <termios.h>
#include <iostream>
#include <memory>
#include <stdio.h>
#include <termios.h>
#include <thread>
#include "ros/include/ros/ros.h"
......@@ -381,7 +381,7 @@ void signal_handler(int32_t signal_num) {
ros::shutdown();
}
} // end of namespace;
} // namespace
int main(int32_t argc, char** argv) {
google::InitGoogleLogging(argv[0]);
......
......@@ -14,7 +14,8 @@ package apollo.common;
message PointENU {
optional double x = 1 [default = nan]; // East from the origin, in meters.
optional double y = 2 [default = nan]; // North from the origin, in meters.
optional double z = 3 [default = 0.0]; // Up from the WGS-84 ellipsoid, in meters.
optional double z = 3 [default = 0.0]; // Up from the WGS-84 ellipsoid, in
// meters.
}
// A point in the global reference frame. Similar to PointENU, PointLLH allows
......
......@@ -11,9 +11,9 @@ message StreamStatus {
CONNECTED = 1;
}
optional Type ins_stream_type = 2 [default=DISCONNECTED];
optional Type rtk_stream_in_type = 3 [default=DISCONNECTED];
optional Type rtk_stream_out_type = 4 [default=DISCONNECTED];
optional Type ins_stream_type = 2 [default = DISCONNECTED];
optional Type rtk_stream_in_type = 3 [default = DISCONNECTED];
optional Type rtk_stream_out_type = 4 [default = DISCONNECTED];
}
message InsStatus {
......@@ -30,14 +30,14 @@ message InsStatus {
// Safe to use. The INS has fully converged.
GOOD = 2;
}
optional Type type = 2 [default=INVALID];
optional Type type = 2 [default = INVALID];
}
message GnssStatus {
optional apollo.common.Header header = 1;
optional bool solution_completed = 2 [default=false];
optional uint32 solution_status = 3 [default=0];
optional uint32 position_type = 4 [default=0];
optional bool solution_completed = 2 [default = false];
optional uint32 solution_status = 3 [default = 0];
optional uint32 position_type = 4 [default = 0];
// Number of satellites in position solution.
optional int32 num_sats = 5 [default=0];
optional int32 num_sats = 5 [default = 0];
}
......@@ -88,8 +88,7 @@ class Status {
bool operator!=(const Status& rh) const { return !(*this == rh); }
/**
* @brief returns the error message of the status, empty if the status is
* OK.
* @brief returns the error message of the status, empty if the status is OK.
* @returns the error message
*/
const std::string& error_message() const { return msg_; }
......
......@@ -41,8 +41,7 @@ namespace time {
/**
* @class Duration
* @brief the default Duration is of precision nanoseconds (1e-9
* seconds).
* @brief the default Duration is of precision nanoseconds (1e-9 seconds).
*/
using Duration = std::chrono::nanoseconds;
......@@ -66,8 +65,7 @@ using hours = std::chrono::hours;
/**
* @brief converts the input duration (nanos) to a 64 bit integer, with
* the unit specified by PrecisionDuration.
* @param duration the input duration that needs to be converted to
* integer.
* @param duration the input duration that needs to be converted to integer.
* @return an integer representing the duration in the specified unit.
*/
template <typename PrecisionDuration>
......@@ -78,8 +76,7 @@ int64_t AsInt64(const Duration &duration) {
/**
* @brief converts the input timestamp (nanos) to a 64 bit integer, with
* the unit specified by PrecisionDuration.
* @param timestamp the input timestamp that needs to be converted to
* integer.
* @param timestamp the input timestamp that needs to be converted to integer.
* @return an integer representing the timestamp in the specified unit.
*/
template <typename PrecisionDuration>
......@@ -109,8 +106,7 @@ inline double ToSecond(const Timestamp &timestamp) {
}
/**
* @brief converts the integer-represented timestamp to \class
* Timestamp.
* @brief converts the integer-represented timestamp to \class Timestamp.
* @return a Timestamp object.
*/
template <typename PrecisionDuration>
......
......@@ -11,9 +11,9 @@ message StreamStatus {
CONNECTED = 1;
}
optional Type ins_stream_type = 2 [default=DISCONNECTED];
optional Type rtk_stream_in_type = 3 [default=DISCONNECTED];
optional Type rtk_stream_out_type = 4 [default=DISCONNECTED];
optional Type ins_stream_type = 2 [default = DISCONNECTED];
optional Type rtk_stream_in_type = 3 [default = DISCONNECTED];
optional Type rtk_stream_out_type = 4 [default = DISCONNECTED];
}
message InsStatus {
......@@ -30,14 +30,14 @@ message InsStatus {
// Safe to use. The INS has fully converged.
GOOD = 2;
}
optional Type type = 2 [default=INVALID];
optional Type type = 2 [default = INVALID];
}
message GnssStatus {
optional apollo.common.Header header = 1;
optional bool solution_completed = 2 [default=false];
optional uint32 solution_status = 3 [default=0];
optional uint32 position_type = 4 [default=0];
optional bool solution_completed = 2 [default = false];
optional uint32 solution_status = 3 [default = 0];
optional uint32 position_type = 4 [default = 0];
// Number of satellites in position solution.
optional int32 num_sats = 5 [default=0];
optional int32 num_sats = 5 [default = 0];
}
......@@ -75,8 +75,8 @@ class Config(object):
"""
Get realpath from a path string in config.
Starting with '/' indicates an absolute path, otherwise it will be taken as a relative path
of the Apollo root.
Starting with '/' indicates an absolute path, otherwise it will be taken
as a relative path of the Apollo root.
"""
if path_str.startswith('/'):
return path_str
......
......@@ -42,6 +42,7 @@ class RosServiceApi(flask_restful.Resource):
@staticmethod
def execute_cmd(cmd_name):
"""Run ros command by sending GRPC requests and return HTTP response."""
ToolStatus = runtime_status_pb2.ToolStatus
channel = grpc.insecure_channel(gflags.FLAGS.hmi_ros_node_service)
stub = ros_node_pb2.HMIRosNodeStub(channel)
......@@ -54,8 +55,8 @@ class RosServiceApi(flask_restful.Resource):
# Update runtime status.
tool_status = status.get_tools()
if tool_status.playing_status != runtime_status_pb2.ToolStatus.PLAYING_NOT_READY:
tool_status.playing_status = runtime_status_pb2.ToolStatus.PLAYING_READY_TO_CHECK
if tool_status.playing_status != ToolStatus.PLAYING_NOT_READY:
tool_status.playing_status = ToolStatus.PLAYING_READY_TO_CHECK
elif cmd_name == 'start_auto_driving':
request = ros_node_pb2.ChangeDrivingModeRequest(
......@@ -63,8 +64,7 @@ class RosServiceApi(flask_restful.Resource):
response = stub.ChangeDrivingMode(request)
# Update runtime status.
status.get_tools(
).playing_status = runtime_status_pb2.ToolStatus.PLAYING
status.get_tools().playing_status = ToolStatus.PLAYING
else:
error_msg = 'RosServiceApi: Unknown command "{}"'.format(cmd_name)
glog.error(error_msg)
......
......@@ -45,6 +45,7 @@ class RuntimeStatus(object):
@classmethod
def reset(cls, check_playable_file=False):
"""Reset runtime status to start."""
ToolStatus = runtime_status_pb2.ToolStatus
cls.pb_singleton.Clear()
cls.pb_fingerprint = 0
cls.module_dict.clear()
......@@ -52,11 +53,11 @@ class RuntimeStatus(object):
tool_status = cls.get_tools()
if check_playable_file and cls.stat_playable_duration() > 0:
tool_status.recording_status = runtime_status_pb2.ToolStatus.RECORDING_FINISHED
tool_status.playing_status = runtime_status_pb2.ToolStatus.PLAYING_READY_TO_CHECK
tool_status.recording_status = ToolStatus.RECORDING_FINISHED
tool_status.playing_status = ToolStatus.PLAYING_READY_TO_CHECK
else:
tool_status.recording_status = runtime_status_pb2.ToolStatus.RECORDING_READY_TO_CHECK
tool_status.playing_status = runtime_status_pb2.ToolStatus.PLAYING_NOT_READY
tool_status.recording_status = ToolStatus.RECORDING_READY_TO_CHECK
tool_status.playing_status = ToolStatus.PLAYING_NOT_READY
cls._calculate()
@classmethod
......@@ -110,18 +111,15 @@ class RuntimeStatus(object):
cls._calculate()
new_fingerprint = hash(str(cls.pb_singleton))
if cls.pb_fingerprint != new_fingerprint:
flask_socketio.emit(
'new_status',
cls.status_json(),
broadcast=True,
namespace='/runtime_status')
flask_socketio.emit('new_status',
cls.status_json(),
broadcast=True,
namespace='/runtime_status')
cls.pb_fingerprint = new_fingerprint
@classmethod
def _calculate(cls):
"""Update runtime status fields which need to be calculated."""
conf_pb = config.Config.get_pb()
modules_and_hardware_ready = cls.are_all_modules_ready(
) and cls.are_all_hardware_ready()
cls._calculate_recording_status(modules_and_hardware_ready)
......@@ -153,7 +151,7 @@ class RuntimeStatus(object):
if os.path.exists(file_to_play):
with open(file_to_play, 'r') as f:
kFreq = 100
cls.playable_duration = sum([1 for line in f]) / kFreq
cls.playable_duration = sum([1 for _ in f]) / kFreq
else:
cls.playable_duration = 0
return cls.playable_duration
......@@ -168,7 +166,8 @@ class RuntimeStatus(object):
recording_status = tool_status.recording_status
if recording_status == CHECKING and modules_and_hardware_ready:
tool_status.recording_status = READY_TO_START
elif recording_status == READY_TO_START and not modules_and_hardware_ready:
elif recording_status == READY_TO_START and \
not modules_and_hardware_ready:
tool_status.recording_status = CHECKING
@classmethod
......@@ -181,17 +180,17 @@ class RuntimeStatus(object):
if tool_status.playing_status == ToolStatus.PLAYING_NOT_READY:
if tool_status.recording_status == ToolStatus.RECORDING_FINISHED:
if cls.playable_duration > 0:
tool_status.playing_status = ToolStatus.PLAYING_READY_TO_CHECK
tool_status.playing_status = \
ToolStatus.PLAYING_READY_TO_CHECK
else:
glog.info(
'RuntimeStatus::_calculate_playing_status: No file to play'
)
glog.info('RuntimeStatus::_calculate_playing_status: ' \
'No file to play')
elif (playing_status == ToolStatus.PLAYING_CHECKING and
modules_and_hardware_ready and tool_status.planning_ready):
tool_status.playing_status = ToolStatus.PLAYING_READY_TO_START
glog.info(
'RuntimeStatus::_calculate_playing_status: All modules/hardware are ready'
)
'RuntimeStatus::_calculate_playing_status: ' \
'All modules/hardware are ready')
elif playing_status == ToolStatus.PLAYING_READY_TO_START and not (
modules_and_hardware_ready and tool_status.planning_ready):
tool_status.playing_status = ToolStatus.PLAYING_CHECKING
......@@ -205,10 +204,12 @@ class RuntimeStatus(object):
tool_status = cls.get_tools()
if tool_status.recording_status == ToolStatus.RECORDING_READY_TO_CHECK:
tool_status.message = 'Before recording, you need to setup the system.'
tool_status.message = 'Before recording, you need to setup the ' \
'system.'
elif tool_status.recording_status == ToolStatus.RECORDING_CHECKING:
tool_status.message = 'Waiting for modules and hardware.'
elif tool_status.recording_status == ToolStatus.RECORDING_READY_TO_START:
elif tool_status.recording_status == \
ToolStatus.RECORDING_READY_TO_START:
tool_status.message = 'Now you are ready to record.'
elif (tool_status.recording_status == ToolStatus.RECORDING or
tool_status.playing_status == ToolStatus.PLAYING):
......@@ -217,8 +218,9 @@ class RuntimeStatus(object):
tool_status.message = str(cls._current_timestamp())
elif (tool_status.recording_status == ToolStatus.RECORDING_FINISHED and
tool_status.playing_status == ToolStatus.PLAYING_NOT_READY):
tool_status.message = 'The recorded data/log/garage.csv is invalid.<br/>' \
'Please fix, or simply try recording again by clicking "New".'
tool_status.message = 'The recorded data/log/garage.csv is ' \
'invalid.<br/>Please fix, or simply try ' \
'recording again by clicking "New".'
elif tool_status.playing_status == ToolStatus.PLAYING_CHECKING:
if tool_status.planning_ready:
tool_status.message = 'Waiting for modules and hardware.'
......@@ -229,9 +231,11 @@ class RuntimeStatus(object):
'Before playing, please setup the system.' \
.format(cls.playable_duration)
elif tool_status.playing_status == ToolStatus.PLAYING_READY_TO_START:
tool_status.message = 'Make sure the OPERATOR is ready! Now you are good to go.'
tool_status.message = 'Make sure the OPERATOR is ready! ' \
'Now you are good to go.'
else:
tool_status.message = 'Something goes wrong.<br/>Please record again or RESET ALL.'
tool_status.message = 'Something goes wrong.<br/>' \
'Please record again or RESET ALL.'
@classmethod
def _current_timestamp(cls):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册