-
Notifications
You must be signed in to change notification settings - Fork 5
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
Feature/gazebo-sim-fixes #27
Conversation
sensor updates publishing across topic Untested since gz motor command interface not defined
Adds encoder to joints and motor to joint cmd interface
Updates gazebo sim fixes - up to date with new develop refactor
of dummy v5actuator cmd data
must double check units
but very slowly double check units
validate with plots
attempts to fix bugs
no gz diff drive plugin loaded
Able to send vel cmds Need to validate vel/pos tracking
test_tank launch file for live streaming data
need to validate filtered odom output with plotjuggler
validated with plotjuggler
…_GHOST into feature/gazebo-sim-fixes
Updates gazebo sim fixes branch with develop
…n diff drive is stationary. Must be tuned again for swerve drive.
This branch has V5Actuator update interface that lacks rigorous testing framework to validate. In an attempt to overcome this, a test differential drive model was implemented without the V5actuator update interface using a differential drive gazebo plugin with the intention of combining the urdf model with the V5actuator update interface. However, development deviated from testing the V5actuator update interface to implementing the test diff drive model for developing an autonomy, estimation, control stack. So, this branch has a diff drive with a robot localization stack implemented via a somewhat tuned EKF. I think the main purpose of this branch has deviated from the original purpose and should be merged back into dev. I'm not sure what the status is of the sensor and actuator interfaces. We should discuss this! |
03_ROS/ghost_ros/CMakeLists.txt
Outdated
install(TARGETS | ||
foxglove_diagnostics_node | ||
DESTINATION lib/${PROJECT_NAME}) | ||
# add_executable(foxglove_diagnostics_node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was planning to delete this FYI, bc Foxglove seems sorta unsupported. Will handle in separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been commented out in the CMake.
@@ -35,9 +36,13 @@ class V5RobotPlugin : public gazebo::ModelPlugin { | |||
|
|||
protected: | |||
void jointToEncoderTransform(); | |||
ghost_msgs::msg::V5EncoderState wrapEncoderMsg(const int col_index); | |||
ghost_msgs::msg::V5SensorUpdate populateSensorMsg(); | |||
Eigen::VectorXd motorToJointTransform(Eigen::VectorXd motor_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Header file methods need comment blocks. Autofills on my VSCode by doing /** and then enter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
ghost_msgs::msg::V5EncoderState wrapEncoderMsg(const int col_index); | ||
ghost_msgs::msg::V5SensorUpdate populateSensorMsg(); | ||
Eigen::VectorXd motorToJointTransform(Eigen::VectorXd motor_data); | ||
Eigen::VectorXd jointToMotorTransform(Eigen::VectorXd joint_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should pass these by const ref if they aren't changing, and ref if they are changing. Try to avoid copying non-trivial types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to const ref.
ghost_msgs::msg::V5Joystick joystick_msg_; | ||
|
||
// Constants | ||
float DEG_TO_RAD = M_PI / 180; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can these be 1) either const or constexpr, and 2) moved to ghost_util into a "types.hpp" header. Might want to use somewhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already defined in 01_Libraries/ghost_common/include/ghost_common/util/angle_util.hpp so I just replaced the constants with the constants that already exist.
} | ||
|
||
// Preserves order of joints listed in xacro | ||
void V5RobotPlugin::getJointStates(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this be updateJointStates(), since it isn't returning anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed!
Looks very solid! And we have diff drive actually working in sim, which is dope. There may be a lot of small interface changes on upcoming robot_interface overhaul PR, but those will be on my end lol. Is there a way to add unit testing so we know we can load the plugin and it can load a default config file? I think there is a GazeboTestFixture example somewhere. Can we also add videos to this PR of the working thing for documentation sake? |
testing is in development
Make sure base model and diff drive plugin params agree!
Final Update:
The diff drive test passed! Since there's no fix for now, we will just use a ros2 launch command to launch the sim and visually inspect that everything works. |
The tests have some bad deallocation so you should visually test the diff drive in GZ instead of running this test script.
…re/gazebo-sim-fixes
small cleanup passing tests, approved!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good with this once submodules are fixed
…_GHOST into feature/gazebo-sim-fixes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
PR Summary
PR Link: develop...feature/gazebo-sim-fixes
Issue Link: #6
Description
Develop a Plugin which mocks the V5SensorUpdate and V5ActuatorCommand ROS topics in Gazebo
Reviewers
Tag reviewers.
Required: @MaxxWilson
Optional: @JakeWendling @xwilson03
Changelog
Reviewer Guide
Most changes are in the ghost_sim pkg.
Field walls were removed since it caused a not-obvious bug: when given a cmd_vel, the robot collided with the walls and continued to attempt to achieve a cmd_vel, causing the wheels to slip, changing the odometry readings. Ultimately, the odometry encoder and the imu messages disagreed, causing the EKF to diverge.
Note that the EKF in this PR uses 3 "sensors": gazebo IMU plugin, actual truth model data as "odometry" data, and gazebo diff drive plugin odometry configured as "WORLD" instead of "ENCODER". Therefore, the data given to the EKF is very ideal data. Performance should be monitored with more noisy data.
Testing
Automatic
Manual
ros2 launch ghost_sim test_tank_sim.launch.py
in a separate terminal launch
ros2 topic pub --once /cmd_vel geometry_msgs/msg/Twist "{linear: {x: 5.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}"
or
ros2 topic pub --once /cmd_vel geometry_msgs/msg/Twist "{linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.0}}"
for sinsusoid motion.
If subscribed to the odometry/filtered topic, the pose and twist should update with slight deviation from the gz/model_states pose and twist.
Documentation
Checklist
Here's a video of the diff drive EKF