mirror of
https://github.com/westonrobot/ugv_sdk
synced 2023-04-08 06:32:14 +08:00
updated ci, updated hunter set brake mode impl
This commit is contained in:
10
.github/workflows/ros-ci.yml
vendored
10
.github/workflows/ros-ci.yml
vendored
@@ -6,9 +6,9 @@ name: ROS
|
||||
# events but only for the master branch
|
||||
on:
|
||||
push:
|
||||
branches: [ master, v2.x ]
|
||||
branches: [ next ]
|
||||
pull_request:
|
||||
branches: [ master, v2.x ]
|
||||
branches: [ next ]
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
@@ -21,11 +21,11 @@ jobs:
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
# - name: Install dependencies
|
||||
# run: sudo apt-get update && sudo apt-get install -y libasio-dev
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y libasio-dev
|
||||
- name: Create catkin workspace
|
||||
run: mkdir -p /catkin_ws/src && cd /catkin_ws/src && /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin_init_workspace"
|
||||
- name: Copy code to catkin workspace
|
||||
run: cd /catkin_ws/src && git clone https://github.com/westonrobot/async_port.git && git clone -b v2.x https://github.com/westonrobot/ugv_sdk.git
|
||||
run: cd /catkin_ws/src && git clone -b next https://github.com/westonrobot/ugv_sdk.git
|
||||
- name: Run catkin_make
|
||||
run: cd /catkin_ws && /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin_make"
|
||||
|
||||
12
.github/workflows/standalone-ci.yml
vendored
12
.github/workflows/standalone-ci.yml
vendored
@@ -2,9 +2,9 @@ name: Cpp
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, v2.x ]
|
||||
branches: [ next ]
|
||||
pull_request:
|
||||
branches: [ master, v2.x ]
|
||||
branches: [ next ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -13,11 +13,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
# - name: Install dependencies
|
||||
# run: sudo apt-get install -y build-essential cmake libasio-dev
|
||||
- name: Build and install dependent package
|
||||
run: git clone https://github.com/westonrobot/async_port.git && cd async_port && mkdir build && cd build && cmake .. && make && sudo make install
|
||||
- name: Update git submodule
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install -y build-essential cmake libasio-dev
|
||||
- name: Build and pack
|
||||
run: mkdir build && cd build && cmake -DBUILD_TESTS=ON .. && cmake --build . && cpack
|
||||
|
||||
@@ -39,7 +39,8 @@ struct HunterInterface {
|
||||
|
||||
virtual void SetMotionCommand(double linear_vel, double steering_angle) = 0;
|
||||
|
||||
virtual void SetBrakeMode(BrakeMode mode) = 0;
|
||||
virtual void ActivateBrake() = 0;
|
||||
virtual void ReleaseBrake() = 0;
|
||||
|
||||
// get robot state
|
||||
virtual HunterCoreState GetRobotState() = 0;
|
||||
|
||||
@@ -64,6 +64,8 @@ class RobotCommonInterface {
|
||||
/****** functions not available/valid to all robots ******/
|
||||
// functions to be implemented by class AgilexBase
|
||||
virtual void SetMotionMode(uint8_t mode){};
|
||||
virtual void SetBrakedMode(BrakeMode mode){};
|
||||
|
||||
virtual CoreStateMsgGroup GetRobotCoreStateMsgGroup() {
|
||||
throw std::runtime_error(
|
||||
"Only a derived version of this function with actual implementation "
|
||||
@@ -93,8 +95,6 @@ class RobotCommonInterface {
|
||||
"Only a derived version of this function with actual implementation "
|
||||
"is supposed to be used.");
|
||||
};
|
||||
|
||||
virtual void EnableBrakeMode(BrakeMode mode){};
|
||||
};
|
||||
} // namespace westonrobot
|
||||
|
||||
|
||||
@@ -190,6 +190,17 @@ class AgilexBase : public RobotCommonInterface {
|
||||
if (can_connected_) can_->StopService();
|
||||
}
|
||||
|
||||
void SetBrakeMode(BrakeMode mode) {
|
||||
// construct message
|
||||
AgxMessage msg;
|
||||
msg.type = AgxMsgBrakeModeConfig;
|
||||
msg.body.brake_mode_config_msg.mode = mode;
|
||||
|
||||
// encode msg to can frame and send to bus
|
||||
can_frame frame;
|
||||
if (parser_.EncodeMessage(&msg, &frame)) can_->SendFrame(frame);
|
||||
}
|
||||
|
||||
void ParseCANFrame(can_frame *rx_frame) {
|
||||
AgxMessage status_msg;
|
||||
if (parser_.DecodeMessage(rx_frame, &status_msg)) {
|
||||
@@ -268,17 +279,6 @@ class AgilexBase : public RobotCommonInterface {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void EnableBrakedMode(BrakeMode mode) {
|
||||
// construct message
|
||||
AgxMessage msg;
|
||||
msg.type = AgxMsgBrakeModeConfig;
|
||||
msg.body.brake_mode_config_msg.mode = mode;
|
||||
|
||||
// encode msg to can frame and send to bus
|
||||
can_frame frame;
|
||||
if (parser_.EncodeMessage(&msg, &frame)) can_->SendFrame(frame);
|
||||
}
|
||||
};
|
||||
} // namespace westonrobot
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ class HunterBase : public AgilexBase<ParserType>, public HunterInterface {
|
||||
angular_vel);
|
||||
}
|
||||
|
||||
|
||||
// get robot state
|
||||
HunterCoreState GetRobotState() override {
|
||||
auto state = AgilexBase<ParserType>::GetRobotCoreStateMsgGroup();
|
||||
@@ -62,8 +61,12 @@ class HunterBase : public AgilexBase<ParserType>, public HunterInterface {
|
||||
return hunter_actuator;
|
||||
}
|
||||
|
||||
void SetBrakeMode(BrakeMode mode) override{
|
||||
AgilexBase<ParserType>::EnableBrakeMode(mode);
|
||||
void ActivateBrake() override {
|
||||
AgilexBase<ParserType>::SetBrakeMode(BrakeMode::BRAKE_MODE_LOCK);
|
||||
}
|
||||
|
||||
void ReleaseBrake() override {
|
||||
AgilexBase<ParserType>::SetBrakeMode(BrakeMode::BRAKE_MODE_UNLOCK);
|
||||
}
|
||||
};
|
||||
} // namespace westonrobot
|
||||
|
||||
@@ -25,7 +25,8 @@ class HunterRobot : public RobotCommonInterface, public HunterInterface {
|
||||
|
||||
void EnableCommandedMode() override;
|
||||
|
||||
void SetBrakeMode(BrakeMode mode) override;
|
||||
void ActivateBrake() override;
|
||||
void ReleaseBrake() override;
|
||||
|
||||
void SetMotionCommand(double linear_vel, double angular_vel) override;
|
||||
|
||||
|
||||
@@ -38,9 +38,14 @@ void HunterRobot::SetMotionCommand(double linear_vel, double angular_vel) {
|
||||
hunter->SetMotionCommand(linear_vel, angular_vel);
|
||||
}
|
||||
|
||||
void HunterRobot::SetBrakeMode(BrakeMode mode) {
|
||||
void HunterRobot::ActivateBrake() {
|
||||
auto hunter = dynamic_cast<HunterInterface*>(robot_);
|
||||
hunter->SetBrakeMode(mode);
|
||||
hunter->ActivateBrake();
|
||||
}
|
||||
|
||||
void HunterRobot::ReleaseBrake() {
|
||||
auto hunter = dynamic_cast<HunterInterface*>(robot_);
|
||||
hunter->ReleaseBrake();
|
||||
}
|
||||
|
||||
HunterCoreState HunterRobot::GetRobotState() {
|
||||
|
||||
Reference in New Issue
Block a user