Skip to content

Testing MobilityOperation plugin response logic for CARMA Freight #180

paulbourelly999 edited this page May 5, 2021 · 1 revision

Creating Hex uper-encoded MobilityOperation messages using CARMA Messenger

This step can be skipped if you do not need to create a custom MobilityOperation message since there is already a one test message present in the message receiver python script.
Clone, install and run CARMA Messenger. Instruction for this can be found on the (CARMA Messenger) github page. Once running, use docker exec -it carma-messenger-core bash to ssh into the container. Once in the contain run source install/setup.bash to allow for rostopic commands. Using the following command you can send any MobilityOperation message to be uper-encoded:

rostopic pub -r 10 /outgoing_mobility_operation cav_msgs/MobilityOperation "header: {sender_id: '', recipient_id: '', sender_bsm_id: '', plan_id: '', timestamp: 0} strategy: "carma/port_drayage" strategy_params: '{ \"cmv_id\": 123, \"cargo_id\": 321, \"operation\": \"MOVING_TO_LOADING_AREA\", \"cargo\": \"false\", \"location\": { \"longitude\": 0.0, \"latitude\": 0.0 }, \"destination\": { \"longitude\": 0.0, \"latitude\": 0.0 }, \"action_id\": 32, \"next_action\": 33 }'"

To receive the binary-encoded output you need a new terminal to ssh into the carma-messenger-core container again and run the rostopic echo /comms/outbound_binary_msgs. This should continuously print outgoing binary-encoded mobility operation messages from the rostopic command used earlier. Take the content of the message, convert each bit to hex with leading zeros and remove the commas and spaces. The resulting string can then be used with the message receiver python script.

Database setup

Navigate to V2X-Hub/configuration/amd64/ and docker-compose up -d db. This will only bring up the mysql docker container based on the docker-compose file present in the current directory. There are some changes to both the docker-compose file and the /mysql directory that should result in the creation of an addition database in the mysql container called "PORT_DRAYAGE. The changes are an additional .sql file for the new database and a docker-compose volume that contains all the files in the mysql directory. Ensure both the "IVP" and "PORT_DRAYAGE" databases are present and populated using mysql -uroot -pivp -h127.0.0.1 to login into the mysql server and the "SHOW DATABASES;" command to view present database.

V2X-Hub setup

After the database is up and running you can build and run the v2x-hub and php images. Using docker-compose up -d php you can run the php images from V2X-Hub/configuration/amd64. To build and run the v2x-hub image navigate to /V2X-Hub and run docker build --network=host -t <image-name>:<image-tag> .. This will build the v2x-hub image in network host mode, in order to connect to mysql container which is required for the build process, with a image name and tag of you choice. Then run the v2x-hub image using docker run --network=host <image-name>:<image-tag>. Once running navigate to https://127.0.0.1:19760 click advance to page. Then navigate to https://localhost:8080 which should bring you to the v2x-hub web page. Login using the credentials added in the user table inside the "IVP" database. Enable MessageReceiver, Mobility