Skip to content

Altivision/bim_viz_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

'''

README

This repo contains two ROS 2 packages:

  • bim_viz - visualizes a BIM building (static) and a robot (moving) in RViz using mesh markers.
  • autoemailserver - a service node that sends alert emails when an event occurs at a given XYZ location.

Tested on ROS 2 Humble (Ubuntu 22.04).


1) Workspace setup

# From your ROS 2 workspace root
colcon build --symlink-install
source install/setup.bash

If you add/modify Python scripts, re-run colcon build and re-source.


2) Package: bim_viz

What it does

  • Publishes two independent markers:
    • /building_marker: a static building mesh (flat grey), latched (TRANSIENT_LOCAL).
    • /robot_marker: a moving robot mesh (red by default), follows /odom position.
  • Both are published in the map frame.
  • RViz config subscribes to both topics.

Run

ros2 launch bim_viz show_bim_and_robot.launch.py

RViz should open with a grid + both meshes visible.

Important topics & params

  • Published topics

    • /building_marker - visualization_msgs/Marker (latched)
    • /robot_marker - visualization_msgs/Marker (periodic updates)
  • Consumed topics

    • /odom - nav_msgs/Odometry (robot position; robot starts at 0,0,0 until messages arrive)
  • Key node parameters (override via launch or CLI)

    • frame_id (string) - default map
    • building_mesh_resource (string) - default package://bim_viz/meshes/building.stl
    • building_scale (double) - default 1.0
    • building_offset_xyz (double[3]) - default [0,0,0]
    • building_color_rgba (double[4]) - default [0.6,0.6,0.6,1.0] (flat grey)
    • building_use_embedded_materials (bool) - default false
    • robot_mesh_resource (string) - default package://bim_viz/meshes/building.stl
    • robot_scale (double) - default 0.01
    • robot_color_rgba (double[4]) - default [1.0,0.1,0.1,1.0] (red)
    • robot_use_embedded_materials (bool) - default false
    • odom_topic (string) - default /odom
    • publish_rate_hz (double) - default 20.0

STL cannot carry textures. If you want textured robots, use a .dae mesh with UV + textures and set robot_use_embedded_materials=true.

RViz tips / known issues

  • If the viewport freezes or RViz crashes, run with software GL:
    LIBGL_ALWAYS_SOFTWARE=1 ros2 launch bim_viz show_bim_and_robot.launch.py
    
  • If you see shimmer/'reflective' look:
    • In RViz ? the Marker display ? disable Lighting.
    • Keep scene scale reasonable; very large meshes can cause near/far plane artifacts.

3) Package: autoemailserver

What it does

Exposes a service /notify_event. You send a location (geometry_msgs/Point) and an event type (int32), and it sends an email to a hardcoded recipient based on the event type.

  • Example mapping (editable in code):
    • 0 ? fire ? fire.officer@example.com (subject [ALERT][FIRE] ...)

Launch the email server

ros2 launch autoemailserver auto_email_server.launch.py

Test the service

ros2 service call /notify_event autoemailserver/srv/NotifyEvent "{location: {x: 10.0, y: 20.0, z: 0.0}, event_type: 0}"

You should see a log �Email sent to �� if SMTP is configured correctly.

SMTP configuration

Edit autoemailserver/config/smtp.yaml (or override via CLI params):

auto_email_server:
  ros__parameters:
    smtp.server: "smtp.gmail.com"
    smtp.port: 587
    smtp.use_ssl: false
    smtp.username: "yourname@gmail.com"
    smtp.password: ""        # recommended: leave blank and export env var SMTP_PASSWORD
    smtp.from: "yourname@gmail.com"
    smtp.timeout: 20.0

Recommended: keep passwords out of files.

export SMTP_PASSWORD="your_app_password_here"

Where to change recipients / message template

Open autoemailserver/scripts/auto_email_server.py:

  • Routing table (recipient per event type):
    self.routing = {
        0: {'email': 'fire.officer@example.com', 'subject_prefix': '[ALERT][FIRE]'},
        # add more types here...
    }
    
  • Email body:
    • _format_body(event_type, location) - returns the message text.
    • Add new branches for new event types.

SMTP background links

https://www.youtube.com/watch?v=y5IasMFYdBc
https://www.cianwang.com/news/web-knowledge/smtp

For Gmail, use App Passwords (requires 2FA). Standard username/password often won�t work without an app password.


4) Troubleshooting

RViz opens but shows nothing

  • Check Fixed Frame in RViz is map.
  • Add two displays:
    • Marker /building_marker
    • Marker /robot_marker

*executable .py not found

  • Ensure the script has shebang and is executable:
    chmod +x <package>/scripts/*.py
    
  • Make sure CMakeLists.txt has:
    install(PROGRAMS scripts/xxx.py DESTINATION lib/${PROJECT_NAME})
    
  • Rebuild + source install/setup.bash.

No email sent

  • Check server logs (auth errors, connection errors).
  • Verify SMTP params and credentials.
  • Some SMTP providers block port 25; use 587 (STARTTLS) or 465 (SSL) as configured.

Robot doesn�t move

  • Verify /odom is publishing:
    ros2 topic echo /odom
    
  • If odom is on a different topic, set odom_topic parameter accordingly (in the launch or via --ros-args -p odom_topic:=...).

5) Quick commands (for hand-off)

Run BIM + robot markers

ros2 launch bim_viz show_bim_and_robot.launch.py

Run email server

ros2 launch autoemailserver auto_email_server.launch.py

Test email service

ros2 service call /notify_event autoemailserver/srv/NotifyEvent "{location: {x: 10.0, y: 20.0, z: 0.0}, event_type: 0}"

6) Notes for customization

  • Change scales/offsets/colors for building/robot via launch params or by editing defaults in the marker node.
  • Add more event types by extending self.routing and _format_body.
  • Textures require .dae meshes with UV/materials; set *_use_embedded_materials=true and ensure textures are installed under the package and referenced with package://. '''

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors