-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from westonrobot/feature-v1.3.0
sample: update to wrp_sdk v1.3.0
- Loading branch information
Showing
6 changed files
with
118 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ on: | |
- "**" | ||
|
||
env: | ||
VERSION: "1.2.*" | ||
VERSION: "1.3.*" | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ on: | |
- 'main' | ||
|
||
env: | ||
TAG_VERSION: "1.2.x" | ||
TAG_VERSION: "1.3.x" | ||
|
||
jobs: | ||
tag-release: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
add_executable(sample_handshake_demo handshake_demo.cpp) | ||
target_link_libraries(sample_handshake_demo westonrobot::wrp_sdk) | ||
target_link_libraries(sample_handshake_demo westonrobot::wrp_sdk_robot) | ||
|
||
add_executable(sample_mobilebase_demo mobilebase_demo.cpp) | ||
target_link_libraries(sample_mobilebase_demo westonrobot::wrp_sdk) | ||
target_link_libraries(sample_mobilebase_demo westonrobot::wrp_sdk_robot) | ||
|
||
add_executable(sample_agilex_v2_robot_demo agilex_v2_robot_demo.cpp) | ||
target_link_libraries(sample_agilex_v2_robot_demo westonrobot::wrp_sdk) | ||
target_link_libraries(sample_agilex_v2_robot_demo westonrobot::wrp_sdk_robot) | ||
|
||
add_executable(sample_robooterx_wheelchair_demo robooterx_wheelchair_demo.cpp) | ||
target_link_libraries(sample_robooterx_wheelchair_demo westonrobot::wrp_sdk_robot) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/** | ||
* @file robooterx_wheelchair_demo.cpp | ||
* @brief Robooterx Wheelchair API usage demo | ||
* @date 03-05-2024 | ||
* | ||
* Demo showing the Robooterx Wheelchair running Robooterx's protocol API. | ||
* | ||
* @copyright Copyright (c) 2024 Weston Robot Pte. Ltd. | ||
*/ | ||
|
||
#include <unistd.h> | ||
|
||
#include <iomanip> | ||
#include <sstream> | ||
#include <iostream> | ||
|
||
#include "wrp_sdk/mobile_base/bangbang/robooterx_base_adapter.hpp" | ||
|
||
int main(int argc, char const *argv[]) { | ||
std::string device_name; | ||
|
||
if (argc == 2) { | ||
device_name = {argv[1]}; | ||
std::cout << "Specified CAN: " << device_name << std::endl; | ||
} else { | ||
std::cout << "Usage: sample_robooterx_wheelchair_demo <interface>" | ||
<< std::endl | ||
<< "Example 1: ./sample_robooterx_wheelchair_demo can0" | ||
<< std::endl; | ||
return -1; | ||
} | ||
|
||
westonrobot::RobooterXBaseAdapter base; | ||
base.Connect(device_name); | ||
|
||
if (base.RequestControl(500) != | ||
westonrobot::HandshakeReturnCode::kControlAcquired) { | ||
std::cout << "Failed to gain control" << std::endl; | ||
return -1; | ||
} | ||
|
||
while (true) { | ||
std::cout << "Checking robot base status..." << std::endl; | ||
if (base.IsRobotBaseAlive()) { | ||
std::cout << "Robot base is alive." << std::endl; | ||
} else { | ||
std::cout << "Robot base is not alive." << std::endl; | ||
} | ||
|
||
if (base.SdkHasControlToken()) { | ||
std::cout << "Control is acquired." << std::endl; | ||
} else { | ||
std::cout << "Control is not acquired." << std::endl; | ||
} | ||
|
||
westonrobot::RcState rc_state = base.GetRcState(); | ||
std::cout << "RC channel state: " << std::endl; | ||
std::cout << " Axis 1 (Horizontal): " << rc_state.axes[0] << std::endl; | ||
std::cout << " Axis 2 (Vertical):" << rc_state.axes[1] << std::endl; | ||
std::cout << " Button 1 (Newbie mode): " << rc_state.buttons[0] | ||
<< std::endl; | ||
|
||
westonrobot::MotionState motion_state = base.GetMotionState(); | ||
std::cout << "Beginner mode enabled: " << motion_state.assisted_mode_enabled | ||
<< std::endl; | ||
|
||
westonrobot::Odometry odom = base.GetOdometry(); | ||
std::cout << "Odometry: " << std::endl; | ||
std::cout << " Linear X: " << odom.linear.x << " m/s" << std::endl; | ||
std::cout << " Angular Z: " << odom.angular.z << " rad/s" << std::endl; | ||
|
||
westonrobot::SystemState system_state = base.GetSystemState(); | ||
std::cout << "Base state: " << std::endl; | ||
std::cout << " Operational State: " | ||
<< static_cast<int>(system_state.operational_state) << std::endl; | ||
std::cout << " Control State: " | ||
<< static_cast<int>(system_state.control_state) << std::endl; | ||
|
||
westonrobot::BatteryState bms_data = base.GetBatteryState(); | ||
std::cout << "BMS: " << std::endl; | ||
std::cout << " SOC: " << bms_data.percentage << "%" << std::endl; | ||
|
||
std::cout << "Controlling robot base..." << std::endl; | ||
|
||
static int mode = 1; | ||
base.SetMotionMode(static_cast<westonrobot::MotionMode>(mode++)); | ||
if (mode > 5) { | ||
mode = 1; | ||
} | ||
|
||
westonrobot::MotionCommand cmd; | ||
cmd.linear.x = 0.5; | ||
cmd.angular.z = 0.0; | ||
// base.SetMotionCommand(cmd); | ||
|
||
std::cout << "=========================================" << std::endl; | ||
|
||
usleep(100000); | ||
} | ||
|
||
base.RenounceControl(500); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
add_executable(sample_gps_receiver_demo gps_receiver_demo.cpp) | ||
target_link_libraries(sample_gps_receiver_demo westonrobot::wrp_sdk) | ||
target_link_libraries(sample_gps_receiver_demo westonrobot::wrp_sdk_peripheral) | ||
|
||
add_executable(sample_imu_sensor_demo imu_sensor_demo.cpp) | ||
target_link_libraries(sample_imu_sensor_demo westonrobot::wrp_sdk) | ||
target_link_libraries(sample_imu_sensor_demo westonrobot::wrp_sdk_peripheral westonrobot::wrp_sdk_canopen) | ||
|
||
add_executable(sample_ultrasonic_sensor_demo ultrasonic_sensor_demo.cpp) | ||
target_link_libraries(sample_ultrasonic_sensor_demo westonrobot::wrp_sdk) | ||
target_link_libraries(sample_ultrasonic_sensor_demo westonrobot::wrp_sdk_peripheral) | ||
|
||
add_executable(sample_power_regulator_demo power_regulator_demo.cpp) | ||
target_link_libraries(sample_power_regulator_demo westonrobot::wrp_sdk) | ||
target_link_libraries(sample_power_regulator_demo westonrobot::wrp_sdk_peripheral westonrobot::wrp_sdk_canopen) |