Nguyen Nguyen's Notebook - cps-vip/cps-cosimulation-env GitHub Wiki
Script:
- ROS2 sim launch:
ros2 launch vipnav launch_sim.launch.py - NAV2 launch:
ros2 launch vipnav navigation_launch.py use_sim_time:=True - Waypoint publisher launch:
ros2 run vipnav waypoint_publisher.py - Test trigger (fault injection):
python3 test_trigger.py
Test_Trigger: A HELICS publisher that randomly choose between 3 different target to cause fault and send that information to HELICS topic channel "Relay_Sim/fault_dispatch"
Waypoint_Publisher: A ROS-node/HELICS subscriber that take a fault input from HELICS topic channel "Relay_Sim/fault_dispatch" and covert it to coordinate input to publish it to navigation stack (as of feb 17 2026). link: https://github.com/cps-vip/NAV2/blob/main/src/vipnav/node/waypoint_publisher.py
- Create
ActionClient(self, NavigateToPose, 'navigate_to_pose')that make this node an owner of a ROS action client that will take NavigationToPose object and send them to navigate_to_pose action server (which nav2 stack read from) - Take inputs from HELICS via fd stream and covert into float point value
- Create
NavigateToPose.Goal()object and modify the goal coordinate base on the terminal inputs -
self.nav_to_pose_client.send_goal_async(goal_msg)send the goal to to the navigate_to_pose action server
keyboard.launch
- launch teleop_twist_keyboard ROS2 package
rviz2.launch
- launch rviz2 ROS2 package
Team meeting (Jan 9 2025)
- VIP Introduction
- Join Team discord and do welcome quiz Individual Time:
- Read through the syllabus and resource provide in discord to understand VIP mission better
Team meeting (Jan 16 2025)
- Explain the overview of the Cyber-physical System
- Explain what ROS, HELICS, GRIDLAB role in simulating the system
- Join Sub-team (ROS-HELICs)
- Plan and Discuss Kick-off presentation
Sub-team meeting (Jan 17 2025)
- missed
Individual Time
- Look through last year slide and paper catch up
- Prepare for Kick-off presentation
Team meeting (Jan 23 2025)
- Kick-off presentation
- Join sub-sub?-team (mission and navigation) of sub-team (ROS-HELICS)
Sub-team meeting (Jan 24 2025)
- Discuss plan for this semester
- Since mission and navigation have a lot of new member, the plan for this semester is just trying to catch up
Individual Time
- Update Notebook
- Read through last year notebook
- Meet with Natalie and Same (Jan 29 2025)
- Install Docker
- Just search for the latest docker on google and install
- Install and Run ROS Jazzy with Docker
- Open docker and go to images tab. Run your docker through the play button
-
- Type this in cmd:
docker run -p 6080:80 --shm-size=512m tiryoh/ros2-desktop-vnc:jazzy -
- Then type this in browser: http://127.0.0.1:6080/
- Install Gazebo
- from the emulator search firefox for this page and follow its instruction: https://gazebosim.org/docs/harmonic/install_ubuntu/
- To open Gazebo use the following command:
gazebo shapes.sdf -
- Install Docker
Team Meeting (Jan 30 2025)
- Install/Update to ROS Jazzy
- Install/Update to Gazebo Ionic
- New CMD command:
docker run -p 6080:80 --shm-size=512m tiryoh/ros2-desktop-vnc:jazzy
Individual Time
- Research on how Docker container and volume work.
Team Meeting (Feb 6 2025)
- Discuss and decide on what to work on
- I'm gonna learn work on robot modeling
Individual Time
- Trying out the robot gazebo robot tutorial
Team Meeting (Feb 13)
- We have guest speaker today nothing much happen
Sub-team Meeting (Feb 14)
- Discuss mid-term paper coming up.
- Plan on removing redundant part
- New people should revise the system introduction part
Individual Time
-
Following Joseph footstep, I'm trying out the moving robot tutorial https://gazebosim.org/docs/harmonic/moving_robot/
-
The keyboard part seem to be outdated and doesn't work.
-
-
Figured out what went wrong
-
Have to click and find the key publisher tab (really bizarre)
-
Team Meeting
- Going over the robot requirement and current objective of the VIP to help new people figure out what to do
- I'm going to try to implement sensor such as lidar, IMU, etc.. on the simulation robot. Then, I will try to connect it with other sub-team finished substation
Individual Time
- My goal is to finish this guide in the next 2 week: https://www.youtube.com/watch?v=eJZXRncGaGM
- This week I'm doing the requisite guide: https://www.youtube.com/watch?v=QyvHhY4Y_Y8&t=0s
- TF or Transform system is one of ROS2 tool to navigate robot position in the simulation
- Moving shifting robot coordinate and using rviz visualization tool of ROS2 to show (it a lot smoother than gazebo)
-
-
Team Meeting
- Mid-term presentation
- Talk to Will about how the current ROS Jazzy work with Gazebo (both have their own nodes/topics and servers. They communicate through ros_gz_bridge package)
Individual Time
- Finish up lidar tutorial
-
Team Meeting
- Discuss current progress and what to do next
- I wanted to use URDF as base robot file and work with ROS but was told we should focus on Gazebo since simulation is the focus
- It also seem like my understanding of ROS and Gazebo node is lacking, so I want to make sure my understanding is concrete before actually building
Individual Time
- Study up on ROS and watch a few tutorial
Team Meeting
- Everyone in my sub-team seem like they got a pretty rough week
- Plan on catching up during Spring Break (But what is there to catch up? I'm pretty lost on what to do)
Individual Time
- I didn't do much or anything at all because I just didn't know what to do. Sorry!!
- Did a NAV2 tutorial to help Joseph since he couldn't get it to work
- Pretty Cool: https://github.com/user-attachments/assets/63679236-6364-47be-ac4d-ac2bb73cb0fe
Team Meeting
- I feel really sick on Thursday so I couldn't make it
- I think we have guest speaker today so I don't think i missed out much
Individual Time
- I have some test combine with being sick this week so I didn't get much or anything done.
Team Meeting
- Elliot and Sabina is waiting for part to come so in the mean time they want to work with Navigation team to get ready for when the robot is built
- This is pretty much a wake up call for Navigation team
- I make NAV2 repo on GitHub and will start working on a robot to show navigation demo
- Discuss With Sam that for Navigation, it is better to focus on ROS so I will be working on URDF instead of SDF
Individual Time
-
I made a moving robot using the previous mentioned tutorial (it didn't move before)
-
If make any changes: run
colcon build --symlink-installto rebuild the package -
To run the program:
- cd into src file
- source install/setup.bash (basically add the package/our program to ros)
- Type:
ros2 launch NAV2 launch_sim.launch.py(breakdown: ros2 launch <package_name> <launch_file>) - To use keyboard:
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r cmd_vel:=/diff_cont/cmd_vel_unstamped(I wonder if I can add this to launch file) - https://github.com/user-attachments/assets/da2d329c-7c9b-4597-a24a-0277a043a94d
Sub-Team Meeting
- Promise Elliot to get some sort of navigation by next week meeting
Team Meeting:
- Discuss progress with Robot Design Sub-Team
- Try to test with the electrical substation given by physical environment sub-team
- Gazebo was really laggy due to the sheer amount of object in the substation so we couldn't test.
Individual Time:
- Implemented SLAM toolbox. To run type:
ros2 launch slam_toolbox online_async_launch.py slam_params_file:=./NAV2/config/mapper_params_online_async.yaml use_sim_time:=true(I will write launch file for convenience later) - Make rviz2 and keyboard launch file for convenience
Individual Time:
- Work on the final presentation for Spring 2025
- Added the current progress on NAV2 and the ROS2 package that we used (SLAM, Lidar, ROS2 Control)
Team Meeting:
- Final Presentation
Individual Time:
- Work on the final paper for Spring 2025
- Added the current progress on NAV2 and the ROS2 package that we used (SLAM, Lidar, ROS2 Control)
Team Meeting:
- No team meeting
Team meeting:
- VIP Introduction presentation
Team meeting:
- New member introduction
- Discuss this semester's goal and plan
- Navigation sub-team merge with fault detection
- Implement way point navigate of NAV2 in code this semester
- Read over last semester fault detection progress since there is no returning member that worked on it
- Discuss Kick-off presentation
Individual time:
- Work on Kick-off presentation
- Merge NAV team with fault dectection team
Team meeting:
- Kick-off meeting
- Discuss with Will about continue with Navigation team or switching to security: I will try to do both
Individual time:
- Look over last semester code to re-familiarize with ROS.
Team meeting:
- Give resources and help new member learn ROS and our current progress
- To be continue
Individual time:
- re-familiarize myself with ROS and HELICS by looking through the code and rerun the NAV2 program from last year
- read through NAV2 Library to figure out how to implement way-point navigation
Team meeting:
- Nothing worth noting
Individual time:
- Looking in move_base library to publish pose goal to NAV2
Team meeting:
- Goes over wire shark operation
- Detect embedded device that continuously sent data to the network
- Conclusion: the device connect to network is most likely substation monitor or robotics operation that is timing critical
Individual time:
- Create waypoint_publisher node that receive an input (currently keyboard for testing purpose) and sent out a goal pose to move_base
- Currently not working as expect. Will debug soon
- https://github.com/cps-vip/NAV2/blob/b5153b9b34a58498783c03d73d286fbe96a48e12/src/NAV2/node/waypoint_publisher.py
-
Team meeting:
- Dicuss current progress
- Help new member with their docker problem
- Should change docker image to Joseph's image
Individual Time:
- Finished waypoint_publisher
- NAV2 launch command:
ros2 launch nav2_bringup navigation_launch.py use_sim_time:=True - 2d Nav goal in rviz2 actually set it goal pose to the NavigationToPose action server, which then publish to move_base, instead of just directly publish to move base
- Thus, I adjust my code to sent the pose goal to NavigationToPose action server instead
- Result:
- NAV2 launch command:
Recording.2025-10-08.225321.compress.mp4
Team meeting:
- Mid-term presentation
Individual Time:
- Prepare for Mid-term presentation
- Now that Navigation is finish, perhaps I'll check on the Fault Detection and Physical Simulation
- Talk to Sabina about integrating ROS2 and Physical Robot. The first concern is communication protocol, which need to be agree from both ROS2 (deploy on the RasPI) and Arduino side that control the hardware.
- Planning on using C++ since it allow a more precise control over serial communication (I understand it conceptually kinda, but I couldn't visualize how C++ does it and how to implement)
Individual time:
- I was pretty swamped this week due to mid-term so I didn't get anything done.
Team Meeting
- Meet a new instructor that will help Will with ROS/HELICS sub-team.
- Explain what how sub-team goal and current progress is to our new instructor
Individual time:
- My current Nav2
- I'm still very unclear on how Serial communication work
Team Meeting: Final Presentation
Individual time:
- I wrote some simple C++ serial comm node, which I'm not sure if it work: https://github.com/Nano5555/Serial-Com/blob/main/node/keyboardR_SerialP.cpp
- So in order to test it (without having access to raspberry pi), I try connect my laptop USB port, which need to be expose to WSL and VM, and send that information to my desktop.
- List USB Port in Window powershell:
usbipd list
- List USB Port in Window powershell:
- Bind USB (readying the USB port to be expose to VM):
usbipd bind --busid <busid> --force - Attach it to WSL:
usbipd attach --wsl --busid <busid> - Check VM:
lsusb
Goal 1: finish mission 1, create a fault in gridlabd and generate a coordinate to send to ROS/NAV2 system to navigate to the coordinate
Goal 2: Implement the hardware interface between ROS and hardware
Progress:
- Goal 1
- My current vm does not have HELICS install, so I upgrade/change my current vm to Elliot which is probably the most up-to-date vm with HELICS GRIDLABD and ROS2/NAV2
- Successfully run NAV2 in Elliot VM
- Added a test_trigger to mimic a fault injection behavior and send it to waypoint_publisher via federate communication.
Screen.Recording.2026-02-25.001841.mp4
-
updated to work with simple_gridlabd_example. Here are the step:
We need 3 terminal: for each terminal:
cd ~/NAV2/srcsource install/setup.
Start NAV2 stack: -
ros2 launch vipnav launch_sim.launch.pyRun simple_gridlabd_example + ros core: -
bash ./cc_run_example.shRun waypoint publisher: -
bash ./cc_run_example.sh
Screen_Recording_2026-02-25_051750.mp4
- Goal 2
- Waiting on the raspberry pi.
Goal 2: implement hardware interface between ROS2 and hardware controller - This week I'm planning on looking into Rust, starting by reading and following the Rust booK: https://doc.rust-lang.org/book/title-page.html - I'll also set up the raspberry pi in the meantime of learning Rust and C++
Progress
Setting up the Pi:
- using instruction from here to ssh to the pi: https://github.com/cps-vip/raspi/wiki (used vscode remote desktop extension)
Problem I encountered:
- I couldn't access the internet 🤔
-
ping 8.8.8.8 work but ping google.com didn't so it a DNS problem
-
After digging around, Pi didn't have DNS server/config set up so it couldn't resolve any domain
-
Fix:
-
sudo nano /etc/systemd/resolved.confwrite to resolved.conf file (Set: DNS=8.8.8.8 Set: FallbackDNS=1.1.1.1) sudo systemctl restart systemd-resolved
-
-
- Didn't have serial permission 🙁
- Fix: either use sudo before every cargo.... or
sudo usermod -a -G dialout $USERto set current permission (need to reboot).
- Fix: either use sudo before every cargo.... or
Raspberry Pi schematic:
STM-32 Schematic:
After getting 2 raspberry pi with broken serial pins, I was able to get serial communication going using Rust:
However, rclrs (community ros support for rust) was a lot worse than expect so I switch to C++. This picture show a velocity node that:
- Get Robot forward and rotational velocity from NAV2 via cmd/vel
- Calculate wheel velocity
- Send wheel command to STM32 via Serial communication