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

[Spinal][Config] Additional features and new configuration for Spinal #630

Open
wants to merge 105 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
05fd4ca
[Spinal][Dynamixel] transplanted dynamixel interface to spinal
sugihara-16 Mar 1, 2024
af3f910
[Spinal][Encoder] modified encorder interface imitating neuron one
sugihara-16 Mar 1, 2024
e3094c5
[Spinal] change usart3 bardrate as 1Mbps
sugihara-16 Mar 1, 2024
3c8cad0
[Spinal][Servo][WIP] create a new universal interface to control servos
sugihara-16 Mar 1, 2024
fc6d98c
[Spinal][Servo] fix complile erors in servo interface (stil not work)
sugihara-16 Mar 2, 2024
d1b0d79
[Spinal][Servo] add implimentation to call servo interface from main.cpp
sugihara-16 Mar 2, 2024
8bec34e
[Spinal][Servo][WIP] modifed some details and add MPU setting
sugihara-16 Mar 2, 2024
7e33926
[Spinal][Servo] add new task to treat servos directly
sugihara-16 Mar 4, 2024
2521f92
[Spinal][Servo] change servo flag name
sugihara-16 Mar 4, 2024
91d1380
[Spinal][Servo][WIP] workaround send command to dynamixel
sugihara-16 Mar 4, 2024
756c41a
[Spinal][Servo] create a new service to set configuration of direct c…
sugihara-16 Mar 5, 2024
a499730
[Spinal][Servo] workaround to set configuration of direct servos to f…
sugihara-16 Mar 5, 2024
bfcabad
[Spinal][Servo] add interface to set target angle directly
sugihara-16 Mar 5, 2024
0adcf56
[Spinal][Servo] fix some bugs
sugihara-16 Mar 6, 2024
2835e21
[Spinal][Servo] change the priority of servotask from idle to realtime
sugihara-16 Mar 7, 2024
4afb83a
[Spinal][Servo] fixed bug in a function of toruqe enabling
sugihara-16 Mar 7, 2024
a6d1bfa
[Spinal][Dynamixel] limit the situation in which offset and torque pa…
sugihara-16 May 12, 2024
0f0cc83
[Spinal][Dynamixel] modified maximum servo number from 4 to 8.
sugihara-16 May 13, 2024
7c147cb
[Spinal][servo] Create README for servo interface
sugihara-16 May 13, 2024
ae4e197
[Spinal][Servo] resize the servo message as same as maximum servo num.
sugihara-16 May 15, 2024
2fb5a3a
[ServoBridge] workaroud to use servo profiles in spinal firmware.
sugihara-16 May 19, 2024
8541587
[Spinal][Servo] use servo index to indentify servo
sugihara-16 Jun 3, 2024
d787196
[Spinal][Servo] workaround to use rqt to monitor and setup direct ser…
sugihara-16 Jun 4, 2024
77dfc1a
[Spinal][Servo] debug around reading servo from rqt
Jun 4, 2024
d4567ec
Merge pull request #6 from koutarou-kaneko/PR/Spinal/dynamixel
sugihara-16 Jun 5, 2024
f14dc52
[Spinal][Servo] debug around boad configurator
Jun 7, 2024
70b11db
Merge pull request #7 from HisaakiIida/PR/Spinal/dynamixel
sugihara-16 Jun 7, 2024
e09da5e
Merge branch 'PR/feature/spinal/imu/icm20948' into develop/spinal/jsk…
sugihara-16 Jun 24, 2024
06f96b4
[Spinal][Servo] change the port for servo control from usart3 to usart2
sugihara-16 Jun 24, 2024
d2a33e7
[Spinal][Servo] workaround to use servo and gps simultaneously
sugihara-16 Jun 24, 2024
ee9acce
[Spinal][DShot] add telemetry function for the ESCs that support. The…
Li-Jinjie Jan 20, 2024
8496009
[Spinal][DShot] add DShot code from https://github.com/mokhwasomssi/s…
Li-Jinjie Jan 20, 2024
bdf1616
[Spinal][DShot] add DMA function for DShot PWM. only set the CubeMX a…
Li-Jinjie Jan 20, 2024
2a6c327
[Spinal][DShot]: remove redundant code for esc_telem
Li-Jinjie Jan 21, 2024
73e2f38
[Spinal][DShot]: create the new dshot class
Li-Jinjie Jan 21, 2024
ad47137
[Spinal][DShot]: change the PWM setting in CubeMX for DShot; fix a ty…
Li-Jinjie Jan 21, 2024
8468194
[Spinal][DShot]: try to change pwm to dshot. Not tested.
Li-Jinjie Jan 21, 2024
694a39a
[Spinal][DShot]: fix bugs, now the code can be built without errors.
Li-Jinjie Jan 23, 2024
0ad0c6a
[Spinal][DShot]: change the memory size for dma buffer. The original …
Li-Jinjie Jan 23, 2024
933e8d1
[Spinal][DShot]: only one motor can rotate. do not know why
Li-Jinjie Jan 24, 2024
a698c08
[Spinal][DShot]: [SUCCESS] change settings to use NPU. NPU is critica…
Li-Jinjie Jan 25, 2024
89bc055
[Spinal][DShot]: add one flag to decide if using telemetry or not.
Li-Jinjie Jan 26, 2024
312783a
[Spinal][DShot]: change the UART for receiving dshot telemetry to RX …
Li-Jinjie Jan 26, 2024
46e9613
[Spinal][DShot]: add msg for telemetry
Li-Jinjie Jan 26, 2024
5829cb8
[Spinal][DShot]: achieve dshot telemetry of one motor. test using deb…
Li-Jinjie Jan 26, 2024
100c983
[Spinal][DShot]: add code to communicate with ros. tested successfully!
Li-Jinjie Jan 26, 2024
ac1fa83
[Spinal][DShot]: refactor dshot class to triggering one by one. teste…
Li-Jinjie Jan 26, 2024
2380263
[Spinal][DShot]: refactor esc_telem class to measure one by one. Unsu…
Li-Jinjie Jan 26, 2024
3402f83
Revert "[Spinal][DShot]: refactor esc_telem class to measure one by o…
Li-Jinjie Jan 29, 2024
85622f7
Revert "[Spinal][DShot]: refactor dshot class to triggering one by on…
Li-Jinjie Jan 29, 2024
252c294
[Spinal][DShot]: add time stamp to ESCTelemetryArray.msg
Li-Jinjie Jan 29, 2024
133395f
[Spinal][DShot]: add esc_reader support for different esc_msgs
Li-Jinjie Jan 29, 2024
0cf91f2
[Spinal][DShot]: send telem flag to different motors. one telem for o…
Li-Jinjie Jan 29, 2024
5ccaee6
[Spinal][DShot]: finish the eRPM measurement of different motors. Tes…
Li-Jinjie Jan 29, 2024
e3d9bb8
[Spinal][DShot]: polish the dshot code for rotor measurement
Li-Jinjie Jan 29, 2024
68263e8
[Spinal][DShot]: add crc to ESCTelemetry.msg for debugging
Li-Jinjie Jan 29, 2024
2f38b70
[Spinal][DShot]: refactor some names; add constraints for dshot value
Li-Jinjie Jan 30, 2024
59294a9
[Spinal][DShot]: add support to reverse rotation directions. tested!
Li-Jinjie Jan 30, 2024
6c13b95
[Spinal][DShot]: change telemetry info from erpm to real rpm!
Li-Jinjie Jan 30, 2024
0b4cc22
[Spinal]: fix typo
Li-Jinjie Jan 31, 2024
1fbc859
[Spinal][DShot]: refactor rx_buf_ to esc_telem_rx_, in case of unambi…
Li-Jinjie Feb 1, 2024
93c6c88
[Spinal][DShot]: remove code for dshot config, since unsuccessful
Li-Jinjie Feb 2, 2024
58f071c
[Spinal][Battery]: use dshot telemetry to update the battery voltage
Li-Jinjie Feb 5, 2024
30605b6
[Spinal][Dynamixel] change the Dynamixel reading procedure from send-…
Li-Jinjie Sep 20, 2024
3c7857f
[Spinal][Dynamixel] make the send freq. the same as INST_GET_PRESENT_POS
Li-Jinjie Sep 20, 2024
54ce3fc
[Spinal][Dynamixel] refactor code to support quick reading for Dynami…
Li-Jinjie Sep 20, 2024
ec7cfa1
[Spinal][Dynamixel] fix a bug after cherry-pick
Li-Jinjie Oct 3, 2024
c8857f9
[Spinal][DShot][WIP] workaround to use dshot in Spinal 4.1
sugihara-16 Oct 3, 2024
43387bb
[Spinal][DShot] workaround to use Dshot and ESC telemetry in Spinal v…
sugihara-16 Oct 4, 2024
cc7932b
[Spinal][DShot] modified volatage sensing update procudure
sugihara-16 Oct 4, 2024
97d2059
Merge branch 'develop/spinal/jsk_lib/dynamixel/spinal_v2' into develo…
sugihara-16 Oct 15, 2024
028faee
[Spinal4.1][DShot] restore the procedure of reading esc telem as prev…
sugihara-16 Oct 16, 2024
889a993
Merge branch 'PR/feature/Spinal_4_1/DShot' into develop/Spinal/Dshot
sugihara-16 Oct 16, 2024
32cc26f
[Spinal][Config][ver4.1] workaround to enable servo control in spinal…
sugihara-16 Oct 16, 2024
3915880
[Spinal][Config][ver4.1] add roslib build instruction for stm32h7_v2
sugihara-16 Oct 16, 2024
c526775
Merge pull request #8 from Li-Jinjie/PR/Spinal/dynamixel
sugihara-16 Oct 16, 2024
e13e94e
Merge branch 'PR/Spinal/dynamixel' into develop/Spinal/Config/ver_4_1
sugihara-16 Oct 16, 2024
d72fdcc
[Spinal][Dynamixel] modified servo task priority
sugihara-16 Oct 16, 2024
1081a8f
[Spinal][Dynamixel] modified max servo number
sugihara-16 Oct 16, 2024
5dabc7e
[Spinal][Servo] modified way of gain transmitting to avoid write error
sugihara-16 Oct 16, 2024
9a32c08
[Spinal][Servo] debug around the method to distinguish invalid servo ID.
sugihara-16 Oct 23, 2024
8a5dc81
[Spinal][H7_V1] revert ping uart2 and 3 config as master
sugihara-16 Oct 29, 2024
7ca7ffe
[Spinal][Config] add new flag to distinguish special board version
sugihara-16 Oct 29, 2024
e300e6e
[Spinal][DirectServo] choose correct MPU region according to board ve…
sugihara-16 Oct 29, 2024
83c9461
[Spinal][DirectServo] dynamically configure Pin setting for servo.
sugihara-16 Oct 29, 2024
2e3819c
[Spinal][Config][WIP] create separated config files corresponding to …
sugihara-16 Oct 29, 2024
b455d92
[Spinal][Config][F7] configure CubeIDE project for SpinalF7 based on …
sugihara-16 Oct 29, 2024
834ad6c
[Spinal][Config][H7] configure CubeIDE project for SpinalH7 based on …
sugihara-16 Oct 29, 2024
4983cce
[Spinal][Config][H7_v2] configure CubeIDE project for SpinalH7_v2 bas…
sugihara-16 Oct 29, 2024
366b3d1
[Spinal][F7] update the way to call magencoder
sugihara-16 Oct 29, 2024
31599a3
[Spinal][H7&H7_V2] modified imu select condition
sugihara-16 Oct 29, 2024
21a1d58
[Spinal][config] delete previous common config file.
sugihara-16 Oct 29, 2024
4d4c9cc
[Spinal][Dshot] deleted unused include path.
sugihara-16 Oct 29, 2024
fc0dcdc
[Spinal][Controller] add a dynamic board configurator for the method …
sugihara-16 Oct 30, 2024
e73d86c
[Spinal][Config] add new flag to determine whether Spinal uses dshot …
sugihara-16 Oct 30, 2024
94302b8
[Spinal][ACD] Rvert adc channel from 18 to 15 to revive previous volt…
sugihara-16 Oct 31, 2024
b2b4e13
[Spinal][Servo] Debug of infinity loop in sevoTask function when dire…
sugihara-16 Oct 31, 2024
fe292ee
[Spinal] Initialize battery instance according to Dshot falg.
sugihara-16 Oct 31, 2024
74dbb60
[Spinal] remove the exectuable attribute for config files
tongtybj Nov 2, 2024
bd4ffab
Merge pull request #9 from tongtybj/develop/Spinal/Config/ver_4_1
sugihara-16 Nov 2, 2024
02751b4
Revert "[Spinal][Encoder] modified encorder interface imitating neuro…
sugihara-16 Nov 4, 2024
0790da2
Revert "[Spinal][F7] update the way to call magencoder"
sugihara-16 Nov 4, 2024
dd50b56
[Spinal][Config] add new flag to determine Spinal or Neuron.
sugihara-16 Nov 4, 2024
0d585b3
[Spinal][Dynamixel] Add build macro abount the part related to extern…
sugihara-16 Nov 4, 2024
d05f3ca
Merge remote-tracking branch 'sugihara/PR/Spinal_4_1/new_config' into…
sugihara-16 Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions aerial_robot_model/include/aerial_robot_model/servo_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
#include <spinal/ServoStates.h>
#include <spinal/ServoControlCmd.h>
#include <spinal/ServoTorqueCmd.h>
#include <spinal/JointProfiles.h>
#include <spinal/UavInfo.h>
#include <controller_manager_msgs/LoadController.h>
#include <controller_manager_msgs/SwitchController.h>
#include <urdf/model.h>
Expand Down Expand Up @@ -200,6 +202,8 @@ class ServoBridge

ros::Publisher servo_states_pub_;
ros::Publisher mujoco_control_input_pub_;
ros::Publisher joint_profile_pub_;
ros::Subscriber uav_info_sub_;
map<string, ros::Subscriber> servo_states_subs_;
map<string, ros::Subscriber> servo_ctrl_subs_;
map<string, bool> no_real_state_flags_;
Expand All @@ -219,6 +223,7 @@ class ServoBridge
void servoStatesCallback(const spinal::ServoStatesConstPtr& state_msg, const std::string& servo_group_name);
void servoCtrlCallback(const sensor_msgs::JointStateConstPtr& joints_ctrl_msg, const std::string& servo_group_name);
bool servoTorqueCtrlCallback(std_srvs::SetBool::Request &req, std_srvs::SetBool::Response &res, const std::string& servo_group_name);
void uavInfoCallback(const spinal::UavInfoConstPtr& uav_msg);

public:
ServoBridge(ros::NodeHandle nh, ros::NodeHandle nhp);
Expand Down
35 changes: 33 additions & 2 deletions aerial_robot_model/src/servo_bridge/servo_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,16 @@ ServoBridge::ServoBridge(ros::NodeHandle nh, ros::NodeHandle nhp): nh_(nh),nhp_(
mujoco_control_input_pub_ = nh_.advertise<sensor_msgs::JointState>("mujoco/ctrl_input", 1);
/* common publisher: torque on/off command */
servo_torque_ctrl_pubs_.insert(make_pair("common", nh_.advertise<spinal::ServoTorqueCmd>(torque_pub_topic, 1)));
/* common publisher: joint profiles */
joint_profile_pub_ = nh_.advertise<spinal::JointProfiles>("joint_profiles",1);
/* subscriber: uav info */
uav_info_sub_ = nh_.subscribe<spinal::UavInfo>("uav_info", 1, &ServoBridge::uavInfoCallback, this);


/* get additional config for servos from ros parameters */
XmlRpc::XmlRpcValue all_servos_params;
nh_.getParam("servo_controller", all_servos_params);

spinal::JointProfiles joint_profiles_msg;
for(auto servo_group_params: all_servos_params)
{
if (servo_group_params.second.getType() != XmlRpc::XmlRpcValue::TypeStruct)
Expand Down Expand Up @@ -126,7 +130,8 @@ ServoBridge::ServoBridge(ros::NodeHandle nh, ros::NodeHandle nhp): nh_(nh),nhp_(
double lower_limit = urdf_model.getJoint(servo_params.second["name"])->limits->lower;

/* get parameters from rosparam */
int angle_sgn = servo_params.second.hasMember("angle_sgn")?
int servo_id = servo_params.second["id"];
int angle_sgn = servo_params.second.hasMember("angle_sgn")?
servo_params.second["angle_sgn"]:servo_group_params.second["angle_sgn"];
int zero_point_offset = servo_params.second.hasMember("zero_point_offset")?
servo_params.second["zero_point_offset"]:servo_group_params.second["zero_point_offset"];
Expand Down Expand Up @@ -391,3 +396,29 @@ bool ServoBridge::servoTorqueCtrlCallback(std_srvs::SetBool::Request &req, std_s
return true;
}

void ServoBridge::uavInfoCallback(const spinal::UavInfoConstPtr& uav_msg)
{
/* Send servo profiles to Spinal*/
spinal::JointProfiles joint_profiles_msg;
for(auto servo_group : servos_handler_){
for(auto servo : servo_group.second){
spinal::JointProfile joint_profile;
if(servo_group.first == "joints"){
joint_profile.type = spinal::JointProfile::JOINT;
}
else if(servo_group.first == "gimbals"){
joint_profile.type = spinal::JointProfile::GIMBAL;
}
else{
ROS_ERROR("Invalid servo type. Please define 'joints' or 'gimbals'.");
continue;
}
joint_profile.servo_id = servo->getId();
joint_profile.angle_sgn = servo->getAngleSgn();
joint_profile.angle_scale = servo->getAngleScale();
joint_profile.zero_point_offset = servo->getZeroPointOffset();
joint_profiles_msg.joints.push_back(joint_profile);
}
}
joint_profile_pub_.publish(joint_profiles_msg);
}
9 changes: 9 additions & 0 deletions aerial_robot_nerve/spinal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ add_message_files(
FlightConfigCmd.msg
Vector3Int16.msg
TorqueAllocationMatrixInv.msg
ESCTelemetry.msg
ESCTelemetryArray.msg
JointProfile.msg
JointProfiles.msg
)

add_service_files(
Expand All @@ -53,6 +57,7 @@ add_service_files(
SetAttitudeGains.srv
ImuCalib.srv
MagDeclination.srv
SetDirectServoConfig.srv
)

generate_messages(
Expand Down Expand Up @@ -97,6 +102,10 @@ add_dependencies(${PROJECT_NAME}_generate_stm32f7_ros_lib ${catkin_EXPORTED_TARG
add_custom_target(${PROJECT_NAME}_generate_stm32h7_ros_lib ALL COMMAND ${CATKIN_DEVEL_PREFIX}/env.sh ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/make_libraries.py --save_path ${PROJECT_SOURCE_DIR}/mcu_project/boards/stm32H7 --support_rtos --support_ethernet)
add_dependencies(${PROJECT_NAME}_generate_stm32h7_ros_lib ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_generate_messages_cpp)

# generate ros_lib for STM32H7_v2
add_custom_target(${PROJECT_NAME}_generate_stm32h7_v2_ros_lib ALL COMMAND ${CATKIN_DEVEL_PREFIX}/env.sh ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/make_libraries.py --save_path ${PROJECT_SOURCE_DIR}/mcu_project/boards/stm32H7_v2 --support_rtos --support_ethernet)
add_dependencies(${PROJECT_NAME}_generate_stm32h7_v2_ros_lib ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_generate_messages_cpp)


install(DIRECTORY ${SPINAL_DIRS}
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
Expand Down
Loading
Loading